Better README, add technical details
[rpsls-bot.git] / README.md
... / ...
CommitLineData
1# Rock-Paper-Scissors-Lizard-Spock
2
3A simple bot to play this game, following ideas from [this article](https://www.his.se/PageFiles/8158/Henrik_Engstrom.pdf).
4
5The rules are given by Sheldon in episode 8 of season 2 of TBBT (The Big Bang Theory).
6
7---
8
9[Online demo](https://auder.net/rpsls/)
10
11Winning should be difficult after a few dozens of rounds, because it's hard to play at random.
12
13Setting "winner bot" and/or increasing memory can improve bot level.
14
15---
16
17## Technical details
18
19Each potential choice is linked to all outputs in a (neural) network, for
20each input in memory. We thus have size of memory x (number of choice)^2 links.
21To select a move, the bot computes the sum of all links weights from an activated choice
22(that is to say, the value of a memory cell) to each output.
23The output with biggest weights sum wins: the move is played.
24
25The reward is then determined from human move: -1 for a loss, 0 for a draw
26(except if "winner bot" is selected, in which case a draw = a loss) and 1 for a win.
27Weights on the active links are updated positively or negatively depending on reward sign.
28All weights are initialized to zero, and since some time is required for learning
29the first moves in the game would be quite random.
30
31See RPS\_network\_2.svg file for an illustration with memory=2 and simple RPS.