Math Card Game

Wouter’s amazing math card game (2 players)

Note: this game I have actually implemented/tested, and it can be quite deep and a lot of fun.

The deck consists of 2 sets (red and blue) of 35 cards each, for a total of 70 cards.

The red cards are:

type amount cards
starters 4 [-2] [0] [2] [4]
numbers 11 2 2 2 3 3 4 4 5 6 8 10
operators 11 + + + - - - * * / / ?
terminators 4 = =
modifiers 5 cancel cancel invert invert swap

To start a game, each player shuffles their deck of 35 cards, and lets the other player “cut” it (like in poker).

Each player draws 6 cards to start. Before your turn, a player ALWAYS has 6 cards, except for the end game when cards are running out.

Players take turns. If a player has not played any cards on the table yet and can’t play any, he puts his whole hand on the bottom of the pile and draws 6 new cards.

Normally, on your turn, you play 2 cards out of your hand, and then draw 2.

Ways to play a card:

  • play a starter card. A starter card starts a sequence. There will be a total of 8 sequences played in a game always.
  • a number: a number card may ONLY be played directly after an operator card in any sequence.
  • an operator card may be played in any sequence after a starter/number, or modifier. the ? operator can be designated by the player playing it to mean any of the 4 operators. It is the duty of the player to remember which operator it stands for (or the card has operators on 4 sides, the one up is the one chosen). / is integer division, i.e. 1 / 2 is 0, not 0.5.
  • a terminator can be played after anything except an operator. It seals the sequence, no more cards can be played to the sequence after it.
  • a modifier may be played after any card except an operator (or terminator). There are 3 possible modifiers:
    • cancel: cancels the last operator+number combo
    • invert: inverts the last operator, i.e. + becomes -, * becomes /, and vice versa.
    • swap: swaps the location of the last TWO operators, i.e. 1+2-3 becomes 1-2+3. Only a legal play if 2 operators are in the sequence.

Sequences are evaluated strictly left to right, and modifiers MUST be resolved before the final result is computed (in algebraic fashion). For example:

[4] + 2 cancel * 5 invert * 2 swap =

is evaluated like:

4              (4, start card)
4 + 2          (6, operator + number)
4              (4, cancel the +)
4 * 5          (20, apply multiply)
4 / 5          (0, apply invert, multiply becomes integer divide)
4 / 5 * 2      (0, apply multiply)
4 * 5 / 2      (10, swap the divide and the multiply)
10             (10, seal the sequence)

Important: Your two cards played must be to seperate sequences (!).

Most important rule: a player on his turn MUST play the maximum number of cards he can, in whatever combination. If you CAN play 2 cards, you MUST play 2 cards. If you can play only 1 card, you must play it. You must play the cards in whatever order maximizes the amount of cards played.

If (once you have at least one card in play) you are able to play less than 2 cards, you put up to 2 cards on the bottom of your pile such that always 2 cards leave your hand per turn. Your turn should always end with 4 cards in your hand, such that you draw 2 to get 6.

The exception is once your pile is empty, you don’t get to draw anything. The game is over once both players are out of cards, or, in rare cases, when both players both had a turn in sequence without being able to play nor draw new cards.

Once the game is over, all 8 sequences are evaluated, and scores tallied (you receive the sum of all sequences that started with a starter cards of yours). highest score wins.