Wednesday, 15 July 2009

Behaviour of the Basic Bot

The Basic Bot is my first cut at a basic AI for SquirtySquirty. It's pretty simple, it has a list of behaviours, every timestep it goes through them in order and executes the first one which "triggers". The end result should be an AI which will beat you if you are a total noob, but which you will be able to beat after 2 or 3 games.

Here is the list of behaviours for the Basic Bot.

Behaviour: attempt win.
Triggered if I am carrying the target protein or more.
Head directly for my home hex.

Behaviour: steal
Triggered if I am in a steal position and the enemy has protein.
If I have no space but I am carrying venom then squirt venom.
Otherwise, steal the protein.

Behaviour: attack
Triggered if the enemy location is known, and I can make one venom, and either the enemy's energy is unknown or it is less then mine.
If I don't have a venom then make one.
If I do have a venom then head for the enemy, trying to get in one of the 3 steal positions if possible, otherwise any attack position. Avoid vulnerable positions where necessary.
If I am in attack position then venomize the enemy.

Behaviour: escape
Triggered if the enemy location is known and the enemy's energy is known to be greater than mine.
Run away from the enemy. Prefer escape destinations which are low damage cost for me, but high damage cost for the enemy.

Behaviour: pod interaction.
Triggered if I am facing a pod:
  • If it is venomless, and I can make venom, make a unit of venom and venomize it.
  • If it has enemy venom, mutoid venomize it.
  • If does not have toxic venom and it has protein, collect the protein.
Default behaviour: tour pod hexes.
Executed if no other behaviours trigger.
Order the pods of the map according to some weighting of the following factors:
  • How long ago since I last visited it (i.e. came within visibility range).
  • How long ago since I last inspected it (i.e. saw the protein level).
  • How much protein I believe is in there.
  • How much naturally-occuring protein is generated there.
  • What kind of venom there is there if any.
  • The potential energy loss to visit it.
Visit pod at the top of the list.

No comments:

Post a Comment