A basic implementation of the Battlesnake API in Python

Overview

Getting started with Battlesnake and Python

Battlesnake Logo

This is a basic implementation of the Battlesnake API in Python. It's a great starting point for anyone wanting to program their first Battlesnake using Python, and comes ready to deploy with Replit and Heroku, or you can use any other cloud provider you'd like.

Technologies Used

Quickstart

The Quick Start Coding Guide provides the full set of instructions to customize, register, and create your first games with your Battlesnake! While the guide uses 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 page.

Prerequisites


Customizing Your Battlesnake

Locate the handle_info function inside server.py. At the end of that function you should see a line that looks like this:

return {
    "apiversion": "1",
    "author": "",
    "color": "#888888",
    "head": "default",
    "tail": "default",
}

This 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 for how to customize your Battlesnake's appearance using these values.

Whenever you update these values, go to the page for your Battlesnake and select 'Refresh Metadata' from the option menu. This will update your Battlesnake to use your latest configuration and those changes should be reflected in the UI as well as any new games created.

Changing Behavior

On every turn of each game your Battlesnake receives information about the game board and must decide its next move.

Locate the handle_move function inside server.py. Possible 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 data variable) and decide where your Battlesnake should move next. Your Battlesnakes move logic lives in server_logic.py. This is the code you will want to edit.

See the Battlesnake Game Rules for more information on playing the game, moving around the board, and improving your algorithm.

(Optional) Running Your Battlesnake Locally

Eventually you might want to run your Battlesnake server locally for faster testing and debugging. You can do this by installing Python 3.8 and running:

python server.py

Note: You cannot create games on play.battlesnake.com using a locally running Battlesnake unless you install and use a port forwarding tool like ngrok. See Hosting Suggestions.

Running Tests

This Starter Project comes with a very simple test suite for you to expand! Located in tests.py you can run them using the following command: python tests.py -v


Playing Battlesnake

Completing Challenges

If you're looking for the Single Player Mode of Battlesnake, or something to practice with between events, check out Challenges.

Joining a Battlesnake Arena

Once you've made your Battlesnake behave and survive on its own, you can enter it into the Global Battlesnake Arena to see how it performs against other Battlesnakes worldwide.

Arenas 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.

Joining a Battlesnake League

Want to get out there to compete and win prizes? Check out the Quick Start League Guide for information on the how and when of our competitive seasons.


Resources

All documentation is available at docs.battlesnake.com, including detailed Guides, API References, and Tips.

You can also join the Battlesnake Developer Community on Discord. We have a growing community of Battlesnake developers of all skill levels wanting to help everyone succeed and have fun with Battlesnake :)

Check out live Battlesnake events on Twitch and see what is happening when on the Calendar.

Want 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.

Feedback

Do you have an issue or suggestions for this repository? Head over to our Feedback Repository today and let us know!

Owner
Gaurav Batra
Hi, I am a final year computer science undergraduate at IIIT, Hyderabad where I am pursuing my research at the Machine Learning Lab.
Gaurav Batra
um simples script para localizar IP

um simples script para localizar IP pkg install git (apt-get install git) pkg install python (apt-get install python) git clone https://github.com/byd

bydeathlxncer 4 Nov 29, 2021
QR login for pyrogram client

Generate Pyrogram session via QRlogin

ใƒใ‚ญ 18 Oct 21, 2022
Video Stream is a telegram bot project that's allow you to play video on telegram group video chat

Video Stream is a telegram bot project that's allow you to play video on telegram group video chat ๐Ÿš€ Get SESSION_NAME from below: Pyrogram ## โœจ Featu

1 Nov 10, 2021
PunkScape Discord bot to lookup rarities, create diptychs and more.

PunkScape Discord Bot A Discord bot created for the Discord server of PunkScapes, a banner NFT project. It was intially created to lookup rarities of

Akuti 4 Jun 24, 2022
A simple bot that looks for names and cpfs in the vaccination list made available by the government Fortaleza - CE

A simple bot that looks for names and cpfs in the vaccination list made available by the government Fortaleza - CE

Breno Aquino 1 Dec 21, 2021
๐ŸŽฅ Stream your favorite movie from the terminal!

Stream-Cli stream-cli is a Python scrapping CLI that combine scrapy and webtorrent in one command for streaming movies from your terminal. Installatio

R E D O N E 379 Dec 24, 2022
Send automated wishes to your contacts at scheduled time through WhatsApp. Written for Raspberry pi.

Whatsapp Automated Wishes Helps to send automated wishes to your contacts in Whatsapp at scheduled time using pywhatkit . Written for Raspberry pi. Wi

Uthayamurthy 2 Dec 13, 2022
Scrape the Twitter Frontend API without authentication.

Twitter Scraper ๐Ÿ‡ฐ๐Ÿ‡ท Read Korean Version Twitter's API is annoying to work with, and has lots of limitations โ€” luckily their frontend (JavaScript) has

BuฤŸra ฤฐลŸgรผzar 3.4k Jan 08, 2023
Home Assistant custom integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, officially maintained by the Tuya Developer Team.

Tuya Home Assistant Integration Home Assistant custom integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, officially mainta

Tuya 704 Jan 03, 2023
Bendford analysis of Ethereum transaction

Bendford analysis of Ethereum transaction The python script script.py extract from already downloaded archive file the ethereum transaction. The value

sleepy ramen 2 Dec 18, 2021
This is a simple bot for running Python code through Discord

Python Code Runner Discord Bot This is a simple bot for running Python code through Discord. It was originally developed for the Beginner.Codes Discor

beginner.py 1 Feb 14, 2022
Tools ini hanya bisa digunakan untuk menyerang website atau http/s

โ˜ข๏ธ Tawkun DoS โ˜ข๏ธ Tools ini hanya bisa digunakan untuk menyerang website atau http/s FITUR: [ โ˜ฏ๏ธ ] Proxy Mode [ ๐Ÿ”ฅ ] SOCKS Mode | Kadang Eror [ โ˜ข๏ธ ] Ht

Bandhitawkunthi 9 Jul 19, 2022
Discord group chat leaver.

Discord group chat leaver I know many people who have fallen victim to these weird group chat spammers including me. I made this script to help those

cliphd 3 Feb 27, 2022
An unofficial wrapper for Engineer Man's Piston API

Pistonpy Pistonpy is an API wrapper for the Piston code execution engine by Engineer Man. Key Features Simple modern and efficient Pythonic API using

AalbatrossGuy 4 Jan 03, 2022
Yes, it's true :heartbeat: This repository has 337 stars.

Yes, it's true! Inspired by a similar repository from @RealPeha, but implemented using a webhook on AWS Lambda and API Gateway, so it's serverless! If

512 Jan 01, 2023
Command-line program to download image galleries and collections from several image hosting sites

gallery-dl gallery-dl is a command-line program to download image galleries and collections from several image hosting sites (see Supported Sites). It

Mike Fรคhrmann 6.4k Jan 06, 2023
How to make a QR Code of your own in python

QR CODE Bilgilendirme! " pip install qrcode pillow " kurmalฤฑsฤฑnฤฑz.

Aktali 1 Dec 24, 2021
WhatSender is a python package that allows you to send Whatsapp messages at a given time.

WhatSender is a python package that allows you to send Whatsapp messages at a given time.

IdoBarel 0 Apr 21, 2022
Estudo de como criar uma api para o gerenciamento de livros usando a django restframework

Boa parte do projeto foi beaseado nesse vรญdeo e nesse artigo. Se assim como eu, vocรช entrou agora no mundo BackEnd, recomendo fortemente tais materiai

Michel Ledig 14 Jun 28, 2022