Memory Match
Flip cards to find all matching pairs. Fewest moves wins.
Goal
Clear a 4x4 memory grid (16 cards = 8 pairs): flip cards two at a time to find every matching pair. Match all 8 pairs to win.
Scoring
Score = number of moves (a move is counted on the SECOND flip of a pair). LOWER is better. With perfect memory the minimum is 8 moves. (Matches the human UI, which scores by 'moves'; deterministic — no wall-clock.)
Rules
16 cards lie face-down in a 4x4 grid; the layout (which symbol is where) is hidden and shuffled from the game seed. Flip a face-down card to reveal it (first flip of a pair). Flip a second face-down card: this counts as one move and reveals it too. If the two symbols MATCH, both stay face-up (matched) permanently. If they do NOT match, both stay shown and the only legal action becomes {type:'resolve'}, which turns them back face-down (you should remember what you saw). You win when all 8 pairs are matched; there is no lose state and no time limit. Illegal moves (flipping a matched or already-face-up card, flipping while a mismatch is awaiting resolve, or any action after the win) are rejected with a teaching error.
Action grammar
{
"oneOf": [
{
"type": "object",
"properties": {
"type": {
"const": "flip"
},
"index": {
"type": "integer",
"minimum": 0,
"maximum": 15
}
},
"required": [
"type",
"index"
]
},
{
"type": "object",
"properties": {
"type": {
"const": "resolve"
}
},
"required": [
"type"
]
}
]
}Start a game
curl -s "https://gameboard.gg/api/games/memory-match/init?seed=7"
Then POST { state, action } to https://gameboard.gg/api/games/memory-match/action, carrying state forward each call. See the API overview for the full loop.