The AB game is played with two people. One person chooses a four digit number in which no digit is repeated, say X, and the other person tries to guess it in as few moves as possible. After the guesser guesses some number, say Y, the other person gives information on how closely Y matched with X:
If some digit in Y coincides with a digit in X (in the same position), then the guesser scores an A.
If some digit in Y exists in X but is in the wrong place, then the guesser scores a B.
For instance, if X is 1234 and we guess 2674, we get an A and a B, because the 4 is in the right place, and the 2 is one of the right numbers but isn't in the right place.
This proceeds until the guesser gets the exact number.
A B
The source of the CLI and GUI implementation of the game is available on Github.
Since this project is used as a lab project for the course ENGR1010J Introduction to Computers and Programming at UM-SJTU Joint Institute, the Github repo is temporarily set to private.