<<work-in-progress>>
Personal challenge to program a universal Mastermind/Bulls and Cows game solver with variable length secret (starting with {9,3}).
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
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
*
*/
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.
- Create a GUI to simulate games.
- Calculate our own decision trees.
- Separate appropriatly in multiple files.