{"id":23136314,"url":"https://github.com/lastres/tictactoe","last_synced_at":"2025-07-11T05:42:01.270Z","repository":{"id":67928017,"uuid":"93876573","full_name":"lastres/tictactoe","owner":"lastres","description":"Erlang Tic Tac Toe minimax AI algorithm implementation","archived":false,"fork":false,"pushed_at":"2017-06-28T16:08:05.000Z","size":781,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T19:50:20.867Z","etag":null,"topics":["ai","beam","erlang","minimax-algorithm","tic-tac-toe","tictactoe-game"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lastres.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}},"created_at":"2017-06-09T16:16:49.000Z","updated_at":"2021-01-24T09:55:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"ed3adc6d-2cc4-46eb-abb5-d91ea42a4534","html_url":"https://github.com/lastres/tictactoe","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lastres%2Ftictactoe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lastres%2Ftictactoe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lastres%2Ftictactoe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lastres%2Ftictactoe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lastres","download_url":"https://codeload.github.com/lastres/tictactoe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149510,"owners_count":20891954,"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":["ai","beam","erlang","minimax-algorithm","tic-tac-toe","tictactoe-game"],"created_at":"2024-12-17T12:20:14.434Z","updated_at":"2025-04-04T09:13:51.607Z","avatar_url":"https://github.com/lastres.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"Tic Tac Toe [![Build Status](https://travis-ci.org/lastres/tictactoe.svg?branch=master)](https://travis-ci.org/lastres/tictactoe)\n========\n\nThis is an implementation of a Tic Tac Toe minimax AI algorithm in Erlang.\n\nIt provides a game board representation and a way to fetch optimal moves from different game positions\n\nIt is based on the Minimax algorithm described here: https://mostafa-samir.github.io/Tic-Tac-Toe-AI/\n\nIt also provides a game server that allows handling of the game status in memory.\n\nDependencies\n-\nIt is expected to have Erlang/OTP installed and available in the $PATH. (version 17.4 +).\nThe easiest way to install Erlang/OTP is probably using Kerl: http://github.com/kerl/kerl\n\nHow to build and run\n-\nWith:\n```\n$./rebar3 release\n```\nwill compile the code and build a release. In order to start a release and an Erlang shell attached to it:\n\n```\n$ ./_build/default/rel/tictactoe/bin/tictactoe\n```\n\nUsage\n-\nThe main function is `tictactoe:take_a_master_move/2`. It takes a board state, which is a 9 element list, and a player to play next. As an example:\n\n```erlang\n1\u003e tictactoe:take_a_master_move(['E','E','O','O','E','E','E','X','X'], 'X').\n{5,['E','E','O','O','E','E','X','X','X']}\n```\n\nDetail API documentation is provided on `tictactoe.erl` module.\n\nThe game server holds the game status and can be accessed using its own API (tictactoe_server.erl).\n\n```erlang\n1\u003e tictactoe_server:game_status().\n{ok,running}\n\n2\u003e tictactoe_server:get_board_state().\n{ok,['E','E','E','E','E','E','E','E','E']}\n\n3\u003e tictactoe_server:make_move(['E','E','E','E','E','X','E','E','E']).\n{ok,['E','E','E','E','E','X','E','E','O']}\n```\nThe server plays as player `'O'` and the user plays as player `'X'`. The server will make the next move automatically after the user calls the `make_move/1` function to perform a move.\n\nRunning Dialyzer\n-\nThe following command will run Dialyzer type checker:\n\n```\n$ ./rebar3 dialyzer\n```\n\nRunning Eunit tests\n-\nSome simple Eunit tests that provide a good level of coverage are provided.\n\nFor running the Eunit tests:\n\n```\n$ ./rebar3 eunit\n```\n\nGenerating coverage report\n-\nAfter running Eunit tests, the following command will generate an HTML coverage report:\n\n```\n$ ./rebar3 cover\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flastres%2Ftictactoe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flastres%2Ftictactoe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flastres%2Ftictactoe/lists"}