[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4586: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4588: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4589: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4590: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
AI Challenge Forums • View topic - A simple approach to combat

It is currently Sat Oct 20, 2018 10:21 pm Advanced search

A simple approach to combat

Share and discuss ideas for your entries here.

Re: A simple approach to combat

Postby crispy » Sat Dec 10, 2011 9:39 am

I implemented a version of this today and it beats the pants off my previous, much slower combat routines. :roll: Thanks for sharing Memetix! :ugeek:

bluegaspode: My implementation is a little different from Memetix's outline, but I think it's equivalent, so I'll explain my variation.

First I calculate the per-player + total influence maps (this part is the same).

Secondly, I build an enemy weakness map, where each tile's value is set to the "weakness" of the least weak enemy ant within range. The "weakness" of an ant just means (total[tile]-influence[owner][tile]) for the ant's tile.

The simplest, but wrong, way to do this is to iterate all the enemy ants, then iterate the area around it with radius attack_range+1, and update each tile if the ant's weakness is less than any value placed at that tile previously. This is wrong because the enemy ant's weakness could change if it moves. What you need to do is iterate through all the enemy ants, then iterate all the tiles that enemy ant could move to (there are 5 of them!), and then spread the weakness values of those tiles, within attack_range only.

Finally, create the status array by testing the enemy weakness map against total[tile]-influence[player0][tile] (which is your bot's own weakness map).

Potential optimizations are left as an exercise to the reader. ;)
crispy
Lieutenant
 
Posts: 10
Joined: Sat Nov 05, 2011 3:07 am

Re: A simple approach to combat

Postby gnu264 » Sat Dec 10, 2011 9:49 am

@blugaspode:
In the last step, when you are moving your ant to position 2, it can only fight with enemy ants in positions 0-4. Now all you have to do is find out min(fighting[player_b][0..4]) -> that will be the number of ants which the strongest enemy ant is fighting. In your example, fighting[player_b][0..4] are all 1 -> min() = 1 -> your strongest enemy is fighting 1 ant. Since your own ant is also fighting with 1 ant, status[player_a][2] = KILL.
gnu264
Captain
 
Posts: 23
Joined: Tue Nov 08, 2011 5:27 pm

Re: A simple approach to combat

Postby bluegaspode » Sat Dec 10, 2011 10:44 am

bluegaspode
Colonel
 
Posts: 51
Joined: Mon Nov 07, 2011 8:38 am

Re: A simple approach to combat

Postby Darhuuk » Sat Dec 10, 2011 10:53 am

Darhuuk
Colonel
 
Posts: 71
Joined: Wed Nov 16, 2011 12:58 pm

Re: A simple approach to combat

Postby bluegaspode » Sat Dec 10, 2011 11:59 am

OK - so off to meet CombatAnt on Fluxid :)
bluegaspode
Colonel
 
Posts: 51
Joined: Mon Nov 07, 2011 8:38 am

Re: A simple approach to combat

Postby TwistedLogic » Sat Dec 10, 2011 12:57 pm

I have managed to implement the calculations of this technique correctly but what I am not sure about now is how to use this in combat. Currently the only use for this in my bot is to avoid unsafe squares. My current combat implementation attacks if it outnumbers the enemy and this always beat the version using this technique.
TwistedLogic
Lieutenant
 
Posts: 14
Joined: Fri Oct 28, 2011 4:48 pm

Re: A simple approach to combat

Postby Memetix » Sat Dec 10, 2011 3:05 pm

Memetix
Major
 
Posts: 39
Joined: Tue Nov 08, 2011 3:53 pm

Re: A simple approach to combat

Postby LoneWolf » Sat Dec 10, 2011 9:40 pm

Now I am confused.
The influence part I got it.
But for the fighting
So for each ant, for each tile in the combat area, i put the lowest number of enemies being fought in each tile of the combat area? or in the tile where the ant is moved?

as for the status i dont really get it
LoneWolf
Lieutenant
 
Posts: 13
Joined: Sun Nov 06, 2011 1:29 am

Re: A simple approach to combat

Postby codetiger » Sun Dec 11, 2011 6:26 am

I am happy to say, I've added this method to my python bot. I was using similar technique for combat but I was calculating the battle resolution live for every ant before taking decisions. Now, this method gives me more time to make decisions based on the per calculated results. :) I still need to tune my combat now. Am on fluxid server with same name. :)

codetiger
Lieutenant-Colonel
 
Posts: 47
Joined: Sun Aug 21, 2011 4:47 am

Re: A simple approach to combat

Postby Memetix » Sun Dec 11, 2011 7:56 am

Memetix
Major
 
Posts: 39
Joined: Tue Nov 08, 2011 3:53 pm

PreviousNext

Return to Strategy

Who is online

Users browsing this forum: No registered users and 2 guests

cron