## 1
![](1.png)
## 2
| state | num pebble | who’s turn | who always win |
| —– | ———- | ———- | ————– |
| 3 | 3 | a | a |
| 4 | 2 | b | a |
| 5 | 1 | a | a |
| 6 | 6 | b | b |
| 7 | 2 | a | b |
| 8 | 1 | b | b |
| 9 | 5 | a | b |
| 12 | 7 | b | b |
| 16 | 3 | b | b |
“`
const N = 10
range R = 0..N
Count = Count[N],
Count[i:R] = (when (i>0) one -> Count[i-1]).
Pile = Pile[N],
Pile[i:R] = (when (i>=6) take6 -> Pile[i-6] | when (i>=4) take4 -> Pile[i-4] | when(i > 0) take1 -> Pile[i-1]).
set Take6 = {a.take6, b.take6}
set Take4 = {a.take4, b.take4}
set Take1 = {a.take1, b.take1}
Game = Game[N],
Game[i:R] = (when (i>=6) Take6 -> Game[i-6] | when (i>=4) Take4 -> Game[i-4] | when(i > 0) Take1 -> Game[i-1]).
set A = {a.take6, a.take4, a.take1}
set B = {b.take6, b.take4, b.take1}
Alternate = (A -> B -> Alternate).
||Final = (Game || Alternate).
“`