[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/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 - Bot crashes on server, runs fine local

It is currently Thu Sep 20, 2018 9:35 am Advanced search

Bot crashes on server, runs fine local

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

Bot crashes on server, runs fine local

Postby Speed » Fri Nov 18, 2011 8:09 pm

Speed
Lieutenant
 
Posts: 12
Joined: Tue Nov 15, 2011 11:07 pm

Re: Bot crashes on server, runs fine local

Postby Speed » Sun Nov 20, 2011 6:08 pm

Any ideas how to solve this?
I am just uploading older revisions from SVN to check where exactly the error starts, but I have to wait 5 hours for my Bot to play its first match.
So any hint where to look would be nice.
Thanks
Speed
Lieutenant
 
Posts: 12
Joined: Tue Nov 15, 2011 11:07 pm

Re: Bot crashes on server, runs fine local

Postby KonaEarth » Mon Nov 21, 2011 3:39 am

Frustrating isn't it. I wish I could offer helpful advice. It was surprising to me how much support there is for interpreted languages such as Python and Java with relatively little support for C/C++. Then I remembered that the contest is run by university students and not professional programmers. Interpreted languages are more common in a learning environment such as a university. Still, I wish compiled languages were supported a bit better. After all, all those students have to become professionals some day.

Can you find a Linux box or maybe install Cygwin? Chances are good that your problem is platform related rather than specifically the game servers. You'll probably be able to duplicate your problem if you run on Linux rather than Windows.
KonaEarth
Major
 
Posts: 33
Joined: Thu Nov 25, 2010 1:51 am

Re: Bot crashes on server, runs fine local

Postby Speed » Mon Nov 21, 2011 6:02 pm

Exactly, frustating.

On Windows I am compiling with cygwin. Which version of gcc / g++ does run on the server?
I tried it on Ubuntu with g++, I can feed the input from the game which has crashed into it, and it gives me the output from my Bot. Seems all fine.

Seems like I have to blindly guess wich changes did cause the error and upload/check each code snippet (which will maybe take days).
You say it, its frustrating.

OT: I am a student from Germany, TU Harburg. We learned C and C++ and a little bit of Java. And Matlab of course :D
Speed
Lieutenant
 
Posts: 12
Joined: Tue Nov 15, 2011 11:07 pm

Re: Bot crashes on server, runs fine local

Postby holekezter » Mon Nov 21, 2011 7:45 pm

I have same problem with C# (i am using Visual Studio, maybe problem with Mono, I guess test server using Mono)
Sometimes my bot crashed, and i made a small utility to emulate game by input logs and run my bot with it, and there is no any crash.
holekezter
Cadet
 
Posts: 4
Joined: Wed Oct 26, 2011 8:49 pm

Re: Bot crashes on server, runs fine local

Postby Speed » Mon Nov 21, 2011 10:59 pm

Speed
Lieutenant
 
Posts: 12
Joined: Tue Nov 15, 2011 11:07 pm

Re: Bot crashes on server, runs fine local

Postby BenJackson » Tue Nov 22, 2011 12:11 am

Here are some comments on your code:

You should never put "using namespace ..." in a header file. That forces all who include it to use that namespace. Use fully qualified names like 'std::vector' in the header. In the implementation file you can put a "using namespace" statement.

Your default constructor doesn't initialize any members of the structure. So 'CTask foo;' gives you a foo filled with garbage. Your default constructor should populate it somehow with default values.

You have an explicit copy constructor (for use when you do 'CTask foo(bar)') but no assignment operator (for use when you do 'CTask foo = bar'). Your will get an implicit copy constructor which does a member-wise copy which happens to match your current copy constructor but it's better to be explicit. Any copying done by the queue (due to memory management) will also use the implicit assignment operator and not your copy constructor. You can google this and find lots on this topic.

Just as a note, the value of the expression '(priority < task.priority)' is already either 1 or 0, so you can simply 'return priority < task.priority'

Where you have 'newTask = tasklist.front()' you are copying into newTask. Since you don't pop until later you don't need to copy, you can say 'CTask &newTask = tasklist.front()' and newTask will be a reference to the CTask at the front of the queue. It is valid until you do 'tasklist.pop_front()'.

Other than the fact that your default constructor does not initialize the structure I don't see any cause for crashing in the code you posted. Given that you don't use the garbage newTask without assigning it I don't see that it would lead to a crash. If you use it elsewhere it may, though.
BenJackson
Colonel
 
Posts: 94
Joined: Sat Oct 29, 2011 4:16 am

Re: Bot crashes on server, runs fine local

Postby Speed » Thu Nov 24, 2011 9:12 pm

Yay!!
I found the bug in my code, and its nothing I changend.

In the Code I go throught the tasklist, compare each element between the second and the last with some rules and delete it if it matches the rules. The bug was, that I didnt ended at the last, but tried the one after the last too. It seems like on my computer there was something at this space, which never met the rule, but on the server it did. So I tried to delete memory which wasnt mine...

@BenJackson: Thank you for your optimisation things... I changed the namespace (which was idiotic I admit), and the < operator. Do I understand it correctly, that explicitly define the copyconstructor is only necesarry if I use references/pointer in my class? If I understand it wrong, what do I have to google to understand the problem?

Thanks for all who tried to help :)
Speed
Lieutenant
 
Posts: 12
Joined: Tue Nov 15, 2011 11:07 pm

Re: Bot crashes on server, runs fine local

Postby amstan » Wed Nov 30, 2011 1:59 pm

Alexandru M. Stan
Contest Organizer
User avatar
amstan
Contest Organizer
 
Posts: 691
Joined: Sun Jan 31, 2010 4:02 am
Location: Stoney Creek, Ontario

Re: Bot crashes on server, runs fine local

Postby KonaEarth » Wed Nov 30, 2011 4:43 pm

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


Return to Starter Packages & Tools

Who is online

Users browsing this forum: No registered users and 1 guest

cron