gcode-mirror / ai-contest

Automatically exported from code.google.com/p/ai-contest
0 stars 1 forks source link

server bug: two simultaneous fleets attack a planet, one is ignored #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
http://www.ai-contest.com/visualizer.php?game_id=4410721 shows a couple of 
cases where both red and green attack a neutral planet simultaneously, with one 
fleet disappearing entirely.

See also a thread about this: 
http://www.ai-contest.com/forum/viewtopic.php?f=18&t=390.

One-line fix attached (missing increment in the loop at line 172).
I also included some other increments in places I think may cause infinite 
loops.

Original issue reported on code.google.com by jokeserver on 6 Sep 2010 at 10:29

Attachments:

GoogleCodeExporter commented 9 years ago
Oh snap. You're all over the place. I will add this patch into the some branch 
as the client-side engine fix, so that we can review them both at once.

Original comment by cameron.jp@gmail.com on 6 Sep 2010 at 11:10

GoogleCodeExporter commented 9 years ago
The patch is not correct.  It increments the current_attacker index without 
checking the array bounds.

Original comment by jklan...@gmail.com on 6 Sep 2010 at 11:49

GoogleCodeExporter commented 9 years ago
Shoot, you're right. Still, that's only for the first two occurrences, which 
were trying to guard against infinite looping.

Should be fixed here.

Original comment by jokeserver on 7 Sep 2010 at 12:14

Attachments:

GoogleCodeExporter commented 9 years ago
Good catch, jklandis. I manually went in and made the tweaks suggested by 
jokeserver's second patch. The changes are now live.

Can somebody verify that the new behavior is as it should be? You might have to 
wait a bit until we start to get game replays on the site of games that have 
happened since this change has gone live.

I will hold off on declaring this issue fixed until people have had a chance to 
weigh in.

Original comment by cameron.jp@gmail.com on 7 Sep 2010 at 12:31

GoogleCodeExporter commented 9 years ago
I noticed a similar issue in the client. When two different planets are 
attacked in the same turn, one fleet also disappears.  
If you run 
java -jar tools/PlayGame.jar maps/map30.txt 1000 1000 log.txt "java -jar 
example_bots/RageBot.jar" "java -jar example_bots/Ragebot.jar" | java -jar 
tools/ShowGame.jar
Both players send a fleet of 100 to each other. One of the fleets disappears...

Original comment by mesuerebart on 8 Sep 2010 at 9:14

GoogleCodeExporter commented 9 years ago
That is a different bug, see Issue 72.

Original comment by jokeserver on 9 Sep 2010 at 4:04

GoogleCodeExporter commented 9 years ago
Issue 64 supersedes this issue.  Whatever patch is eventually accepted for 64 
will almost certainly rewrite all the battle resolution code in both the Python 
and Java engines.

Original comment by jklan...@gmail.com on 9 Sep 2010 at 6:24

GoogleCodeExporter commented 9 years ago

Original comment by jokeserver on 18 Sep 2010 at 1:33