... | ... | @@ -112,7 +112,7 @@ We will construct a valid tree by playing games for each possible code. At each |
|
|
2. Play a game for each code $`c \in \mathbb{C}`$
|
|
|
1. Start at the root node.
|
|
|
2. Get a feedback $`f`$ for the current node's guess.
|
|
|
3. If $`f = 0`$, stop.
|
|
|
3. If $`f = \langle N, 0 \rangle`$, stop.
|
|
|
4. If the current node has not a child labeled $`f`$, create this child and initialize it with a random guess not yet used in this game.
|
|
|
5. The child labeled $`f`$ becomes the current node, go to step 2.2.
|
|
|
|
... | ... | @@ -120,7 +120,7 @@ The trees created by this algorithm are rather deceiving: |
|
|
|
|
|

|
|
|
|
|
|
However, there is an obvious way to significantly reduce their height. Notice the long paths without branches consisting of many wrong guesses followed by the right one. Consider for example the leftmost one starting at GBG and finishing in BGG. These paths correspond to situations where there is only one code consistent with the previous guesses. We can shrink each path of this kind to a single node:
|
|
|
However, there is an obvious way to significantly reduce their height. Notice the long paths without branches consisting of many wrong guesses followed by the right one. Consider for example the leftmost one starting at RRB and finishing at RBB. These paths correspond to situations where there is only one code consistent with the previous guesses. We can shrink each path of this kind to a single node:
|
|
|
|
|
|

|
|
|
|
... | ... | @@ -135,6 +135,27 @@ Here is the result after transforming the seven triangles from the previous exam |
|
|
|
|
|

|
|
|
|
|
|
The last tree has 1 node at level 1, 2 nodes at level 2, 16 nodes at level 3 and 8 nodes at level 4. So the average number of iterations to guess the code is
|
|
|
|
|
|
```math
|
|
|
\frac{1 \ times 1 + 2 \times 2 + 3 \times 16 + 4 \times 8}{27} = 3.15
|
|
|
```
|
|
|
|
|
|
We will use this average as a measure of the *fitness* of a player.
|
|
|
|
|
|
The table below shows the fitness of a randomly generated population of 1000 individuals for different types of games. For comparison we give also the fitness of exhaustive players.
|
|
|
|
|
|
|$`N`$|$`C`$| Min| Max| Avg|$`\sigma`$|Exhaustive|
|
|
|
|----:|----:|----:|----:|----:|---------:|---------:|
|
|
|
| 3| 3| 2.74| 3.96| 3.13| 0.19| ~2.70|
|
|
|
| 4| 6| 5.25| 6.18| 5.48| 0.11| ~4.40|
|
|
|
|
|
|
TODO: Re-implement exhaustive breakers and measure their fitness. Add more $`(N, C)`$.
|
|
|
|
|
|
The fitness of our population is much worse than the fitness of the exhaustive players but this is not surprising. The next step is to evolve them and to obtain better fitness.
|
|
|
|
|
|
|
|
|
|
|
|
# References
|
|
|
|
|
|
TODO: add papers to the repo |