{"id":19557816,"url":"https://github.com/jbangdev/jbang-battlesnake","last_synced_at":"2025-08-08T20:22:11.433Z","repository":{"id":44777888,"uuid":"449090789","full_name":"jbangdev/jbang-battlesnake","owner":"jbangdev","description":"Battlesnake starter using Java 17 with JBang, running Quarkus and works with repl.it and heroku","archived":false,"fork":false,"pushed_at":"2022-01-25T12:46:34.000Z","size":14,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-25T20:43:49.900Z","etag":null,"topics":["battlesnake","java","jbang","quarkus"],"latest_commit_sha":null,"homepage":"","language":"Java","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/jbangdev.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":"2022-01-18T00:35:12.000Z","updated_at":"2023-06-20T14:14:00.000Z","dependencies_parsed_at":"2022-09-03T05:03:09.727Z","dependency_job_id":null,"html_url":"https://github.com/jbangdev/jbang-battlesnake","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jbangdev/jbang-battlesnake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-battlesnake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-battlesnake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-battlesnake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-battlesnake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbangdev","download_url":"https://codeload.github.com/jbangdev/jbang-battlesnake/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-battlesnake/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267798625,"owners_count":24145727,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","java","jbang","quarkus"],"created_at":"2024-11-11T04:44:06.033Z","updated_at":"2025-08-08T20:22:11.408Z","avatar_url":"https://github.com/jbangdev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A simple [Battlesnake](http://play.battlesnake.com) written in Java using JBang and Quarkus.\n\nThis is a basic implementation of the [Battlesnake API](https://docs.battlesnake.com/snake-api). It's a great starting point for anyone wanting to program their first Battlesnake using Java. It comes ready to use with [Replit.com](https://replit.com) and provides instructions below for getting started. It can also be deployed to [Heroku](https://heroku.com), or any other cloud provider you'd like.\n\n### Technologies\n\n* [Java 17](https://adoptium.net/)\n* [JBang](https://jbang.dev/downloads)\n* [Quarkus](https://quarkus.io)\n* [Heroku](https://www.heroku.com/) (optional)\n\n## Quickstart\n\nThe [Quick Start Coding Guide](https://docs.battlesnake.com/guides/getting-started) provides the full set of instructions to customize, register, and create your first games with your Battlesnake! While the guide uses [Repl.it](https://repl.it) as an example host, the instructions can be modified to work with any hosting provider. You can also find advice on other hosting providers on our [Hosting Suggestions](https://docs.battlesnake.com/references/hosting-suggestions) page.\n\n### Prerequisites\n\n* A free [Battlesnake Account](https://play.battlesnake.com/?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=python_starter\u0026utm_content=homepage)\n\n---\n\n## Running Your Battlesnake on [replit.com](https://replit.com)\n\n[![Run on Replit.com](https://replit.com/badge/github/jbangdev/jbang-battlesnake)](https://replit.com/github/jbangdev/jbang-battlesnake)\n\n1. Login to your [Replit.com](https://replit.com) account.\n\n2. Click the 'Run on replit.com' button above, or visit the following URL: https://replit.com/github/jbangdev/jbang-battlesnake.\n\n3. You should see your Repl being initialized - this might take a few moments to complete.\n\n4. Once your Repl is ready to run, click `Run ▶️` at the top of the screen. You should see jbang (and any other dependencies) being installed. Once installation is complete, your Battlesnake server will start and you should see the following:\n\n    ```\n    [Thread-0] INFO org.eclipse.jetty.server.Server - Started @ms\n    ```\n\n5. Above the terminal window you'll see the live output from your Battlesnake server, including its URL. That URL will be the URL used to create your Battlesnake in the next step. If you visit that URL in your browser, you should see text similar to this:\n\n    ```\n    {\"apiversion\": \"1\", \"author\": \"\", \"color\": \"#888888\", \"head\": \"default\", \"tail\": \"default\"}\n    ```\n\nThis means your Battlesnake is running correctly on Replit.com.\n\n**At this point your Battlesnake is live and ready to enter games!**\n\n\n\n## Customizing Your Battlesnake\n\nLocate the `index` method inside [snake.java](snake.java#L44). You should see code that looks like this:\n```java\nreturn new Info(\"1\",\n                \"\",\n                \"#888888\",\n                \"default\",\n                \"default\");\n```\n\nThis function is called by the game engine periodically to make sure your Battlesnake is healthy, responding correctly, and to determine how your Battlesnake will appear on the game board. See [Battlesnake Personalization](https://docs.battlesnake.com/references/personalization) for how to customize your Battlesnake's appearance using these values.\n\nWhenever you update these values, you can refresh your Battlesnake on [your profile page](https://play.battlesnake.com/me/) to use your latest configuration. Your changes should be reflected in the UI, as well as any new games created.\n\n## Changing Behavior\n\nOn every turn of each game your Battlesnake receives information about the game board and must decide its next move.\n\nLocate the `move` method inside [Snake.java](snake.java#L79).\n\nPossible moves are \"up\", \"down\", \"left\", or \"right\". To start your Battlesnake will choose a move randomly. Your goal as a developer is to read information sent to you about the board (available in the `moveRequest` variable) and make an intelligent decision about where your Battlesnake should move next. \n\nSee the [Battlesnake Rules](https://docs.battlesnake.com/rules) for more information on playing the game, moving around the board, and improving your algorithm.\n\n## (Optional) Running Your Battlesnake Locally\n\nEventually you might want to run your Battlesnake server locally for faster testing and debugging. You can do this by installing [JBang](https://jbang.dev/downloads), then running:\n\n```shell\njbang snake.java\n```\n\nThis will start the Battlesnake server on port 8080.\n\n\n**Note:** You cannot create games on [play.battlesnake.com](https://play.battlesnake.com) using a locally running Battlesnake unless you install and use a port forwarding tool like [ngrok](https://ngrok.com/).\n\n---\n\n\n## Playing Battlesnake\n\n### Completing Challenges\n\nIf you're looking for the Single Player Mode of Battlesnake, or something to practice with between events, check out [Challenges.](https://docs.battlesnake.com/guides/quick-start-challenges-guide)\n\n### Joining a Battlesnake Arena\n\nOnce you've made your Battlesnake behave and survive on its own, you can enter it into the [Global Battlesnake Arena](https://play.battlesnake.com/arena/global) to see how it performs against other Battlesnakes worldwide.\n\nArenas will regularly create new games and rank Battlesnakes based on their results. They're a good way to get regular feedback on how well your Battlesnake is performing, and a fun way to track your progress as you develop your algorithm.\n\n### Joining a Battlesnake League\n\nWant to get out there to compete and win prizes? Check out the [Quick Start League Guide](https://docs.battlesnake.com/guides/quick-start-league-guide) for information on the how and when of our competitive seasons.\n \n---\n\n## (Optional) Deploying Your First Battlesnake with Heroku\n\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)\n\n1. [Fork this repo](https://github.com/BattlesnakeOfficial/starter-snake-java/fork) into your GitHub Account.\n\n2. [Clone your forked repo](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository) into your local environment.\n    ```shell\n    git clone git@github.com:[YOUR-GITHUB-USERNAME]/starter-snake-java.git\n    ```\n\n3. [Create a new Heroku app](https://devcenter.heroku.com/articles/creating-apps) to run your Battlesnake.\n    ```shell\n    heroku create [YOUR-APP-NAME]\n    ```\n\n4. [Deploy your Battlesnake code to Heroku](https://devcenter.heroku.com/articles/git#deploying-code).\n    ```shell\n    git push heroku master\n    ```\n\n5. Open your new Heroku app in your browser.\n    ```shell\n    heroku open\n    ```\n    If everything was successful, you should see the following text:\n    ```\n    {\"tailType\":\"default\",\"color\":\"#888888\",\"headType\":\"default\",\"author\":\"\",\"apiversion\":\"1\"}\n    ```\n\n6. Optionally, you can view your server logs using the [Heroku logs command](https://devcenter.heroku.com/articles/logging#log-retrieval) `heroku logs --tail`. The `--tail` option will show a live feed of your logs in real-time.\n\n**At this point your Battlesnake is live and ready to enter games!**\n\n### (Optional) Updating Your Battlesnake with Heroku\n\nAfter making changes, commit them using git and deploy your changes to Heroku.\n```shell\ngit add .\ngit commit -m \"update my battlesnake's appearance\"\ngit push heroku master\n```\n\nOnce Heroku has updated you can [create a new game](https://play.battlesnake.com/account/games/create/) with your Battlesnake to view your latest changes in action.\n\n**At this point you should feel comfortable making changes to your code and deploying those changes to Heroku!**\n## Resources\n\nAll documentation is available at [docs.battlesnake.com](https://docs.battlesnake.com), including detailed Guides, API References, and Tips.\n\nYou can also join the Battlesnake Developer Community on [Discord](https://play.battlesnake.com/discord?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=python_starter\u0026utm_content=discord). We have a growing community of Battlesnake developers of all skill levels wanting to help everyone succeed and have fun with Battlesnake :)\n\nCheck out live Battlesnake events on [Twitch](https://www.twitch.tv/battlesnakeofficial) and see what is happening when on the [Calendar.](https://play.battlesnake.com/calendar?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=python_starter\u0026utm_content=calendar)\n\nWant to contribute to Battlesnake? We have a number of open-source codebases and would love for you to get involved! Check out our page on [Contributing.](https://docs.battlesnake.com/guides/contributing)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbangdev%2Fjbang-battlesnake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbangdev%2Fjbang-battlesnake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbangdev%2Fjbang-battlesnake/lists"}