This is a special version of the game nim called the "Thirty-one Game" by Mott-Smith in his book Mathematical Puzzles. It can be played with the ace 2, 3, 4, 5, and 6 of each suit from a regular deck of playing cards or with some equivalent collection of twenty-four cards with four each numbered from 1 through 6. Play begins by placing all twenty-four cards faceup on a table. Each of two players in turn removes a card. The values on the cards removed by both players are added to each other as play progresses. Whoever selects the last card to make the total exactly thirty-one wins (an ace counts as 1). If no card is available to yield exactly thirty-one, then the person who selected the last card yielding the largest total less than thirty-one is declared the winner.
My experience has been that all nimlike games are very exciting and enjoyable for a broad range of ages and ability levels. The nim label itself usually refers to a game of subtraction wherein players take turns approaching some target (31 in this example) by taking steps that are limited in size (as by the numerals on the cards) until the goal is reached. In nim-with-cards, as in other nimlike games, I have found that after several contests and perhaps some discussion, players tend to employ a number of reasoning strategies, including thinking backward, identifying key intermediate positions, and comparing opening moves. In a game using the rules from the previous paragraph, students might hypothesize that twenty-four is a key number. That is, if they are able to stop at twenty-four on one turn, they should be able to attain a winning thirty-one on the next turn. In some versions of nimlike games, such an analysis will lead to a successful strategy to win the game every time. In the nim-with-cards version described here, however, players confront one additional problem. To illustrate, suppose that after a player finishes a turn that yields a total of twenty-four, the opponent chooses a 2. Then the obvious winning play would be a 5 card. But if all the 5 cards have been used up, what would have been a winning play leads to the probable loss of the game. The fact that a limit is placed on the number of times each integer can be chosen makes the nim-with-cards game more difficult than other versions of nim. Analysts generally agree that this game favors the first player, but the discovery of an appropriate strategy is not obvious.