Tutorial

Thursday, February 09, 2012

11:04 AM

00000 - Seize Strategic location

Find strat locs using current st.dev.

Combine above with first-turn-calculated strat locs

If any free:

If have free units:

Move free unit to strat loc

Else:

Goto generalized "make unit"

If none free:

If have free units:

If total free units win chance > current win chance threshold

Remove units until win chance < current win chance threshold, then send previous iteration to strat loc

If total free units win chance < current win chance threshold

Goto generalized "make unit"

If strat loc list is empty:

If current st.dev != 1:

St.dev --

Goto 00000 - Seize Strategic location

Else

If default behavior does not reference contain chain reference to 00000:

Goto default behavior

Else:

Goto 00001 - Seize resource

 

00001 - Seize Metal

Find resources

If have free workers:

If free worker on resource:

Worker.build(resource_harvester)

Else:

Determine most profitable resource

Move closest free worker to that resource

Else:

Goto 10000 - Make worker

 

00010 - Attack Player 1

Get player 1 cities on map

If any player1 city accessible

Determine closest player1 city

If total free units win chance vs. city > current win chance threshold

Remove units until win chance < current win chance threshold, then send previous iteration to player1city

If total free units win chance < current win chance threshold

Goto generalized "make unit"

Else

Determine path of least resistance

If total free units win chance vs. closest part of path > current win chance threshold

Remove units until win chance < current win chance threshold, then send previous iteration to closest part of path

If total free units win chance < current win chance threshold

Goto generalized "make unit"

 

00011 - Attack Player 2

See 00010

 

00100 - Attack Player 3

See 00010

 

00101 - Attack strongest military

Determine non-self player with strongest military

If tie

Choose random player from tie set

Goto appropriate attack command (00010, 00011, 00100)

Else

Goto appropriate attack command (00010, 00011, 00100)

 

00110 - Attack strongest economy

See 00101

 

00111 -Attack weakest military

See 00101

 

01000 - Attack weakest economy

See 00101

 

01001 - Harass player 1

Get player 1 resources on map

If any player1 resource accessible

Determine closest player1 resource

If total free units win chance vs. resource > current win chance threshold

Remove units until win chance < current win chance threshold, then send previous iteration to player1resource

If total free units win chance < current win chance threshold

Goto generalized "make unit"

Else

Determine path of least resistance

If total free units win chance vs. closest part of path > current win chance threshold

Remove units until win chance < current win chance threshold, then send previous iteration to closest part of path

If total free units win chance < current win chance threshold

Goto generalized "make unit"

 

01010 - Harass player 2

See 01001

 

01011 - Harass player 3

See 01001

 

01100 - Harass strongest military

Determine non-self player with strongest military

If tie

Choose random player from tie set

Goto appropriate harass command (01001, 01010, 01011)

Else

Goto appropriate harass command (01001, 01010, 01011)

 

01101 - Harass strongest economy

See 01100

 

01110 - Harass weakest military

See 01100

 

01111 - Harass weakest economy

See 01100

 

10000 - Make worker

If have sufficient resources

Add worker to queue

Else

If free workers && insufficient metal

Goto 00001

Elif free workers && insufficient upkeep

Goto make power

Else

If default behavior does not reference contain chain reference to 10000:

Goto default behavior

Else:

Goto 11111

 

10001 - Make tank

If have sufficient resources

Add tank to queue

Elif insufficient metal

Goto 00001

Else

Goto make power

 

10010 - Make air

See 10001

 

10011 - Make anti-air

See 10001

 

10100 - Fortify Strategic Location

Get units set to hold strat loc

If above empty:

Goto 00000*

Else:

Find most vulnerable from above

If !has fortress:

If free workers

If free worker on tile

Worker.build(fortress)

Else

Send closest free worker to stractloc

Else

Goto 10000

Else

If free units

Send closest free unit to stratloc

Else

Generic make unit

 

10101 - Fortify Resource

See 10100 *Goto 00001

 

10110 - Fortify City

See 10100 *Goto 11110

 

10111 - Clear Queue

Clear queue

If default behavior does not contain chain reference to 10111

Goto default behavior

Else

Goto 11111

 

11000 - Combat % win change +10%

Combat % win threshold *= 1.1

If default behavior does not contain chain reference to 11000

Goto default behavior

Else

Goto 11111

 

11001 - Combat % win change -10%

Combat % win threshold *= .9

If default behavior does not contain chain reference to 11001

Goto default behavior

Else

Goto 11111

 

11010 - Combat % win reset

Combat % win threshold reset to genome value

If default behavior does not contain chain reference to 11010

Goto default behavior

Else

Goto 11111

 

11011 - Turns left threshold +20%

Turns left threshold *= 1.2

If default behavior does not contain chain reference to 11011

Goto default behavior

Else

Goto 11111

 

11100 - Turns left threshold -20%

Turns left threshold *= .8

If default behavior does not contain chain reference to 11100

Goto default behavior

Else

Goto 11111

 

11101 - Turns left threshold reset

Turns left threshold reset to genome value

If default behavior does not contain chain reference to 11101

Goto default behavior

Else

Goto 11111

 

11110 - Create new city

Find good city locations using map generation criteria

Narrow down above by determining which locations are accessible

Divide score of each above location by sqrt(dist_to_closest_AI_city)

City location = best overall score

If have free workers:

If worker on optimal location:

Worker.build(city)

Else:

Get closest free worker to location

CloseWorker.moveto(optimal location)

Else:

Goto 10000 - Make worker

 

11111 - Do nothing

Return NULL_ACTION

 

Generalized make unit -

Choose randomly between 10001, 10010, and 10011

 

Make power plant:

If free worker && worker not on metal:

If have sufficient resources:

Worker.build(powerplant)

Else:

Goto 00001

Else:

Goto 10000

 

Created with Microsoft Office OneNote 2007
One place for all your notes and information