Skip to content

Personal challenge to program a Mastermind/Bulls and Cows universal gamesolver. <<work-in-progress>>

Notifications You must be signed in to change notification settings

thomazz-nl/bullsandcows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

bullsandcows

<<work-in-progress>>
Personal challenge to program a universal Mastermind/Bulls and Cows game solver with variable length secret (starting with {9,3}).

Sources used for tactics and examples:

A Mathematical Approach to Simple Bulls and Cows (2015) - Namanyay Goel, Aditya Garg
Optimal algorithms for mastermind and bulls-cows games (2017) - Alexey Slovesnov
Strategies for playing MOO or Bulls and Cows (2010) - John Francis
The computer as Master Mind (1976) - Donald E. Knuth

Third party content (license)

The code includes parts of Combinatorics.js:

/**
 * combinatorics.js
 *
 *  Licensed under the MIT license.
 *  http://www.opensource.org/licenses/mit-license.php
 *
 *  @author: Dan Kogai <dankogai+github@gmail.com>
 *  @modified_by: thomazz-nl
 *  @modifications: extracted a subset of required features
 *
 */

Approach/progress

The two approaches by Namanyay Goel and Aditya Garg worked, I implemented their ideas (so it solved games). However, their code approach of determining the best next guess was flawed: it allowed to spawn endless loops. I was able to fix it, but it was still a lesser than optimal solution, so I abandoned their approach in search of a better algorithm.

Landing on the website of Alexey Slovesnov I found new inspiration, but reverse engineering his code learned me that Slovesnov uses pre-populated decision trees for the static problems of 4 characters. I want a universal/dynamic solution that calculates the decision trees live, but his work is still worth investigating.

To do:

  • Create a GUI to simulate games.
  • Calculate our own decision trees.
  • Separate appropriatly in multiple files.

About

Personal challenge to program a Mastermind/Bulls and Cows universal gamesolver. <<work-in-progress>>

Topics

Resources

Stars

Watchers

Forks