https://github.com/yoshitomo-matsubara/mastermind-ai
Mastermind AI project
https://github.com/yoshitomo-matsubara/mastermind-ai
ai game-ai mastermind
Last synced: 10 months ago
JSON representation
Mastermind AI project
- Host: GitHub
- URL: https://github.com/yoshitomo-matsubara/mastermind-ai
- Owner: yoshitomo-matsubara
- Created: 2016-10-23T22:34:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-06T02:53:31.000Z (over 9 years ago)
- Last Synced: 2025-02-01T11:13:36.420Z (over 1 year ago)
- Topics: ai, game-ai, mastermind
- Language: Java
- Homepage:
- Size: 517 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mastermind AI project
## Development
- Java 1.8 +
- Maven
- IntelliJ IDEA
## Usage
$ java -classpath mastermind-ai.jar mastermind.game.GameMaster -c <# of colors> -p <# of positions> [-m ] [-a ]
- *# of colors* must be 1 or greater
- *# of positions* must be 1 or greater
- [optional] *method type*: np (NaivePlayer, default), cfp (ColorFirstPlayer)
- [optional] *answer* is delimited with comma (e.g. 0,1,2,3)
## How to add a new player (strategy)
1. Create a new class file on **mastermind.ai** (e.g. SmartPlayer)
2. Let the new class inherit **mastermind.ai.Player** (abstract class)
(You don't need to override methods other than ***search*** method.)
For example, you need to add the following lines to the new class.
```
public class SmartPlayer extends Player {
public static final String TYPE = "sp";
public SmartPlayer(State goalState) {
super(goalState);
}
@Override
protected State search() {
...
int[] elements = [your guess, each element is between 0 and (# of position - 1)]
return new State(elements, this.colorSize);
}
}
```