Skip to content

Narnach/ants

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Contest: Ants bot kit in Ruby

My changes

My main goal is to get a toolchain up and running that does all the things I want with the least amount of effort. I built something like this for Planet wars and liked it.

rake prepare

This prepares your project by automatically downloading all the necessary tools. It is automatically called by any rake task that tries to run your bot, so you don’t even need to think about it.

rake test

Sanity check the bot on a special map against a test bot to weed out crash bugs.

rake upload

Builds an archive named bot.zip and opens up the bot upload page in a browser. Before this, it runs the ‘test’ task to prevent obviously broken bots from being uploaded. Uploading a new bot does not really get easier than this.

rake play

Selects a random map, adds your current bot and then adds random bots until there are enough. Then it plays the match and opens the visualizer afterwards.

Bot features

  • Collision detection: my ants will not attempt to enter a square with water, an ant, food or an empty land square with a known inbound ant

  • Height map-based ant flow. Food acts as an attractor in a short range. Ants act as repulsors in a short range. Ants always move towards the greatest attractor.

  • Implemented via height map

    Food proximity detection: if an adjecent square is adjecent to food, go there.

  • Implemented via height map

    Enemy avoidance: if they don’t shoot you, you won’t lose points.

Removed features

Infrastructure todo

  • Tag previous submissions in git, put all submissions in their own directory for inclusion in the local tournaments.

  • Play local tournaments: match the current bot against the best bots I have available.

Bot todo

Different modules or focused bots for different aspects of a final contest bot:

  • Explorer bot: try to get 100% sight on the map using the lowest number of ants

  • Food bot: go grab all the food as fast as possible

  • Coward bot: run away from enemy ants, can use behavior from explorer and food bot

  • Attack bot: kill all visible enemy ants, may have to do simple checking to prevent being outnumbered and suiciding on a wall of ants

  • Defend bot: form groups of ants, overwhelm enemies that come near my ants, run away when outnumbered

  • Balanced bot: explore the map, grab food, overwhelm enemy ants while trying not to get defeated myself.

  • Land grab bot: try to block enemy ants from entering an area. Automatically expands the area when enough ants are available. May use walls or patrols or guards to mark the inner area and protect it.

Assumptions

  • I’m using a Mac for development. You may be using a Mac or Linux and things should just work. If you’re on Windows, there may be problems you have to resolve.

  • I assume a standard toolchain is available, so that I can use the wget, zip and unzip command line tools for setup/upload preparation.

The legal stuff

This bot kit is based on the starter package ‘Ants AI Challenge framework’, which was created by Matma Rex (matma.rex@gmail.com) and is licensed under the CC-BY 3.0 license. The starter package code is the very first commit in this repository. All other changes belong to the committer of a change, unless specified otherwise. All changes by me (Wes ‘Narnach’ Oldenbeuving) fall under the MIT licensed.