Can someone write a code for GAME 23 in cpp. It will be highly appreciated.
The game of â23â is a two-player game that begins with a pile of 23 toothpicks. Players take turns, withdrawing either 1, 2, or 3 toothpicks at a time. The player to withdraw the last toothpick loses the game. Write a C++ Function for human vs. computer program that plays â23â. The human should always move first. When it is the computerâs turn, it should play according to the following rules: 1. If there are more than 4 toothpicks left, then the computer should withdraw 4 â X toothpicks, where X is the number of toothpicks the human withdrew on the previous turn. 2. If there are 2 to 4 toothpicks left, then the computer should withdraw enough toothpicks to leave 1. 3. If there is 1 toothpick left, then the computer has to take it and loses. When the human player enters the number of toothpicks to withdraw, the program should perform input validation. Make sure that the entered number is between 1 and 3 and that the player is not trying to withdraw more toothpicks than exist in the pile