{"data":{"kind":"file","path":"README.md","version_id":"pxxtommucmnsh13xkwjmegzq","entry":{"name":"README.md","path":"README.md","is_directory":false,"size":2517,"modified_at":"2026-08-09T09:04:14.219000","content_hash":"38350273c49b4dd4f96f85354e6b0cbb61043ab0e19502376c131c5bfbc2a62b"},"entries":[],"content":"# Mahjong Solitaire / Matching Tiles\n\nA verifiers environment that tests LLM ability to solve Mahjong Solitaire puzzles through spatial reasoning and tile matching analysis.\n\n## Overview\n\nMahjong Solitaire is a single-player tile-matching game where the player removes pairs of identical tiles from a layered layout. A tile is \"free\" (selectable) only if:\n- No tile is directly above it on a higher layer\n- It is NOT blocked on BOTH left AND right sides by adjacent tiles on the same layer\n\nThis environment evaluates whether an LLM can:\n1. **Identify free tiles** — correctly determine which tiles are playable given blocking rules\n2. **Find matching pairs** — locate pairs of identical tiles among the free tiles\n3. **Suggest optimal moves** — recommend which pair to remove first\n4. **Reason about spatial constraints** — explain blocking logic step by step\n\n## Tasks\n\nThe environment generates random Mahjong Solitaire boards at two difficulty levels:\n\n- **Easy (Simple)**: 2-layer boards with 4-6 tile pairs\n- **Medium**: 3-layer boards with 6-8 tile pairs and more complex blocking\n\nEach puzzle asks the model to:\n1. List all free tiles\n2. Find all valid matching pairs\n3. Suggest the best first move\n\n## Scoring (Rubric)\n\n| Metric | Weight | Description |\n|--------|--------|-------------|\n| Free Tiles Accuracy | 0.30 | F1 score of identified free tiles vs ground truth |\n| Matching Pairs Accuracy | 0.35 | F1 score of found pairs vs all valid pairs |\n| Best Move Accuracy | 0.25 | Whether suggested move is a valid matching pair |\n| Reasoning Quality | 0.10 | Quality of spatial reasoning explanation |\n\n## Usage\n\n```python\nimport verifiers as vf\n\nenv = vf.load_environment(\"vanlap/mahjong-solitaire\")\n\n# Or with options\nenv = vf.load_environment(\"vanlap/mahjong-solitaire\", difficulty=\"easy\", num_examples=20)\n```\n\n### Parameters\n\n- `difficulty`: `\"easy\"`, `\"medium\"`, or `\"mixed\"` (default: `\"mixed\"`)\n- `num_examples`: Number of puzzles to generate (default: `30`)\n\n## Tile Types\n\nStandard Mahjong Solitaire tiles:\n- **Characters (Man)**: 1m-9m\n- **Dots (Pin)**: 1p-9p\n- **Bamboo (Sou)**: 1s-9s\n- **Winds**: East (E), South (S), West (W), North (N)\n- **Dragons**: Red (R), Green (G), White (Wd)\n\n## Example Puzzle\n\n```\nLayer 0:\n  Row 0:  3m  5p  7s  2m  8p  1s  4m  6p\n  Row 1:  5p  2m  3m  7s  1s  4m  8p  6p\nLayer 1:\n  Row 0:   .   .   E   S   W   N   .   .\n```\n\nFree tiles are those not blocked above and not blocked on both sides. Matching pairs must have the same tile type.\n\n## License\n\nMIT\n","encoding":"utf-8","truncated":false,"total_bytes":2517},"status":null}