chips lists them from left to right as the letters A and B. Two players take turns, and the first player starts.
- The first player may remove an A chip only if both of its neighbours are also A.
- The second player may remove a B chip only if both of its neighbours are also B.
- Chips at either end of the row can never be removed.
After a removal the row closes up. A player who cannot move loses. Both play optimally. Return True if the first player wins and False if the second does.chips="BAAAAB" → True
The first player has two moves (the middle As), the second has none. The first player moves and the second is stuck.
chips="AAABBB" → False
Each player has one move. The first uses it, the second uses theirs, and the first is left without a move.
chips="AB" → False
There are no inner chips, so the first player loses at once.
chips consists of the letters A and Bchips="BAAAAB"
True
Run checks the first 3 tests in your browser. Submit checks all 185 tests on the server, hidden ones included.