{"id":51836265,"url":"https://github.com/fildon/tak","last_synced_at":"2026-07-22T22:03:53.209Z","repository":{"id":359740069,"uuid":"1247284245","full_name":"fildon/tak","owner":"fildon","description":null,"archived":false,"fork":false,"pushed_at":"2026-05-23T07:19:17.000Z","size":102,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-23T09:20:00.838Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fildon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-23T05:43:09.000Z","updated_at":"2026-05-23T07:19:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/fildon/tak","commit_stats":null,"previous_names":["fildon/tak"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/fildon/tak","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fildon%2Ftak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fildon%2Ftak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fildon%2Ftak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fildon%2Ftak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fildon","download_url":"https://codeload.github.com/fildon/tak/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fildon%2Ftak/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35778989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-22T02:00:06.236Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-22T22:03:51.229Z","updated_at":"2026-07-22T22:03:53.196Z","avatar_url":"https://github.com/fildon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tak\n\nA web app for playing the board game [Tak](https://cheapass.com/tak/), built with a clean 2D aesthetic in the style of chess.com.\n\n**[▶ Play now →](https://rupertmckay.com/tak/)**\n\n## Monorepo structure\n\n```\ntak/\n  packages/\n    shared/     # TypeScript types, game logic, move validation\n    frontend/   # React + Vite  (single-page app)\n    engine/     # Rust AI engine compiled to WebAssembly via wasm-pack\n```\n\n## Tech stack\n\n| Layer        | Tech                                        |\n| ------------ | ------------------------------------------- |\n| Frontend     | React 18, TypeScript, Vite 5                |\n| AI engine    | Rust → WebAssembly (wasm-pack)              |\n| Shared logic | TypeScript (CommonJS, consumed by frontend) |\n| Monorepo     | npm workspaces + Turborepo                  |\n\n## Architecture\n\n### AI engine (Wasm)\n\nThe Rust engine (`packages/engine`) compiles to a `.wasm` binary via `wasm-pack` and runs entirely in the browser inside a **Web Worker** — the main React thread never blocks during search.\n\n```\nReact UI  ──postMessage──►  engine.worker.ts  ──Wasm call──►  tak_engine.wasm\n          ◄──postMessage──                    ◄──────────────\n```\n\nThe Rust crate has no Wasm-specific code beyond `lib.rs` (the `#[wasm_bindgen]` entry point) and `js_sys::Date::now()` for timing. The same source compiles to a native binary if a CLI or server-side use case ever arises.\n\n**Why Wasm is sufficient here:**\n\n- Zero deployment cost — the `.wasm` file is a static asset served by Vite alongside the JS bundle\n- No backend required for single-player (PvC) — the whole app deploys to Vercel as a static site\n- No cold-start latency — the engine initialises once per page load and stays resident\n- Works offline\n\n**When a native process would be needed instead:**\nOnline multiplayer would require a `packages/backend` (Node + Socket.io). If server-side AI were also needed (e.g. an always-available AI opponent, or a deep analysis service), the Rust crate compiles natively without source changes — it could be called from Node via `child_process` or a NAPI addon.\n\n### AI algorithm\n\nIterative-deepening negamax with alpha-beta pruning. Starts at depth 1 and deepens until the time budget (default 1.5 s) expires, always returning the best move from the last completed depth. Move ordering (shallow apply + eval at each node) improves cut-off rates significantly.\n\n## Deployment\n\n- **Frontend + Wasm** → Vercel (pointed at `packages/frontend`). No server required.\n\n## Getting started\n\n```bash\n# Install dependencies\nnpm install\n\n# Build all packages (compiles Rust → Wasm, then TypeScript)\nnpm run build\n\n# Start all dev watchers\nnpm run dev\n```\n\nRequires Node 20+, npm 10+, and a Rust toolchain with `wasm-pack`:\n\n```bash\ncargo install wasm-pack\n```\n\n## Game rules\n\nTak is a two-player abstract strategy game. Each player tries to build a **road** — a connected path of their pieces linking opposite edges of the board.\n\n**Pieces:**\n\n- **Flat stone** — the basic piece; counts toward roads and the flat-stone tiebreaker\n- **Standing stone (wall)** — blocks movement and roads; cannot be part of a road\n- **Capstone** — counts toward roads; can flatten walls by moving onto them\n\n**Turn structure:**\n\n- **Turns 1 \u0026 2 (swap):** each player places one of the _opponent's_ flat stones\n- **Turn 3 onwards:** place a piece from your hand onto an empty square, or pick up a stack and slide it in a straight line\n\n**Win conditions:**\n\n1. **Road win** — connect two opposite edges with a continuous path of flats and/or capstones\n2. **Flat win** — when the board fills or a player runs out of pieces, the player with the most flat stones on top of stacks wins\n3. **Draw** — if flat counts are equal at game end, the game is a draw\n\nSee the [official rulebook](https://cheapass.com/tak/) for full details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffildon%2Ftak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffildon%2Ftak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffildon%2Ftak/lists"}