r/genetic_algorithms • u/nolanritchie • Jun 30 '16
What is the algorithm used here?
http://undeniable.info/lol/stones.php
0
Upvotes
2
u/t0rtue Jul 15 '16
This is a variant of Nim game
Math theory behind and winning formula are well know.
1
1
u/umutto Jun 30 '16 edited Jun 30 '16
It is a really simple modulus based heuristic, you can check it by looking at the page source. There are only a couple of if-else cases.
I think the algorithm is trying to force the amount of stones in players turn to be mod 4 - 3 (amount % 4 - 3), which ends up in 5 where you can't really win.
1
u/lolcop01 Jun 30 '16
Definitely no genetic algorithm. Seems to be a pretty easy heuristic (like "if X stones are left, take Y").