[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 - Invalid Order error

It is currently Thu Oct 18, 2018 11:20 pm Advanced search

Invalid Order error

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

Invalid Order error

Postby sidi » Sun Nov 07, 2010 10:36 am

Hello,

Whenever I submit my code(), I am facing an invalid order issue after some turns (like 10 to 20) and the bot crashes. I have tested the bot on all the sample maps and there it did not crash a single time.

Is there any way I can know the cause for this crash?

Thank you.
sidi
Cadet
 
Posts: 3
Joined: Sat Oct 02, 2010 6:07 am

Re: Invalid Order error

Postby Mistmanov » Sun Nov 07, 2010 6:30 pm

Every enemy is different. The bots that you use for local testing may not do anything that causes your bot to produce an error, but the more advanced bots that you encounter online may..

Directly before issuing an order, always check a bunch of things:
- Is my "source planet" actually one of my planets?
- Is the destination planet not the same as the source planet?
- Does the source planet have enough ships left to fulfill the order?
important: IssueOrder(source, dest, numships) does NOT update the amount of ships that the game thinks your planet has. So if my planet starts out with 20 ships, this is going to cause an error:

attackforce=15;
if(p.NumShips >= attackforce) pw.IssueOrder(source, dest, attackforce);
if(p.NumShips >= attackforce) pw.IssueOrder(source, dest, attackforce);

During the second if-statement, the game still thinks my planet has 20 ships, even though I already sent 15 away. It will then attempt to send another 15, leading to me losing.

Besides that.. try to get some debugging info out of your program. When issuing an order, you should print the order to the console or something. Google around for the specifics of the program that you're working with, or view viewtopic.php?f=18&t=947
Mistmanov
Colonel
 
Posts: 70
Joined: Fri Sep 24, 2010 6:50 pm

Re: Invalid Order error

Postby Quorcork » Wed Nov 10, 2010 12:40 am

Hmm. I have the same issue, despite the fact that i am explicitly testing for all the errors you describe right before issuing an order.
Are there more order violations to be checked against or might the server possibly report a wrong error? E.g. the server might state "Player X issued an invalid order.." not because of an incorrect order but maybe because of an exception, etc., in the bot?
Quorcork
Cadet
 
Posts: 4
Joined: Wed Nov 10, 2010 12:36 am

Re: Invalid Order error

Postby voidptr » Wed Nov 10, 2010 3:07 am

voidptr
Brigadier-General
 
Posts: 139
Joined: Sun Sep 12, 2010 7:22 pm

Re: Invalid Order error

Postby Quorcork » Wed Nov 10, 2010 8:41 am

Thanks for the tips.
The number of available ships cannot be the issue, on the one hand every order is deducted from the local fleet, on the other i'm checking this possible violation right before calling IssueOrder, as written earlier.

I'll see if i can recycle the game and test locally, as proposed.
Thanks again!
Quorcork
Cadet
 
Posts: 4
Joined: Wed Nov 10, 2010 12:36 am

Re: Invalid Order error

Postby Quorcork » Wed Nov 10, 2010 9:13 am

Hmm, striking observation. All my games end in turn #17 with the invalid order message.
About a dozen games, all in turn #17....
Will check on this.
Quorcork
Cadet
 
Posts: 4
Joined: Wed Nov 10, 2010 12:36 am

!SOLUTION! Re: Invalid Order error

Postby Quorcork » Wed Nov 10, 2010 4:07 pm

So i found the solution for my invalid order error:

I'm not exactly sure why but the problem was caused by call to finishTurn() in my DoTurn() method impl. At the end of my DoTurn() impl i added a FinishTurn() call. This was superfluous as FinishTurn() is already called in the main method of the Java starter package MyBot.java implementation.
After removing my superfluous call in DoTurn() server games are running ok.

Sidenote: Jep, the server may report an invalid order error when none-order-related problems arise.
Quorcork
Cadet
 
Posts: 4
Joined: Wed Nov 10, 2010 12:36 am

Re: Invalid Order error

Postby sidi » Wed Nov 10, 2010 7:52 pm

My thanks to Quarcock!
Co-incidentally, I was also adding the FinishTurn() call at the end of my DoTurn() method. Once I removed it, the error seems to be resolved.
sidi
Cadet
 
Posts: 3
Joined: Sat Oct 02, 2010 6:07 am


Return to Technical Issues

Who is online

Users browsing this forum: Google [Bot] and 5 guests

cron