Solves mastermind in 5 moves or less using Knuth's mastermind algorithm.
First, clone the repository:
git clone https://github.com/rickpr/mastermind.git
Then, from within Emacs:
M-x package-install-file
- Select
mastermind.el
from the folder the repo was cloned into (should bemastermind
).
Add to your packages.el
:
(package! mastermind
:recipe (:host github :repo "rickpr/mastermind"))
Then run doom sync -u
(usually invoked by ~/.emacs.d/bin/doom sync -u
) to install.
Choose a mastermind code and press M-x mastermind
. The computer will make a guess.
Let the computer know how many red hits and white hits it has, and it will refine its
guess until it finds the combination. Should take no more than 5 guesses.
Open the file mastermind-test.el
and run M-x eval-buffer
. Then run M-x ert
.