ai challenge - the ants game

Post on 04-Jul-2015

2.319 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

Presentation about AI Challenge - The Ants game. It explains in high level the strategies used to develop the Ignite bot.

TRANSCRIPT

AI Challenge – The Ants

Contents

● Introduction

● Strategy

● Utility Classes

● Timeout Strategy

● Test

● Goal and Result

What?

“Ants is a multi-player strategy game set on a plot of dirt with water for obstacles and food that randomly drops. Each player has one or more hills where ants will spawn. The objective is for players to seek and destroy the most enemy ant hills while defending their own hills. Players must also gather food to spawn more ants”

The objective is to create a computer program (a bot) that plays the game of Ants as intelligently as possible.

Maps

● Each square can contain land, water, food, a live ant, multiple dead ants or an ant hill● The edges of the map are wrapped (top → down; left → right)● Limited to 2 to 10 players● Symmetric● Not contain islands

Maze

Random Walk

Starter Package

● Engine in python

● Code to read/write data from/to engine

● Maps

● Visualizer

Strategy

● Battle

● Food Harvest

● Defense

● Attack

● Explore

Battle

● Responsible for control Ants during battles

● Groups ants and enemies which are facing each other, generate the possible movements and calculate the score for each one

● There are tree battle strategy: NORMAL, AGRESSIVE and CRAZY

Food Harvest

● Responsible for harvesting food increasing the number of Ants

● In the first 60 turns, harvests all known food

● In the next turns, harvests all visible food

● The closest free ant is sent to the food

● If the ant sees the enemy hill, then another ant is chosen

Defense

● Checkpoints: smaller set of points which guarantees visibility of whole map

● Sentinels: ants responsible to be on the checkpoints to keep the visibility of the map

● Defense sends free ants to free checkpoints

● Defense manages sentinels

● When enemies are seem, Defense sends the property number of ants to kill the enemies.

● neededSoldiers = enemiesSize + 2 + enemiesSize / 3;

Attack

● Responsible for attacking enemy hills

● When a enemy hill is found, Attacker sends free ants to destroy the hill

● neededAnts = enemyAnts.size() + 5 – this.enemyHills.get(enemyHill).size()

Explorer

● Responsible to open the map

● Sends free ants to checkpoints which are not opened

● When all checkpoints are opened, send ants to closed points in the map, if exists

Utility Classes

● Map

● PathFinder

● Route

● RouteManager

Map

● Responsible for store the game state: ants position, enemies position, enemy hills position, food, water and so on

● Issue orders

● Utility methods such as getTilesInViewRadius, getNotBlockedNeighbors

PathFinder

● Implements A* path finder algorithm

● The biggest time consumer

Route/RouteManager

● Route represent the best known path between two points

● RouteManager ensures that only one Route exists for a given value (from, to)

Timeout Strategy

● 500 ms is the turn time

● Two strategies is used to manage that

● Method maxtime: the max time taken by the method is defined by the caller

● Timeout: every loop verifies if the turn time is about to finish, if yes, returns immediately

public boolean findBestPath(Route route, long maxTime) {

if (getTimeRemaining() < 5 || maxTime - (System.currentTimeMillis() - start) <= 1) { return false;}

if (!finder.findBestPath(route, 8)) { continue;}

Test

● No Unit Test

● Methods were changed or deleted all the time

● The best test approach was proved to be... PLAY!

● Test more than methods, test strategies!

● More fun! :)

● Online games

● Local games

● Official online games

Let's play!See the games at aichallenge.org/profile.php?user=8302

Goal and Result

● The goal was to be among the first one hundred positions in the final rank

● Our final position was 118 with skill 75.35

● We were the first bot in Estonia. The second one was placed in 212 (University of Tartu) with skill 71.44

● The skill of the first bot was 90.68

● Juri bot was placed in 1024 (7 of Estonia) with Skill 56.34

top related