/blob

An agar.io bot that tries to compete with humans

Primary LanguageCommon Lisp

blob

An agar.io bot that tries to compete with humans

Goal

Beat humans in the agar.io game by having the biggest score.

Input

Input: A sequence of the last N frames with:

  • positions and types of:
    • at most f nearest instances of type food
    • at most p nearest instances of type player
    • at most m nearest instances of type mine

Initially N = 1, f = 1, p = 1, m = 0 will be used. If the results appear to be promising, these values will be changed.

Example Input

Example 1

Values outlined with green are distances to food, black - blobs.

N = 1, f = 2, p = 3, m = 0.

Output

Output:

  • direction
  • action:
    • move
    • split - move and split
    • feed - move and feed

Initially only move action will be allowed.

Score

During the evolution score will be assigned based on:

  • time lived
  • food consumed
  • enemies consumed

Method

Genetic programming is going to be used.

The programs are going to be represented as Lisp code.

Initial idea

The first implementation should be as simple as possible.

An example program:

(if (< (distance (mine 0))
       (distance (food 0)))
    (+ 180 (direction (mine 0)))
    (direction (food 0)))

To choose a subexpression to mutate, we can walk it recursively, construct a list of (references to) the individual expressions and choose one of them to mutate.

An example of such a list:

((if (< <...>) <...>)
 (< <...>)
 (distance (mine 0))
 (distance (food 0))
 (+ 180 <...>)
 180
 (direction (mine 0))
 (direction (food 0)))

Symbols:

  • (distance (mine i))
  • (direction (mine i))
  • (size (mine i))
  • 0, 5, ..., 355

Operations:

  • (if test then else)
  • (+ a b)
  • (- a)
  • (< a b)

Plan