ai challenge - the ants game

21
AI Challenge – The Ants

Upload: jordan-silva

Post on 04-Jul-2015

2.319 views

Category:

Technology


2 download

DESCRIPTION

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

TRANSCRIPT

Page 1: Ai challenge - The Ants game

AI Challenge – The Ants

Page 2: Ai challenge - The Ants game

Contents

● Introduction

● Strategy

● Utility Classes

● Timeout Strategy

● Test

● Goal and Result

Page 3: Ai challenge - The Ants game

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.

Page 4: Ai challenge - The Ants game

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

Page 5: Ai challenge - The Ants game

Maze

Page 6: Ai challenge - The Ants game

Random Walk

Page 7: Ai challenge - The Ants game

Starter Package

● Engine in python

● Code to read/write data from/to engine

● Maps

● Visualizer

Page 8: Ai challenge - The Ants game

Strategy

● Battle

● Food Harvest

● Defense

● Attack

● Explore

Page 9: Ai challenge - The Ants game

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

Page 10: Ai challenge - The Ants game

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

Page 11: Ai challenge - The Ants game

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;

Page 12: Ai challenge - The Ants game

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()

Page 13: Ai challenge - The Ants game

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

Page 14: Ai challenge - The Ants game

Utility Classes

● Map

● PathFinder

● Route

● RouteManager

Page 15: Ai challenge - The Ants game

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

Page 16: Ai challenge - The Ants game

PathFinder

● Implements A* path finder algorithm

● The biggest time consumer

Page 17: Ai challenge - The Ants game

Route/RouteManager

● Route represent the best known path between two points

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

Page 18: Ai challenge - The Ants game

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;}

Page 19: Ai challenge - The Ants game

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

Page 20: Ai challenge - The Ants game

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

Page 21: Ai challenge - The Ants game

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