Structure of the genome:


Every genome is comprised of a number of tolerance bits (as represented by booleans), followed by a number of action bits. 5 action bits encode one action. There are a fixed number of actions for each possible permutation of environmental conditions (as discussed below), which is referred to as the number of action points.


Threshold bits:


Bit index

Usage

0

Strategic location st.dev. tolerance (1/2)

1

Strategic location st.dev. tolerance (2/2)

2

Combat win chance tolerance (1/4)

3

Combat win chance tolerance (2/4)

4

Combat win chance tolerance (3/4)

5

Combat win chance tolerance (4/4)

6

Queue length tolerance (1/3)

7

Queue length tolerance (2/3)

8

Queue length tolerance (3/3)

9

Banked resources threshold (1/6)

10

Banked resources threshold (2/6)

11

Banked resources threshold (3/6)

12

Banked resources threshold (4/6)

13

Banked resources threshold (5/6)

14

Banked resources threshold (6/6)

15

Turns left threshold (1/6)

16

Turns left threshold (2/6)

17

Turns left threshold (3/6)

18

Turns left threshold (4/6)

19

Turns left threshold (5/6)

20

Turns left threshold (6/6)

21

Default action/behavior (1/5)

22

Default action/behavior (2/5)

23

Default action/behavior (3/5)

24

Default action/behavior (4/5)

25

Default action/behavior (5/5)



Action encodings:

Binary code

Action

00000

Seize strategic location

00001

Seize resource

00010

Attack player 1

00011

Attack player 2

00100

Attack player 3

00101

Attack strongest military

00110

Attack strongest economy

00111

Attack weakest military

01000

Attack weakest economy

01001

Harass player 1

01010

Harass player 2

01011

Harass player 3

01100

Harass strongest military

01101

Harass strongest economy

01110

Harass weakest military

01111

Harass weakest economy

10000

Make (queue) worker

10001

Make (queue) tank

10010

Make (queue) air

10011

Make (queue) anti-air

10100

Fortify strategic location

10101

Fortify resource

10110

Fortify city

10111

Clear unit queue

11000

Combat win chance tolerance +10%

11001

Combat win chance tolerance -10%

11010

Combat win chance tolerance reset to default

11011

Turns left threshold -20%

11100

Turns left threshold +20%

11101

Turns left threshold reset to default

11110

Create new city

11111

No action

Environmental conditions:

Bit index

Usage

0

AI economy ranking (1/2)

1

AI economy ranking (2/2)

2

AI military ranking (1/2)

3

AI military ranking (2/2)

4

AI strategic location ranking (1/2)

5

AI strategic location ranking (2/2)

6

Attacked by player 1?

7

Attacked by player 2?

8

Attacked by player 3?

9

Lost mine last round?

10

Lost power plant last round?

11

Lost city last round?

12

Lost unit last round?

13

Built mine last round?

14

Built power plant last round?

15

Built city last round?

16

Units queued > threshold?

17

Resources banked > threshold?

18

Turns left > threshold?

19

Type of majority of global troops (1/2)

20

Type of majority of global troops (2/2)


These environment variables are fed to the AI each turn. The AI then converts this boolean array into an integer, which it uses to determine where in the genome to look for a set of responses (action codes) to perform during the turn.


Calculating the strategic value of a tile

Strategic locations are tiles which, if held, give a player increased control over the map. The strategic value of a given tile may be calculated as being the difference between the sum of the lengths of the paths from every city to every other city and from every city to every resource currently, and the same sum should that tile be made inaccessible/removed from the map (in cases where some routes are rendered impossible, this should count as an increase in distance of 500 tiles. The AI is usually only concerned with occupying strategic locations that are a number of standard deviations above the mean tile strategic value.




Calculating the economic ranking of a player


A player's current economic ranking can be calculated by summing the number of resources that player is able to gain per turn from all their mines.


Calculating the military strength of a player


A player's current military strength can be calculated by summing the number of resources the player has expended for each unit they currently have on the map.


What do the action codes mean?


The implementations of each of the action codes can be found here: http://www.chasestevens.com/ai_actions.html