Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cancelei/ruby_mastermind_game
This repo is part of the Odin Project.
https://github.com/cancelei/ruby_mastermind_game
Last synced: about 1 month ago
JSON representation
This repo is part of the Odin Project.
- Host: GitHub
- URL: https://github.com/cancelei/ruby_mastermind_game
- Owner: cancelei
- License: mit
- Created: 2023-11-20T11:47:52.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-11-20T13:00:18.000Z (12 months ago)
- Last Synced: 2024-05-17T15:54:27.983Z (6 months ago)
- Language: Ruby
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Overview
Mastermind is a classic code-breaking game played between two players. This Ruby implementation allows a player to play against the computer in two roles: as the code maker or the code breaker.Features
Play as either the code maker or the code breaker.
Computer can guess the player's code using a refined strategy based on feedback.
Computer can create a secret code for the player to guess.
Turn-based gameplay with feedback provided after each guess.
Getting Started
Prerequisites
Ruby (version 2.7 or later recommended)
Installation
Clone the repository to your local machine:bash
Copy code
git clone https://github.com/cancelei/ruby_mastermind_game.git
cd your-repository
Running the Game
Navigate to the game directory and run:Copy code
ruby game.rb
How to Play
As Code Maker
Create a 4-digit code using numbers from 1 to 6.
The computer will attempt to break your code within 12 turns.
As Code Breaker
Guess the 4-digit code created by the computer.
After each guess, you'll receive feedback on exact and partial matches.
Try to break the code within 12 turns.
Contributing
Contributions to improve the game are welcome. Please follow these steps:Fork the repository.
Create a new branch (git checkout -b feature-branch).
Make your changes and commit them (git commit -am 'Add some feature').
Push to the branch (git push origin feature-branch).
Create a new Pull Request.
License
This project is licensed under the MIT License.