Code breaking is all about finding the secret code.
When the game starts the player should be able to guess the secret code by providing a 4 digits number. The game finishes when the player have found the exact match for the secret code.
- The game will return a
+sign for an exact match - The game will return a
-sign for a digit match - An exact match is a digit that matches a digit of the secret code both in value and in position
- A digit match is a digit that matches a digit of the secret code in value but does not have the correct position
- Exact matches have priority over digit matches
- Once a digit has been used for an exact match in the secret code, it can no longer be used for any digit match
- Secret:
1234, Proposal:1245⇒ Response:++-because two exact matches (1,2) and one digit match (4) - Secret:
1234, Proposal:2002⇒ Response:-because 2 has been used once for a digit match, cannot be re-used (rule 6) - Secret:
1234, Proposal:2200⇒ Response:+ - Secret:
1234, Proposal:1234⇒ Response:++++ - Secret:
2234, Proposal:2234⇒ Response:++++
Requires : maven (2+), java 8
- mvn clean package
- java -jar target/codebreaker-1.0-SNAPSHOT.jar