I recently watched the games of BOT PS-Greedy-Two-Move, who played in the annual Antidraugnts tournament. His game contains a bug that appears in many games. Can this bug be fixed? The bot has many checkers left on the board, while the human has only one (or two). The bot makes a bad move, and the human gives up their only checker, and the game ends in a human victory. Looking at this, I want to swear... You have a bunch of checkers on the board, well, just make a move with any other checker!!!
Correct the BOT PS-Greedy-Two-Move program code.
Let's break it down. You've set a condition for the bot to see two moves: move 1, its own, and move 2, the human's. At first glance, it seems the bot can see a win if it's allowed to see three moves, since move 3 is when the human's last checker is removed from the board. However, this isn't true. There is a way for a bot to predict a human victory in just two moves, provided the human has only one checker. Every move on the board has its own name: quiet move, strike move, attack, defense, and checker surrender. You must program the term "checker surrender." The bot moves white, the human moves black. Then we check two conditions: are the white and black checkers on adjacent squares? The answer is yes. Are there empty squares behind the black checker? The answer is yes. And now we write for Black's move: this is a surrender of a checker, therefore White's first move is bad and should be prohibited. That's it, now the bot won't make this erroneous move, but will choose some other move.