Giter Club home page Giter Club logo

2023-python-snake's Introduction

Minimax BattleSnake Ai built with Python

  • Snake built for the 2023 spring RBC BattleSnake competition, second place winner
  • Reached 16th in global standard ladder and 17th in duels
  • Snake uses paranoid Minimax algorithm with alpha-beta pruning for decision making, allowing the Ai to have up to 7 steps look ahead
  • Behavior is determined by heuristics, such as using flood fill to score each possible outcome

About Snake

  • The name of the snake is Orion's Fang, inspired by the Orion constellation
  • Orion's Fang is an aggressive but rational snake, quite experienced in area control and edge killing
  • Can often overthink and panic, killing itself in the process

Project Image

Orion's Fang showing his area control capabilities against CoolSnake!

Debugging Process

  • Debugging the Minimax decision tree using simple debuggers proved to be a nightmare, so it was decided that a visual representation of the tree was needed
  • The visual decision tree given a game state, render all possible game state of each snakes up to the max depth
  • The game boards are displayed as board with 0 being empty cells, 1 being food, 2 being snake head and letters to represent snake body
  • Each possible game state is assigned a value and a chosen move which will be moved upwards for the root game state to choose

Project Image

The visual tree at depth 2

Technology used

  • Coded with Python 3, libraries such as Matplotlib and Networkx were used for creating the visual decision tree
  • Deployed using DigitalOcean

2023-python-snake's People

Contributors

ycheng11065 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.