#guess #solver #hint #generate #guessing #cows #codebreaker

bin+lib codebreaker-solver

A solver for codebreaker aka. bulls and cows. Generates guesses which will guess the code in at most 5 tries.

1 unstable release

new 0.1.0 Jan 12, 2025

#205 in Science

Download history 124/week @ 2025-01-08

124 downloads per month

MIT license

19KB
408 lines

Codebreaker

About

Codebreaker is a game played with quad paper and pencil. Also knowns as bulls & cows, and popularized as a board game called mastermind. This Command line tool allows you to play the game as the codebreaker guessing the code and receiving a hint after each guess. For more information you may want to visit the wikipedia page about mastermind: https://en.wikipedia.org/wiki/Mastermind_(board_game)

Solver

Next to plainly guessing the code, the user may also enter s to generate a guess, based on a minmax algorithm. Writing this solver is actually the point of this repository. The algorithm is based on Donald Knuths Algorithm for mastermind. It sprinkles in alpha beta pruning and parallizes the search using all cores of the machine.

Dependencies

~1.7–2.5MB
~49K SLoC