[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/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 - Gravity Wells

It is currently Wed Jan 24, 2018 2:02 am Advanced search

Gravity Wells

Share and discuss ideas for your entries here.

Re: Gravity Wells

Postby Memetix » Sat Dec 03, 2011 10:55 pm

I guess that depends on how you've implemented the BFS.
I have an outer loop - each time around that loop is 1 distance further from the source.
Within that loop I score each tile in the current "boundary" list of tiles and then I work out the new boundary.

Something like
dist = 0
while (boundary.size() > 0) {
dist++
for (Tile t: boundary) {
t.score += weight/(dist*dist);
new_boundary.add(all adjacent tiles to t that have not been processed so far)
}
boundary = new_boundary
}
I obviously need to call the BFS routine separately for each differently weighted set of objects. I hope that helps and good luck .... I got to 4th place on Fluxid, so it seems to work as a design concept.
Memetix
Major
 
Posts: 39
Joined: Tue Nov 08, 2011 3:53 pm

Re: Gravity Wells

Postby ikaros » Sun Dec 04, 2011 12:07 am

ikaros
Cadet
 
Posts: 9
Joined: Mon Oct 24, 2011 7:02 pm

Re: Gravity Wells

Postby NiveusPrime » Sat Dec 10, 2011 1:49 pm

Just tried it. The ants get stuck in the maze at the intersection of routes. Because the amount is higher than gravitation in the direction of a particular source. distance^2 not helps. It's starts working somehow at about distance^4.
Ants bot:
NiveusPrime
Lieutenant
 
Posts: 13
Joined: Wed Nov 02, 2011 7:04 pm

Re: Gravity Wells

Postby Tortortor » Sat Dec 10, 2011 8:24 pm

It doesn't matter d^2, d^4 or any other. Ants will stuck if gravity is high enough, or will not go to the food at all.

Scoring for particular tile should not take in use food or enemy gravity from many sources - only from the highest
Tortortor
Major
 
Posts: 37
Joined: Fri Oct 21, 2011 12:10 pm

Re: Gravity Wells

Postby Memetix » Sat Dec 10, 2011 8:49 pm

I've not had any problems with using distance squared so I'm surprised that you needed to quadruple.

I add in the scores from all sources, not just the highest one - I guess both schemes have their merits. I also use a random number to break ties so that I don't get stuck between 2 equal choices.
Memetix
Major
 
Posts: 39
Joined: Tue Nov 08, 2011 3:53 pm

Re: Gravity Wells

Postby Tortortor » Sat Dec 10, 2011 9:39 pm

in case you bot(A) will have two foods(F) from two sides:

F...A...F - scheme
012345678 - tiles
your bot will go from 4->5, 5->4, 4->3, 3->4 and so on
because 3,4,5 will have higher score then 2 and 6
Tortortor
Major
 
Posts: 37
Joined: Fri Oct 21, 2011 12:10 pm

Re: Gravity Wells

Postby Memetix » Sat Dec 10, 2011 9:56 pm

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

Re: Gravity Wells

Postby Tortortor » Sun Dec 11, 2011 7:52 pm

I have a try to do like this. But in case "many foods, many enemies" ants stuck between targets very often
Tortortor
Major
 
Posts: 37
Joined: Fri Oct 21, 2011 12:10 pm

Re: Gravity Wells

Postby Darhuuk » Sun Dec 11, 2011 8:24 pm

Just out of curiosity: how do you handle the "2 food at 5 distance vs 1 food at 4 distance" case? I'm using diffusion myself and the thing I like about path finding using diffusion is that it takes something like that into account inherently (your ant will move to the 2 foods which are a bit further away since that is the more optimal solution).

Is something like that possible with your gravity wells method? Looking at , I guess it is possible to calculate the "force" every piece of food exerts on an ant, sum all those forces per ant and have the ant go in the direction with the strongest pull. However, that would entail a different type of calculations than what you are doing right now. As I see it, it would force you to do a full BFS for each single source of food. Of course, you could always stop as soon as you found an ant, but you'd still need a separate BFS for each source of gravity.

So, is there a way to take this into account? Am I over complicating things? Do you just ignore this fact? Enlighten me, please :).
Darhuuk
Colonel
 
Posts: 71
Joined: Wed Nov 16, 2011 12:58 pm

Re: Gravity Wells

Postby Memetix » Mon Dec 12, 2011 7:55 am

I do indeed do a separate BFS for each food, stopping when I reach an ant.
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 1 guest

cron