{"id":13722436,"url":"https://github.com/stevegrossi/sengoku","last_synced_at":"2025-05-07T08:13:55.950Z","repository":{"id":24774561,"uuid":"102414376","full_name":"stevegrossi/sengoku","owner":"stevegrossi","description":"An online Risk-like game built with Elixir and Phoenix LiveView","archived":false,"fork":false,"pushed_at":"2023-01-06T06:44:38.000Z","size":14349,"stargazers_count":61,"open_issues_count":33,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-07T08:13:41.648Z","etag":null,"topics":["elixir","game","phoenix-liveview"],"latest_commit_sha":null,"homepage":"https://www.playsengoku.com/","language":"Elixir","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/stevegrossi.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}},"created_at":"2017-09-05T00:28:39.000Z","updated_at":"2024-12-28T09:39:44.000Z","dependencies_parsed_at":"2023-01-14T08:00:15.076Z","dependency_job_id":null,"html_url":"https://github.com/stevegrossi/sengoku","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/stevegrossi%2Fsengoku","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevegrossi%2Fsengoku/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevegrossi%2Fsengoku/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevegrossi%2Fsengoku/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stevegrossi","download_url":"https://codeload.github.com/stevegrossi/sengoku/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252839296,"owners_count":21812090,"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":["elixir","game","phoenix-liveview"],"created_at":"2024-08-03T01:01:28.722Z","updated_at":"2025-05-07T08:13:55.922Z","avatar_url":"https://github.com/stevegrossi.png","language":"Elixir","funding_links":[],"categories":["Elixir"],"sub_categories":["Phoenix"],"readme":"# Sengoku\n\nUnite feudal Japan in this Risk-like strategy game! (This is extremely alpha and in active development.)\n\n![a screenshot of the game map](https://github.com/stevegrossi/sengoku/raw/master/screenshot.png)\n\n## Gameplay\n\nUp to 8 players: play against friends online, the computer, or both.\n\n- Provinces are randomly divided amongst all players at the start of the game.\n- Each player receives one unit for every 3 provinces they hold (with a minimum of 3) at the start of each turn.\n- Receive bonus units for holding all provinces within a marked region.\n- On your turn you may attack neighboring provinces (see below).\n- At the end of your turn, you may move units from one of your provinces to one of its neighbors you control.\n- A player is defeated when they no longer control any provinces.\n- A player wins when all other players are defeated.\n\n### Rules for Battle\n\n- Up to 3 units will attack at once, and up to 2 units will defend. A six-sided die is rolled for each.\n- Rolls are sorted from highest to lowest and paired off: e.g. the highest attacker roll with the highest defender roll. Defending units win ties. The losing unit is removed from play.\n- If all defending units are removed, the attacker takes control of that province and their number of attacking units moves in.\n\n## Development\n\nTo start your Phoenix server:\n\n  * Setup the project with `mix setup`\n  * Start Phoenix endpoint with `mix phx.server`\n\nNow you can visit [`localhost:4000`](http://localhost:4000) from your browser to play!\n\n### AI Development\n\nWant to improve the AI? Great! Computer players implement the `Sengoku.AI` behaviour. The current AI is the `Sengoku.AI.Smart` module.\n\n1. Copy the current AI module and its tests. From the command line:\n\n    ```\n    cp lib/sengoku/ai/smart.ex lib/sengoku/ai/smarter.ex\n    cp test/sengoku/ai/smart_test.exs test/sengoku/ai/smarter_test.exs\n    ```\n\n2. I’d like to automate this, but with `lib/sengoku/ai/smarter.ex` manually rename `Sengoku.AI.Smart` to `Sengoku.AI.Smarter`, and within `test/sengoku/ai/smarter_test.exs` rename `Sengoku.AI.SmartTest` to `Sengoku.AI.SmarterTest`.\n3. Run `mix test` to ensure everything’s working.\n4. Run `mix ai.arena Sengoku.AI.Smarter` with your new AI module:\n\n    ```\n    Starting 2000 games with Sengoku.AI.Smarter as Player 1\n    against Sengoku.AI.Smart as all other players\n\n     Player                         | Win %\n    --------------------------------|-------\n     1 (Sengoku.AI.Smarter)         |  11.9%\n     2 (Sengoku.AI.Smart)           |  11.8%\n     3 (Sengoku.AI.Smart)           |  13.6%\n     4 (Sengoku.AI.Smart)           |  13.7%\n     5 (Sengoku.AI.Smart)           |  12.4%\n     6 (Sengoku.AI.Smart)           |  12.3%\n     7 (Sengoku.AI.Smart)           |  11.5%\n     8 (Sengoku.AI.Smart)           |  12.8%\n    ```\n\n    (With `mix ai.arena`, at least on the default `\"westeros\"` map, win percentages should be even within a few percentage points.)\n\n5. Now change how `Sengoku.AI.Smarter` works! Continue running `mix ai.arena Sengoku.AI.Smarter` to test the impact of your changes against the default AI.\n6. When you’ve made an improvement, merge your changes back into `Sengoku.AI.Smart` and consider opening a Pull Request with the improvements!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevegrossi%2Fsengoku","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevegrossi%2Fsengoku","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevegrossi%2Fsengoku/lists"}