gcode-mirror / ai-contest

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

Off-by-one bug in battle resolution algorithm #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If a planet has zero ships and you hit it with one ship, the planet becomes 
your but with zero ships. It should become yours but with one ship.

Original issue reported on code.google.com by cameron.jp@gmail.com on 4 Sep 2010 at 11:36

GoogleCodeExporter commented 9 years ago
There are bugs in both the Python and Java game engines related to battle 
resolution.  Please see the below thread.  It's hard to see why these bugs 
shouldn't be high priority.

http://ai-contest.com/forum/viewtopic.php?f=18&t=390&start=0&sid=1842fdf96215036
3b6f0a05ddd9494c4

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

GoogleCodeExporter commented 9 years ago
To summarize my comments on that thread, the problem is in Game.java in a 
while(true) loop that should not be entered if one fleet attacks, and here is a 
patch that should fix it.

(PS. I tried to maintain the strange tabbing that svn gave me, sorry if it's 
bad.)

Original comment by jokeserver on 6 Sep 2010 at 10:23

Attachments:

GoogleCodeExporter commented 9 years ago
You guys both rock. I am blown away that there are people out there motivated 
enough to fix my shitty code.

I am going to create a branch and apply the patch. Will update in a bit.

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

GoogleCodeExporter commented 9 years ago
Everything looks good with this patch. I have merged it with trunk. The change 
is now live!

Can somebody verify that the new behavior is as it should be?

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

GoogleCodeExporter commented 9 years ago
I just downloaded the new C++ starter pack from the site and I think I'm still 
getting the old behavior.  I send 7 ships to a neutral planet with 6 ships and 
I end up with a neutral planet with 0 ships.  Shouldn't I end up with a planet 
owned by me with 1 ship?

Original comment by sfx...@gmail.com on 7 Sep 2010 at 1:35

GoogleCodeExporter commented 9 years ago
Jeff, did you rebuild the PlayGame jar and repackage the start packs with it?

Original comment by jokeserver on 7 Sep 2010 at 3:30