[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/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 - Game playback show incorrect calculations

It is currently Wed Jan 17, 2018 11:05 am Advanced search

Game playback show incorrect calculations

Code won't compile? Found a bug? Post here!

Game playback show incorrect calculations

Postby PeterValentine » Thu Sep 02, 2010 8:25 pm

Please watch the game that was played at the following link.


Soon after the halfway point the red bot sends 87 units and the green bot sends 59 units to the same bottom planet with 2 "native defensive" units.

They seemingly get there at the same time or red slightly ahead. Green ends up being rewarded the planet with 58 units remaining.

Please review and advise.

Thanks,
-PeterValentine
PeterValentine
Cadet
 
Posts: 1
Joined: Thu Sep 02, 2010 8:20 pm

Re: Game playback show incorrect calculations

Postby bswolf » Sat Sep 04, 2010 6:56 pm

This also happens earlier in the game, on the second planet taken. Red sent 70, Green sent 65, the planet had 2, they both arrive on the same turn, but Green gets it with 64.

It seems to me that it should have been either: Red 70-2=68, then Green's 65 reduces it to Red 3; or Green 65-2=63, then Red takes it with 70-63=7.

Furthermore, these aren't the numbers I'm seeing running the game on my computer. Landing 100 ships on a neutral planet with 3 gives me 96 ships. I assume this is from the notion that reducing it to 0 doesn't change ownership. So 3 reduce it to 0, then 1 makes it mine, then 96 join as reinforcements?

I also found the fleet race on my machine: a neutral planet with 6 ships, Red (P1) sends 75, Green (P2) sends 60. They reach at the same time and the result is Red 15. But...if Red lands first, then 75-6=69 (or 68 including the ship sacrificed to take ownership), then 69-60=9 after Green lands (so 8 or 9); if Green lands first, then 60-6=54 (or 53) and then 75-54=21 (or 75-53-1=21).

What I suspect is happening here is that both fleets are being penalized the 6 ships, so that the difference of 15 is maintained, then the bigger fleet wins and gets the planet minus the smaller fleet. Either they are both charged the 1 ship for taking over, or neither is. (Or Green gets the planet with 53 ships, then Red's 69 take it, leaving 69-53-1=15 ships. This is likely because Green's fleet was launched before Red's in this case.)

Having said all that, is there an official way these cases will be handled? Will the 1 ship cost apply to taking over planets, and how are multiple fleets landing on a planet simultaneously handled?
bswolf
Lieutenant
 
Posts: 15
Joined: Fri Sep 03, 2010 6:14 am

Re: Game playback show incorrect calculations

Postby bswolf » Sat Sep 04, 2010 11:03 pm

Here is another situation I would like clarified. A neutral planet with 30 ships, and two fleets, one red, one green, about to land. Say the red fleet has 10 and the green fleet has 40.

If they are both hitting against the 30, then green would have 10 (or 9) left, and red would not be able to conquer the planet, so green would get it with 10 or 9.
If red's fleet goes first, then it reduces the planet to 20 ships, then green takes it with 20 or 19.
If green's fleet goes first, then it takes the planet with 10 (or 9), and then red either reduces it to 0 or takes it with 0, the latter being the case where every conquering of another planet costs a ship.

As you can see, the order and the extra ship are very important. What should the outcome be here?
bswolf
Lieutenant
 
Posts: 15
Joined: Fri Sep 03, 2010 6:14 am

Re: Game playback show incorrect calculations

Postby bswolf » Mon Sep 06, 2010 3:01 am

Minor correction to one case earlier as I found a contradicting case. Namely, where conquering a planet with 1 more ship than stationed there, the planet is reduced to 0 and becomes neutral, and not part of the attacker's empire.

Red has a fleet of 204 ships 1 turn incoming to a Green planet with 198 ships and a growth rate of 5. On the next turn, the planet gains 5, putting it to 203, and the 204 Red ships hit, putting it to 0 and making it neutral (and not gaining ships from its growth rate).

So that one extra ship that it costs to take over a planet is actually to remove the owner's influence on it, at which point it is free for grabs. But, conquering a neutral planet also costs this one. I am thinking this particular case is a bug, or a very arbitrary special case.
bswolf
Lieutenant
 
Posts: 15
Joined: Fri Sep 03, 2010 6:14 am

Re: Game playback show incorrect calculations

Postby Zaph » Mon Sep 06, 2010 8:04 am

You seem to be talking to yourself here :-) maybe it's a bit early.

My guess at how the order of arrival *should* be implemented:
The arrival order should take into account the fractional part of the travel time, so if Player A has travel time of x.66, and player B has travel time of y.42 (x and y don't matter, since we know these ships are arriving on the same turn by definition of the problem). In this case, I'd expect Player B to get there first, followed by Player A - both on the same turn as far as our games are concerned, but the internal order of processing would be by the one with the earlier arrival time during the turn (0.42 vs 0.66)

How it's actually done, we'll just have to wait until someone responds :-)

Zaph
Zaph
Colonel
 
Posts: 78
Joined: Sun Sep 05, 2010 9:00 pm
Location: Melbourne, Australia

Re: Game playback show incorrect calculations

Postby bswolf » Mon Sep 06, 2010 6:13 pm

Well, I figured it wouldn't hurt to ask, even this early. Or maybe I'm just thinking out loud. :)

