{"id":25651197,"url":"https://github.com/dwayne/gleam-xo","last_synced_at":"2026-01-31T23:41:37.434Z","repository":{"id":278286247,"uuid":"929119086","full_name":"dwayne/gleam-xo","owner":"dwayne","description":"The essentials of Tic-tac-toe extracted into a Gleam library.","archived":false,"fork":false,"pushed_at":"2025-02-19T00:47:35.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-10T23:41:32.910Z","etag":null,"topics":["gleam-lang","tic-tac-toe"],"latest_commit_sha":null,"homepage":"","language":"Gleam","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dwayne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-02-07T20:58:11.000Z","updated_at":"2025-02-19T19:12:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"b46384a7-03ff-471b-830b-f5df55adde55","html_url":"https://github.com/dwayne/gleam-xo","commit_stats":null,"previous_names":["dwayne/gleam-xo"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dwayne/gleam-xo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwayne%2Fgleam-xo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwayne%2Fgleam-xo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwayne%2Fgleam-xo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwayne%2Fgleam-xo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dwayne","download_url":"https://codeload.github.com/dwayne/gleam-xo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwayne%2Fgleam-xo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28960690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T23:03:11.038Z","status":"ssl_error","status_checked_at":"2026-01-31T22:56:44.691Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["gleam-lang","tic-tac-toe"],"created_at":"2025-02-23T16:42:25.547Z","updated_at":"2026-01-31T23:41:37.428Z","avatar_url":"https://github.com/dwayne.png","language":"Gleam","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xo\n\n[![Package Version](https://img.shields.io/hexpm/v/xo)](https://hex.pm/packages/xo)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/xo/)\n\nA [Tic-tac-toe](https://en.wikipedia.org/wiki/Tic-tac-toe) library for Gleam.\n\n## An example\n\n```gleam\nimport gleam/io\nimport gleam/string\nimport xo.{X}\n\npub fn main() {\n  let game0 = xo.start(X)\n  let assert Ok(game1) = xo.play(game0, #(1, 1)) // X\n  let assert Ok(game2) = xo.play(game1, #(0, 0)) // O\n\n  let assert Error(xo.OutOfBounds(#(3, 3))) = xo.play(game2, #(3, 3))\n  let assert Error(xo.Occupied(#(1, 1))) = xo.play(game2, #(1, 1))\n\n  let assert Ok(game3) = xo.play(game2, #(2, 2)) // X\n  let assert Ok(game4) = xo.play(game3, #(2, 1)) // O\n\n  io.println(xo.to_string(game4))\n  // =\u003e o...x..ox\n\n  // Where should I play?\n  let moves = xo.get_smart_moves(game4)\n\n  io.println(string.inspect(moves))\n  // =\u003e [#(0, 2), #(1, 2)]\n\n  let assert Ok(game5) = xo.play(game4, #(1, 2)) // X\n\n  // It doesn't matter where you play now,\n  // you're going to lose\n  let assert Ok(game6) = xo.play(game5, #(0, 2)) // O\n\n  // Make the winning play\n  let assert Ok(game7) = xo.play(game6, #(1, 0)) // X\n\n  io.println(string.inspect(xo.to_state(game7)))\n  // =\u003e State(X, X, Win(X, [#(#(1, 0), #(1, 1), #(1, 2))]))\n  //          ^  ^  ^\n  //          |  |  |__ outcome\n  //          |  |_____ turn\n  //          |________ first\n}\n```\n\n## The public API at a glance\n\n```txt\nPlayer, next_turn\n\nGame, start\n\nPosition, PlayError, play\n\nRules, default_rules, play_again\n\nState, Outcome, Line, to_state\n\nTile, map\n\nto_string\n\nget_random_move, get_smart_moves\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwayne%2Fgleam-xo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdwayne%2Fgleam-xo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwayne%2Fgleam-xo/lists"}