{"id":15759230,"url":"https://github.com/nwtgck/othello-scala","last_synced_at":"2025-03-31T09:10:00.584Z","repository":{"id":87735822,"uuid":"154247593","full_name":"nwtgck/othello-scala","owner":"nwtgck","description":"Type-safe Othello written in Scala","archived":false,"fork":false,"pushed_at":"2018-10-26T04:31:06.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-02-06T13:30:31.125Z","etag":null,"topics":["game","othello","reversi","type-safety"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nwtgck.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":"2018-10-23T02:16:04.000Z","updated_at":"2018-10-26T04:31:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"5aa7d9d5-564b-4af7-a5a9-35620c6c282a","html_url":"https://github.com/nwtgck/othello-scala","commit_stats":{"total_commits":39,"total_committers":1,"mean_commits":39.0,"dds":0.0,"last_synced_commit":"009443e142cb0908f8d97d55648b34619a4f4526"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Fothello-scala","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Fothello-scala/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Fothello-scala/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Fothello-scala/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nwtgck","download_url":"https://codeload.github.com/nwtgck/othello-scala/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246443536,"owners_count":20778249,"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":["game","othello","reversi","type-safety"],"created_at":"2024-10-04T10:04:19.070Z","updated_at":"2025-03-31T09:10:00.558Z","avatar_url":"https://github.com/nwtgck.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# othello\nType-safe Othello written in Scala\n\n## Play\n\n```bash\nsbt \"runMain io.github.nwtgck.othello.Main\"\n```\n\n(In the future, this may be changed.)\n\n## AI\n\nThis game has three types of AI for now.\n\n* `RandomPlayer` - moves randomly\n* `MonteCarloPlayer` - moves by  Monte Carlo method\n* `UguisuEvaluationTablePlayer` - moves by a evalutation table found in \u003chttp://uguisu.skr.jp/othello/5-1.html\u003e\n* `MinimaxPlayer` - moves by minimax method with alpha-beta pruning\n\n## Type-safety\n\nFor example, `Disk` and `Cell` are not the same. `Disk` is a subset of `Cell`, mathematically, `Disk ⊂ Cell`.\nBecause of this definition, `Player` has `Disk`, not `Cell` since `Player` should not have `Empty`, which is a state of a cell.\n\n```scala\n/**\n  * Cell\n  */\nsealed trait Cell\n\n/**\n  * Disk (Disk is a subset of Cell)\n  */\nsealed trait Disk extends Cell{\n...\n}\ncase object Black extends Disk\ncase object White extends Disk\ncase object Empty extends Cell\n```\n\nIf union types are available like [TypeScript], the type definition will be more clear like the following.\nThis project will be written in [Dotty] when [Dotty] get more stable.\n\n[TypeScript]: https://www.typescriptlang.org/\n[Dotty]: http://dotty.epfl.ch/\n\n```ts\n// NOTE: TypeScript\ntype Cell = \"Black\" | \"White\" | \"Empty\"\ntype Disk = \"Black\" | \"White\"\n```\n\n\nFor another example, the parameters of `Game` class ensure to have valid players like the following.\n\n```scala\nclass Game(player1: Player[Black.type], player2: Player[White.type]) {\n ...\n}\n```\n\n(The `player1`'s disk is always `Black` and the `player2`'s disk is always white.)\n\nDefinition of `Player` abstract class is like the following.\n```scala\nabstract class Player[+D \u003c: Disk] (val disk: D) {\n  ...\n}\n```\n\n## Game Tree\n\nGame tree is represented as **lazy** tree. So you can get **entire game tree** by the following.\n\n```scala\n// The entire game tree of Othello!\nGameTree.create(GamePosition(\n  board = Board.initial,\n  disk  = Black,\n  previousMoveOpt = None\n))\n```\n\nHere is a visualization of the game tree where depth limit = 3.\n\n![Othello Game Tree Visualization](demo_images/game-tree-depth-limit3.svg)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnwtgck%2Fothello-scala","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnwtgck%2Fothello-scala","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnwtgck%2Fothello-scala/lists"}