Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Mastermind (board game)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Genetic algorithm=== A new algorithm with an embedded [[genetic algorithm]], where a large set of eligible codes is collected throughout the different generations. The quality of each of these codes is determined based on a comparison with a selection of elements of the eligible set.<ref>{{cite journal |url=https://lirias.kuleuven.be/bitstream/123456789/164803/1/kbi_0806.pdf |last=Berghman |first=Lotte |title=Efficient solutions for Mastermind using genetic algorithms |journal=K.U.Leuven |issue=1 |pages=1–15 |year=2007–2008 |archive-url=https://web.archive.org/web/20140909031305/https://lirias.kuleuven.be/bitstream/123456789/164803/1/kbi_0806.pdf |archive-date=9 September 2014 |url-status=dead }}</ref><ref>{{cite book |author1=Merelo J.J. |author2=Mora A.M. |author3=Cotta C. |author4=Fernández-Leiva A.J. |title=Learning and Intelligent Optimization |chapter=Finding an Evolutionary Solution to the Game of Mastermind with Good Scaling Behavior |series=Lecture Notes in Computer Science |editor1-last=Nicosia |editor1-first=G. |editor2-last=Pardalos |editor2-first=P. |date=2013 |volume=7997 |publisher=Springer |isbn=978-3-642-44973-4 |pages=288–293 |doi=10.1007/978-3-642-44973-4_31 |chapter-url=https://doi.org/10.1007/978-3-642-44973-4_31 |access-date=22 December 2021}}</ref> This algorithm is based on a heuristic that assigns a score to each eligible combination based on its probability of actually being the hidden combination. Since this combination is not known, the score is based on characteristics of the set of eligible solutions or the sample of them found by the evolutionary algorithm. The algorithm works as follows, with ''P'' = length of the solution used in the game, ''X''<sub>1</sub> = exact matches ("red pins") and ''Y''<sub>1</sub> = near matches ("white pins"): # Set ''i'' = 1 # Play fixed initial guess ''G''<sub>1</sub> # Get the response ''X''<sub>1</sub> and ''Y''<sub>1</sub> # Repeat while ''X<sub>i</sub>'' ≠ ''P'': ## Increment ''i'' ## Set ''E<sub>i</sub>'' = [[Empty set|∅]] and ''h'' = 1 ## Initialize population ## Repeat while ''h'' ≤ ''maxgen'' and |''E<sub>i</sub>''| ≤ ''maxsize'': ### Generate new population using crossover, mutation, inversion and permutation ### Calculate fitness ### Add eligible combinations to ''E<sub>i</sub>'' ### Increment ''h'' ## Play guess ''G<sub>i</sub>'' which belongs to ''E<sub>i</sub>'' ## Get response ''X<sub>i</sub>'' and ''Y<sub>i</sub>''
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)