{"id":15921828,"url":"https://github.com/devforfu/tictactoe","last_synced_at":"2025-07-16T08:08:23.067Z","repository":{"id":75401537,"uuid":"569445311","full_name":"devforfu/tictactoe","owner":"devforfu","description":"Learning Rust via building games","archived":false,"fork":false,"pushed_at":"2022-11-26T17:57:18.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T12:23:43.458Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/devforfu.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}},"created_at":"2022-11-22T21:02:56.000Z","updated_at":"2022-11-26T17:59:07.000Z","dependencies_parsed_at":"2023-06-06T09:45:27.796Z","dependency_job_id":null,"html_url":"https://github.com/devforfu/tictactoe","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devforfu/tictactoe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devforfu%2Ftictactoe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devforfu%2Ftictactoe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devforfu%2Ftictactoe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devforfu%2Ftictactoe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devforfu","download_url":"https://codeload.github.com/devforfu/tictactoe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devforfu%2Ftictactoe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265495358,"owners_count":23776616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-10-06T20:02:23.502Z","updated_at":"2025-07-16T08:08:23.012Z","avatar_url":"https://github.com/devforfu.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Tic-tac-toe (CLI)\n=================\n\nLearning Rust via implementing simple games.\n\nDescription\n-----------\nThe goal of building this project was to summarize knowledge acquired from reading Rust books and documentation \nby implementing a simple, though not completely trivial, exercise. \n\nThe implementation was done with code completion disabled, using compiler hints and Rust docs (mostly.) \nEach of the language features used here was added only in case when it helped to improve code quality, like \ndecoupling user's input from game state. Therefore, it was a nice learning experiment helping to find a \n\"method to Rust's madness\", and its not-so-obvious for a non-Rust developer aspects like `dyn` keyword, \nlifetimes, and borrow checker rules.\n\nFinally, it is coded by a hobbist learning Rust in spare time. So, I believe that the implementation provided here\nmight not follow best Rust's coding practicies, or doesn't use all of it's features that might have helped to\nmake the implementation easier/better/cleaner.\n\nImprovements are welcome!\n\nFeatures\n--------\n1. Provides a basic CLI interface that reads turns from `stdin` and prints game's state to the terminal.\n2. Implements traits like `BufRead` and `Iterator`.\n3. Creates custom traits to make easily-configurable I/O devices.\n4. Testable code that can be executed both interactively (keyboard input) and programmatically (via encoded\nsequence of turns.)\n\nRunning the code\n----------------\n```bash\ngit clone https://github.com/devforfu/tictactoe\ncd tictactoe\ncargo run\n```\n\nExample\n-------\n```\nWelcome to the Tic-Tac-Toe game!\nCommands:\n(1) put mark at x row and y column: x,y\n(2) stop the game: [s]top (or Ctrl-C)\n\n+---+\n|...|\n|...|\n|...|\n+---+\n\n1,1\n+---+\n|...|\n|.x.|\n|...|\n+---+\n\n0,1\n+---+\n|.o.|\n|.x.|\n|...|\n+---+\n\n1,1\nImpossible turn [1, 1]: cell is not empty; try again!\n2,2\n+---+\n|.o.|\n|.x.|\n|..x|\n+---+\n\n0,2\n+---+\n|.oo|\n|.x.|\n|..x|\n+---+\n\n0,0\n+---+\n|xoo|\n|.x.|\n|..x|\n+---+\n\nThe game is over: the player X wins!\nThe final board's state:\n+---+\n|xoo|\n|.x.|\n|..x|\n+---+\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevforfu%2Ftictactoe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevforfu%2Ftictactoe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevforfu%2Ftictactoe/lists"}