But someone in another thread posted a link to the code. So I've been reading and , the latter of which I presume is in the jar that runs our game (and I'm guessing the former is for the server).

Notably, the case where multiple enemy fleets attack a planet at once is handled by having them take turns trading one ship each with the planet, until either no fleet remains or the planet's forces are decimated. Then the fleets battle each other until only one remains, and that one takes the planet. ...except the java one sorts the fleets but the python one doesn't, and line 162 looks like it would cause an infinite loop.

But...aha! Line 264 in Game.java is part of a case where "If there are any enemy fleets left, then they battle it out to determine who gets control of the planet", yet that one ship is subtracted even in the case where there's only one fleet. The same actually occurs on line 172 of engine.py (and line 171 also looks like an infinite loop). So this does look like a bug. And because Game.java sets ownership of the planet to 0 before having the remaining fleet(s) battle, that explains my last case.

[Edit: The loop condition on this same case in the python is "while num_non_zero(attacking_forces) > 1", but the loop condition in the java is "while (true)". This causes a disparity between the two as the java will enter the loop if there are attacking forces, but the python will not.]

Having the source in front of me answers most of my questions. So, thanks for making it public, and sorry for thinking out loud so much. :)
bswolf
Lieutenant
 
Posts: 15
Joined: Fri Sep 03, 2010 6:14 am

Re: Game playback show incorrect calculations

Postby bswolf » Mon Sep 06, 2010 8:32 pm

bswolf
Lieutenant
 
Posts: 15
Joined: Fri Sep 03, 2010 6:14 am

Re: Game playback show incorrect calculations

Postby jkl » Mon Sep 06, 2010 9:34 pm

It looks like a bug was already filed about battle resolution. I added a note about this thread.

jkl
Cadet
 
Posts: 8
Joined: Mon Sep 06, 2010 8:46 pm

Re: Game playback show incorrect calculations

Postby bswolf » Mon Sep 06, 2010 10:30 pm

Great, thanks. I uploaded my fix.
bswolf
Lieutenant
 
Posts: 15
Joined: Fri Sep 03, 2010 6:14 am

Re: Game playback show incorrect calculations

Postby jeff.cameron » Mon Sep 06, 2010 10:56 pm

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.
jeff.cameron
Contest Organizer
 
Posts: 91
Joined: Sun Jan 31, 2010 4:06 am

Next

Return to Technical Issues

Who is online

Users browsing this forum: No registered users and 1 guest

cron