[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/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 - Runs great locally but wrong on server

It is currently Sat Oct 20, 2018 8:27 pm Advanced search

Runs great locally but wrong on server

Topics about starter packages, visualizer or any other third party tools.
Please submit new language requests in the Language Request Forum.

Runs great locally but wrong on server

Postby KonaEarth » Sun Nov 27, 2011 10:24 am

I have tested my code locally with a zillion different maps and my ants scurry everywhere exactly as they are supposed to do.

For the first time, I uploaded my code (C++) to the server. I got everything to compile and run. I even won my first game but it was totally by chance because the other player's ants killed themselves. Rather than moving as expected, my ant just sat there and didn't do anything. I copied the input to my local machine and the ant moves but on the server it just sits there.

My guess is that I am either not receiving input (I use fgets from stdin) or not sending output (I use fprintf to stdout followed by fflush). There are no crashes or timeouts. At least not that I know of but I have no idea how to retrieve debug output.

Is there supposed to be a log file or some way for me to see how to fix this?
KonaEarth
Major
 
Posts: 33
Joined: Thu Nov 25, 2010 1:51 am

Re: Runs great locally but wrong on server

Postby KonaEarth » Sun Nov 27, 2011 5:48 pm

Arg! This is so frustrating. Everything compiles without warning. My AI kicks butt on my localhost with all the various maps. But on the test server it just sits there. No compiler errors, no test errors, no runtime errors, but no movement either.

I changed my output to be something invalid and that causes a timeout which tells me that my code's I/O is working correctly. Yet when the code outputs valid commands, it runs fine (no timeout) but the lone starting ant never moves.

There must be some subtle difference between my localhost Windows platform and the server's Ubuntu platform. I have no way to guess what that is without some feedback from my code. A log file would be great! Some way to view my ant's output would be great. Anything other than silence would be great.
KonaEarth
Major
 
Posts: 33
Joined: Thu Nov 25, 2010 1:51 am

Re: Runs great locally but wrong on server

Postby bigtymler » Sun Nov 27, 2011 5:57 pm

you can add --log_output to your test command line and it'll save a file of all bots outputs. same goes with the input --log_input
bigtymler
Cadet
 
Posts: 3
Joined: Sun Nov 27, 2011 5:17 am

Re: Runs great locally but wrong on server

Postby KonaEarth » Sun Nov 27, 2011 7:30 pm

KonaEarth
Major
 
Posts: 33
Joined: Thu Nov 25, 2010 1:51 am

Re: Runs great locally but wrong on server

Postby McLeopold » Mon Nov 28, 2011 1:41 am

Try adding some basic logging to stderr. We will capture it on the on the official server.
McLeopold
Contest Organizer
 
Posts: 262
Joined: Sun Sep 19, 2010 3:31 am

Re: Runs great locally but wrong on server

Postby KonaEarth » Mon Nov 28, 2011 2:29 am

> Try adding some basic logging to stderr. We will capture it on the on the official server.
That would be fantastic! The version running now should be logging to a text file called Debug.txt but I can easily change that to stderr. Is there some way I can capture the stderr myself or is this something you'll have to do manually?

EDIT: All output has been rerouted to stderr. Still works fine on my machine, compiled and tested fine on the server too. About 2.5 hours until the next run.

I set my debug output to verbose mode. For a stupid game with only one ant it won't say much. For a 1000 turn game with an entire army of ants, the output file may reach a meg or so. I tested it on my local server as follows:
python tools\playgame.py ... 2> debug.txt

EDIT 2: Works fine on the TCP server. No quite as kick-butt as I had hoped (there are some great AI's out there). At least my ants move around like they're supposed to. Of course that doesn't tell me much about the problem since my TCP code is compiled and run locally.
KonaEarth
Major
 
Posts: 33
Joined: Thu Nov 25, 2010 1:51 am

Re: Runs great locally but wrong on server

Postby carlos.guia » Wed Nov 30, 2011 5:26 pm

Have you tried your bot under a Linux system? You could install a free virtual machine such as VirtualBox and run an Ubuntu box to test it, maybe that will shoe the problem immediately. However, I just saw some of your replays, it is really weird it neither move nor times out. Also make sure your code does not depend on some preprocessor macro, not really sure what can be wrong.

Good luck.
carlos.guia
Lieutenant
 
Posts: 19
Joined: Mon Oct 31, 2011 11:19 pm

Re: Runs great locally but wrong on server

Postby KonaEarth » Fri Dec 02, 2011 11:14 pm

KonaEarth
Major
 
Posts: 33
Joined: Thu Nov 25, 2010 1:51 am

Re: Runs great locally but wrong on server

Postby strcat » Sat Dec 03, 2011 3:24 am

I understand how hard an obscure bug can be to track down and how frustrating it can be. However, it's really disrespectful to attack the contest organizers due to a bug in your code, even if they weren't able to help you (not everyone is a C/POSIX programmer). They have jobs or school to deal with, but they're still in the IRC channel all the time answering questions and helping people, and they're even working on new map generators.

The states that timeval uses time_t for seconds and suseconds_t for microseconds. They will vary across operating systems and architectures, as (time_t can even be a float).

Also, your code does give a compile-time warning with both clang and gcc. You just have to enable more warnings if you expect one for something like that (-Wall -Wextra -pedantic -Wconversion -Wstrict-overflow=5 is a good start, the naming of -Wall is as it basically just enables warnings that give annoying false positives).

(Note: All of the code used on the server is available in a , you can look at submission_test to see what your bot is tested on)
strcat
Cadet
 
Posts: 3
Joined: Tue Oct 25, 2011 5:06 am

Re: Runs great locally but wrong on server

Postby KonaEarth » Sat Dec 03, 2011 3:48 am

KonaEarth
Major
 
Posts: 33
Joined: Thu Nov 25, 2010 1:51 am

Next

Return to Starter Packages & Tools

Who is online

Users browsing this forum: No registered users and 2 guests

cron