{
 "description": "Verified Soma programs. Every entry passed `soma check` (and `soma test` / `soma verify` where applicable) on the soma version below, re-run when this index was generated. Fetch `url` for the source. Filter by `domain` or `features` to find a working example of what you are about to write.",
 "soma_version": "3.2.4",
 "count": 19,
 "domains": {
  "games": 19
 },
 "features": [
  "agent",
  "cost",
  "fail",
  "guard",
  "http",
  "invariant",
  "lambda",
  "match",
  "multi_cell",
  "native",
  "pipeline",
  "service",
  "skeleton",
  "state_machine",
  "sum_type",
  "think",
  "tools",
  "try"
 ],
 "programs": [
  {
   "id": "games/blackjack",
   "domain": "games",
   "title": "Blackjack — hand scoring with soft/hard aces and bust detection hand_value() sums card ranks, counting each Ace as 11 then demoting to 1 while the total busts",
   "summary": "Blackjack — hand scoring with soft/hard aces and bust detection hand_value() sums card ranks, counting each Ace as 11 then demoting to 1 while the total busts. outcome() compares a player and dealer hand under standard rules (blackjack beats 21-of-three, bust loses). Run: soma run blackjack.cell --signal demo Test: soma test blackjack.cell",
   "url": "https://soma-lang.dev/corpus/games/blackjack.cell",
   "repo_path": "examples/corpus/games/blackjack.cell",
   "lines": 86,
   "features": [
    "match"
   ],
   "cells": [
    "Blackjack",
    "BlackjackTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/card_deck",
   "domain": "games",
   "title": "Card deck — build, deterministic Fisher-Yates shuffle, and deal",
   "summary": "Card deck — build, deterministic Fisher-Yates shuffle, and deal A 52-card deck is built as \"Rank of Suit\" strings. shuffle() uses a seeded linear-congruential PRNG so the permutation is reproducible (no random()). deal() splits the deck into n hands of k cards round-robin. Run: soma run card_deck.cell --signal demo Test: soma test card_deck.cell",
   "url": "https://soma-lang.dev/corpus/games/card_deck.cell",
   "repo_path": "examples/corpus/games/card_deck.cell",
   "lines": 85,
   "features": [],
   "cells": [
    "CardDeck",
    "CardDeckTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/connect_four",
   "domain": "games",
   "title": "Connect Four — drop a disc and detect four-in-a-row",
   "summary": "Connect Four — drop a disc and detect four-in-a-row The board is a flat row-major 6x7 grid (row 0 = top). drop() lands a disc in the lowest empty slot of a column. has_four() scans every horizontal, vertical, and both diagonal directions for four matching discs. Run: soma run connect_four.cell --signal demo Test: soma test connect_four.cell",
   "url": "https://soma-lang.dev/corpus/games/connect_four.cell",
   "repo_path": "examples/corpus/games/connect_four.cell",
   "lines": 93,
   "features": [],
   "cells": [
    "ConnectFour",
    "ConnectFourTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/conway_life",
   "domain": "games",
   "title": "Conway's Game of Life — one generation step on a fixed grid",
   "summary": "Conway's Game of Life — one generation step on a fixed grid The grid is a flat row-major list of 0/1 over an r×c board. step() applies the B3/S23 rule with bounded (non-wrapping) neighbour counts. A blinker oscillates with period 2; a block is still life. Run: soma run conway_life.cell --signal demo Test: soma test conway_life.cell",
   "url": "https://soma-lang.dev/corpus/games/conway_life.cell",
   "repo_path": "examples/corpus/games/conway_life.cell",
   "lines": 82,
   "features": [],
   "cells": [
    "ConwayLife",
    "ConwayTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/craps",
   "domain": "games",
   "title": "Craps — the come-out roll and point-resolution rules come_out(total) resolves the first roll: 7/11 wins, 2/3/12 craps out, any other number becomes the \"point\"",
   "summary": "Craps — the come-out roll and point-resolution rules come_out(total) resolves the first roll: 7/11 wins, 2/3/12 craps out, any other number becomes the \"point\". resolve(point, rolls) plays the rest of the round — rolling the point again wins, a 7 loses. All from a roll log. Run: soma run craps.cell --signal demo Test: soma test craps.cell",
   "url": "https://soma-lang.dev/corpus/games/craps.cell",
   "repo_path": "examples/corpus/games/craps.cell",
   "lines": 77,
   "features": [
    "match"
   ],
   "cells": [
    "Craps",
    "CrapsTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/game_2048",
   "domain": "games",
   "title": "2048 — slide-and-merge a single row (the core move primitive)",
   "summary": "2048 — slide-and-merge a single row (the core move primitive) slide_left() compacts a row toward the left, merging equal adjacent tiles exactly once per move (left-to-right), and reports the points scored (sum of merged tiles). A full board move is four row slides; this is that primitive. Run: soma run game_2048.cell --signal demo Test: soma test game_2048.cell",
   "url": "https://soma-lang.dev/corpus/games/game_2048.cell",
   "repo_path": "examples/corpus/games/game_2048.cell",
   "lines": 77,
   "features": [],
   "cells": [
    "Game2048",
    "Game2048Tests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/guessing_game",
   "domain": "games",
   "title": "Number guessing game — hi/lo feedback and a binary-search solver feedback() compares a guess to the secret and returns \"low\" / \"high\" / \"correct\"",
   "summary": "Number guessing game — hi/lo feedback and a binary-search solver feedback() compares a guess to the secret and returns \"low\" / \"high\" / \"correct\". auto_solve() proves the search space is exhausted in at most ceil(log2(range)) guesses by playing the optimal binary-search strategy. Run: soma run guessing_game.cell --signal demo Test: soma test guessing_game.cell",
   "url": "https://soma-lang.dev/corpus/games/guessing_game.cell",
   "repo_path": "examples/corpus/games/guessing_game.cell",
   "lines": 67,
   "features": [
    "match"
   ],
   "cells": [
    "GuessingGame",
    "GuessingTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/hanoi",
   "domain": "games",
   "title": "Tower of Hanoi — minimum moves and an explicit move list min_moves(n) = 2^n - 1",
   "summary": "Tower of Hanoi — minimum moves and an explicit move list min_moves(n) = 2^n - 1. solve(n) produces the ordered list of \"from->to\" peg moves by the classic recursive strategy, implemented iteratively with an explicit stack so it stays within Soma's handler model. Run: soma run hanoi.cell --signal demo Test: soma test hanoi.cell",
   "url": "https://soma-lang.dev/corpus/games/hanoi.cell",
   "repo_path": "examples/corpus/games/hanoi.cell",
   "lines": 78,
   "features": [],
   "cells": [
    "Hanoi",
    "HanoiTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/mastermind",
   "domain": "games",
   "title": "Mastermind — score a guess with black and white pegs",
   "summary": "Mastermind — score a guess with black and white pegs Black pegs = right colour in the right position. White pegs = right colour in the wrong position, counted with multiplicity via colour frequency matching (the classic rule). Pure scoring over fixed-length code lists. Run: soma run mastermind.cell --signal demo Test: soma test mastermind.cell",
   "url": "https://soma-lang.dev/corpus/games/mastermind.cell",
   "repo_path": "examples/corpus/games/mastermind.cell",
   "lines": 92,
   "features": [
    "match"
   ],
   "cells": [
    "Mastermind",
    "MastermindTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/maze_step",
   "domain": "games",
   "title": "Maze movement — one step with wall collision on a grid",
   "summary": "Maze movement — one step with wall collision on a grid The maze is a flat row-major list: 0 = open, 1 = wall. move() attempts a step in a compass direction; the player stays put if the target is a wall or off the grid. walk() applies a sequence of moves and returns the final position plus whether the exit was reached. Run: soma run maze_step.cell --signal demo Test: soma test maze_step.cell",
   "url": "https://soma-lang.dev/corpus/games/maze_step.cell",
   "repo_path": "examples/corpus/games/maze_step.cell",
   "lines": 82,
   "features": [],
   "cells": [
    "MazeStep",
    "MazeTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/minesweeper",
   "domain": "games",
   "title": "Minesweeper — compute the neighbour-mine board from a mine layout mines is a flat row-major r×c list of 0/1",
   "summary": "Minesweeper — compute the neighbour-mine board from a mine layout mines is a flat row-major r×c list of 0/1. annotate() returns a board where each non-mine cell holds its count of adjacent mines (0..8) and each mine cell holds -1. reveal_safe() reports whether a click is safe. Run: soma run minesweeper.cell --signal demo Test: soma test minesweeper.cell",
   "url": "https://soma-lang.dev/corpus/games/minesweeper.cell",
   "repo_path": "examples/corpus/games/minesweeper.cell",
   "lines": 77,
   "features": [],
   "cells": [
    "Minesweeper",
    "MinesweeperTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/nim",
   "domain": "games",
   "title": "Nim — optimal play via the Sprague-Grundy nim-sum",
   "summary": "Nim — optimal play via the Sprague-Grundy nim-sum In normal-play Nim a position is a loss for the player to move iff the XOR of all heap sizes is 0. nim_sum() computes it; best_move() finds a winning (heap, take) move when one exists, else surrenders. Run: soma run nim.cell --signal demo Test: soma test nim.cell",
   "url": "https://soma-lang.dev/corpus/games/nim.cell",
   "repo_path": "examples/corpus/games/nim.cell",
   "lines": 75,
   "features": [],
   "cells": [
    "Nim",
    "NimTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/pig_dice",
   "domain": "games",
   "title": "Pig — the press-your-luck dice game, scored from a roll log",
   "summary": "Pig — the press-your-luck dice game, scored from a roll log In Pig a player rolls a d6 repeatedly, banking the running total — but a 1 busts the turn and scores 0. turn_score() folds a list of rolls into the banked points. play() runs the \"hold at 20\" strategy over a deterministic roll stream and reports the turn outcomes. Run: soma run pig_dice.cell --signal demo Test: soma test pig_dice.cell",
   "url": "https://soma-lang.dev/corpus/games/pig_dice.cell",
   "repo_path": "examples/corpus/games/pig_dice.cell",
   "lines": 66,
   "features": [
    "lambda"
   ],
   "cells": [
    "PigDice",
    "PigTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/rock_paper_scissors",
   "domain": "games",
   "title": "Rock-paper-scissors — round judging and best-of-N scoring judge(a, b) returns \"p1\", \"p2\", or \"tie\" from the two throws",
   "summary": "Rock-paper-scissors — round judging and best-of-N scoring judge(a, b) returns \"p1\", \"p2\", or \"tie\" from the two throws. play_match scores a list of round pairs and reports the winner. Pure and deterministic. Run: soma run rock_paper_scissors.cell --signal demo Test: soma test rock_paper_scissors.cell",
   "url": "https://soma-lang.dev/corpus/games/rock_paper_scissors.cell",
   "repo_path": "examples/corpus/games/rock_paper_scissors.cell",
   "lines": 72,
   "features": [
    "match"
   ],
   "cells": [
    "RockPaperScissors",
    "RpsTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/snake",
   "domain": "games",
   "title": "Snake — one movement tick with growth, wall and self collision",
   "summary": "Snake — one movement tick with growth, wall and self collision The snake is a list of {y, x} segments, head first. tick() moves the head one cell in the current direction; if it lands on food the tail is kept (grow), otherwise the tail is dropped. A move into a wall or into the snake's own body is reported as a crash. Run: soma run snake.cell --signal demo Test: soma test snake.cell",
   "url": "https://soma-lang.dev/corpus/games/snake.cell",
   "repo_path": "examples/corpus/games/snake.cell",
   "lines": 75,
   "features": [
    "lambda"
   ],
   "cells": [
    "Snake",
    "SnakeTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/tic_tac_toe",
   "domain": "games",
   "title": "Tic-tac-toe win detection — pure board logic",
   "summary": "Tic-tac-toe win detection — pure board logic A board is a flat list of 9 cells, each \"X\", \"O\", or \"\" (empty). The winner() handler scans the 8 winning lines and returns the mark of the winner, \"draw\" if the board is full with no line, or \"\" if still playing. Run: soma run tic_tac_toe.cell --signal demo Test: soma test tic_tac_toe.cell",
   "url": "https://soma-lang.dev/corpus/games/tic_tac_toe.cell",
   "repo_path": "examples/corpus/games/tic_tac_toe.cell",
   "lines": 67,
   "features": [
    "lambda"
   ],
   "cells": [
    "TicTacToe",
    "TicTacToeTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/turn_tracker",
   "domain": "games",
   "title": "Turn tracker — round/phase state machine with player rotation",
   "summary": "Turn tracker — round/phase state machine with player rotation Models a multi-player turn order: the active player index cycles 0..n-1, incrementing the round each time play wraps back to player 0. A `phase` state machine guards the upkeep → main → end → upkeep cycle, with a *->over catch-all so the game always terminates. Run: soma run turn_tracker.cell --signal demo Test: soma test turn_tracker.cell Verify: soma verify turn_tracker.cell (needs soma.toml)",
   "url": "https://soma-lang.dev/corpus/games/turn_tracker.cell",
   "repo_path": "examples/corpus/games/turn_tracker.cell",
   "lines": 71,
   "features": [
    "state_machine"
   ],
   "cells": [
    "TurnTracker",
    "TurnTrackerTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/war",
   "domain": "games",
   "title": "War — the card-comparison game, played to exhaustion",
   "summary": "War — the card-comparison game, played to exhaustion Each card is an integer rank 2..14 (J=11..A=14). A \"battle\" gives the higher card to the winner; ties trigger a simplified \"war\" where the next card decides. play() runs two ordered decks head to head and reports the winner and number of battles. Fully deterministic. Run: soma run war.cell --signal demo Test: soma test war.cell",
   "url": "https://soma-lang.dev/corpus/games/war.cell",
   "repo_path": "examples/corpus/games/war.cell",
   "lines": 76,
   "features": [],
   "cells": [
    "War",
    "WarTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  },
  {
   "id": "games/yahtzee",
   "domain": "games",
   "title": "Yahtzee — score a roll of five dice in any category counts() buckets the five dice into face frequencies",
   "summary": "Yahtzee — score a roll of five dice in any category counts() buckets the five dice into face frequencies. The category scorers read those buckets: upper boxes, n-of-a-kind, full house, straights, and the 50-point Yahtzee. All pure integer logic. Run: soma run yahtzee.cell --signal demo Test: soma test yahtzee.cell",
   "url": "https://soma-lang.dev/corpus/games/yahtzee.cell",
   "repo_path": "examples/corpus/games/yahtzee.cell",
   "lines": 99,
   "features": [
    "lambda"
   ],
   "cells": [
    "Yahtzee",
    "YahtzeeTests"
   ],
   "manifest": "https://soma-lang.dev/corpus/games/soma.toml"
  }
 ]
}