豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

YuenSzeHong/mastermind-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mastermind Game

This is a web-based implementation of the classic Mastermind board game, created as a personal project before starting university. The game challenges players to guess a hidden code by making a series of guesses and receiving feedback on the correctness of their guesses.

Game Rules

  • The game generates a secret code consisting of a sequence of colored pegs.
  • The player tries to guess the code by placing colored pegs on the board.
  • After each guess, the game provides feedback by indicating the number of pegs that are the correct color and in the correct position (black key pegs) and the number of pegs that are the correct color but in the wrong position (white key pegs).
  • The player continues making guesses until they correctly guess the code or run out of attempts.

Technologies Used

  • HTML
  • CSS
  • JavaScript

Features

  • Interactive game board with drag and drop functionality for placing pegs.
  • Randomly generated secret code for each game session.
  • Feedback system providing hints based on the player's guesses.
  • Timer to track the duration of each game.
  • Responsive design that adapts to different screen sizes.

How to Play

  1. Open the index.html file in a web browser.
  2. The game will generate a secret code.
  3. Drag and drop the colored pegs onto the game board to make your guess.
  4. Click the "Check" button to receive feedback on your guess.
  5. Continue making guesses until you crack the code or run out of attempts.
  6. The timer will track the duration of your game session.

Project Status

This project represents the original version of the Mastermind game, developed before starting university. It serves as a snapshot of my programming skills and understanding at that time. While the game is fully playable, there may be opportunities for improvement and optimization.

I plan to make further enhancements and refactor the codebase based on the knowledge and skills I have acquired since then on the main branch. The version that i wrote before university is available at the before-university branch.

License

This project is licensed under the Apache License 2.0.

Attribution

If you use, modify, or distribute this code, please provide attribution to the original author as follows:

  • Include a copy of the license
  • Mention the project name and the author's name
  • Provide a link to the original repository or the author's GitHub profile

For example:

This project is based on the [Mastermind Game](https://github.com/YuenSzeHong/mastermind-game) by [Yuen Sze Hong](https://github.com/YuenSzeHong/), licensed under the Apache License 2.0.

Acknowledgements

  • The Mastermind game concept and rules are based on the original board game created by Mordecai Meirowitz.
  • The project was inspired by various online tutorials and resources on web development and game programming.

Feel free to explore the code, provide feedback, or contribute to the project. Enjoy playing Mastermind!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors