Files
basic-computer-games/93_23_Matches
Martin Thoma e64fb6795c MAINT: Apply pre-commit
Remove byte-order-marker pre-commit check as there would be
many adjustments necessary
2022-03-05 09:29:23 +01:00
..
2022-03-05 09:29:23 +01:00
2022-03-05 09:29:23 +01:00
2022-03-05 09:29:23 +01:00
2022-01-03 19:39:53 +00:00
2022-03-05 09:29:23 +01:00
2022-01-03 02:13:21 -05:00

23 Matches

In the game of twenty-three matches, you start with 23 matches lying on a table. On each turn, you may take 1, 2, or 3 matches. You alternate moves with the computer and the one who has to take the last match loses.

The easiest way to devise a winning strategy is to start at the end of the game. Since your wish to leave the last match to your opponent, you would like to have either 4, 3, or 2 on your last turn you so can take away 3, 2, or 1 and leave 1. Consequently, you would like to leave your opponent with 5 on his next to last turn so, no matter what his move, you are left with 4, 3, or 2. Work this backwards to the beginning and youll find the game can effectively be won on the first move. Fortunately, the computer gives you the first move, so if you play wisely, you can win.

After youve mastered 23 Matches, move on to BATNUM and then to NUM.

This version of 23 Matches was originally written by Bob Albrecht of Peoples Computer Company.


As published in Basic Computer Games (1978):

Downloaded from Vintage Basic at http://www.vintage-basic.net/games.html