{"id":13693183,"url":"https://github.com/xtagon/snek","last_synced_at":"2026-02-18T21:02:31.595Z","repository":{"id":57549992,"uuid":"287781846","full_name":"xtagon/snek","owner":"xtagon","description":"Battlesnake-compatible rulesets and board positions in Elixir.","archived":false,"fork":false,"pushed_at":"2021-09-18T18:17:48.000Z","size":172,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"edge","last_synced_at":"2025-10-21T15:36:50.074Z","etag":null,"topics":["battlesnake","battlesnake-community","battlesnakeio","elixir","elixir-lang","elixir-library"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/xtagon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-15T16:17:00.000Z","updated_at":"2021-09-18T18:17:51.000Z","dependencies_parsed_at":"2022-09-10T08:12:03.195Z","dependency_job_id":null,"html_url":"https://github.com/xtagon/snek","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/xtagon/snek","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtagon%2Fsnek","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtagon%2Fsnek/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtagon%2Fsnek/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtagon%2Fsnek/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xtagon","download_url":"https://codeload.github.com/xtagon/snek/tar.gz/refs/heads/edge","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtagon%2Fsnek/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29596125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T20:59:56.587Z","status":"ssl_error","status_checked_at":"2026-02-18T20:58:41.434Z","response_time":162,"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":["battlesnake","battlesnake-community","battlesnakeio","elixir","elixir-lang","elixir-library"],"created_at":"2024-08-02T17:01:06.611Z","updated_at":"2026-02-18T21:02:31.565Z","avatar_url":"https://github.com/xtagon.png","language":"Elixir","funding_links":[],"categories":["Game Rules and Logic"],"sub_categories":[],"readme":"# Snek\n\nA framework for defining Battlesnake-compatible rulesets and board positions in\nElixir.\n\n[Battlesnake][battlesnake] is an online competitive take on the classic game of\nSnake. `Snek` provides some structure and tooling that developers can use\ntoward creating Battlesnake AIs in Elixir.\n\nThis project is not affiliated with or sponsored by Battlesnake.\n\n## Status\n\nThis is an early work in progress, and should be considered experimental,\nincomplete, and unstable until v1.0.0, following [Semantic Versioning][semver].\n\nAll notable changes will be recorded in the [changelog](CHANGELOG.md).\n\n## Installation\n\nAdd `snek` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:snek, \"~\u003e 0.4.0\"}\n  ]\nend\n```\n\n## Documentation\n\nDocumentation can be found [here at Hex.pm][hexdocs] or generated from the\nsource code using `mix docs`.\n\n## Examples\n\nThe following example simulates a couple of game turns using the Standard\nruleset, for a two-player game, on a standard medium (11x11) board size.\n\n```elixir\nalias Snek.Ruleset.Standard\nalias Snek.Board\n\n# Two-player game\nsnake_ids = MapSet.new([\"snek1\", \"snek2\"])\n\n# Initialize the game\n{:ok, turn0} = Standard.init(Board.Size.medium, snake_ids)\n\n# The ruleset emits `Snek.Board` states that you can analyze in various ways:\nBoard.empty?(turn0) # =\u003e false\nBoard.alive_snakes_remaining(turn0) # =\u003e 2\n\n# Apply moves for two turns\nturn1 = Standard.next(turn0, %{\"snek1\" =\u003e :left, \"snek2\" =\u003e :up})\nturn2 = Standard.next(turn1, %{\"snek1\" =\u003e :down, \"snek2\" =\u003e :right})\n\n# Is the game over? (See if you can figure out *why* the game isn't over!)\nStandard.done?(turn2) # =\u003e false\n```\n\nAll rulesets implement the same callbacks, so you can perform dynamic dispatch.\nIn the following example, the `ruleset` variable could be set to any ruleset\nmodule name:\n\n```elixir\nruleset = Snek.Ruleset.Solo\n\n{:ok, turn0} = ruleset.init(Board.Size.medium, snake_ids)\n```\n\n## Open Invite\n\nIf you have any questions, or just wish to geek out and chat about Battlesnake\nor Elixir or programming in general, feel free to reach out! I love talking\nwith people and sharing tips and tricks.\n\nYou can reach me at [xtagon@gmail.com](mailto:xtagon@gmail.com), or catch me in\n[Battlesnake Discord][battlesnake-discord] (username: `@xtagon`).\n\n## Development\n\nThe following Mix tasks are available to assist in development:\n\n- `mix docs`\n- `mix test`\n- `mix coveralls`\n- `mix credo --strict`\n- `mix bench`\n- `mix profile`\n\n## License\n\nThis project is released under the terms of the [MIT License](LICENSE.txt).\n\n[battlesnake]: https://play.battlesnake.com/\n[battlesnake-discord]: https://play.battlesnake.com/discord/\n[semver]: https://semver.org/\n[hexdocs]: https://hexdocs.pm/snek/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtagon%2Fsnek","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxtagon%2Fsnek","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtagon%2Fsnek/lists"}