It is currently Tue Jan 23, 2018 8:12 am Advanced search

Constant crashed with Ruby bot

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

Constant crashed with Ruby bot

Postby unsleepable » Fri Nov 26, 2010 11:29 am

Hi-

I'm in the contest with a bot programmed in Ruby. For some reason, the BOT is crashing in half the games and I'm afraid I don't know why.

I've tested the BOT both locally with all example bots and maps, and in the tcp server, and the BOT is always running perfectly. It only fails in the servers of the contest.

I've been looking into this for days now… I have even added a timer to exit early and avoid to give a time-out, and of course error handling, but this has not made any difference. I really don't know what else to do.

Is there any way to obtain more information on what's happening in production? I'm starting to think it could be something particular to the Ruby version used in production, or the servers. Does anyone know what is the exact Ruby version used? (Although I've tested with both 1.8.7 and 1.9.2, without finding any problems).

Any help would be greatly appreciated.

Thanks
unsleepable
Cadet
 
Posts: 6
Joined: Thu Nov 25, 2010 2:32 pm

Re: Constant crashed with Ruby bot

Postby FrankyRP » Fri Nov 26, 2010 5:58 pm

FrankyRP
Cadet
 
Posts: 7
Joined: Sat Oct 30, 2010 11:17 am
Location: Paris, France

Re: Constant crashed with Ruby bot

Postby unsleepable » Fri Nov 26, 2010 6:15 pm

Hi- Thanks. This is the one I based my BOT on…
unsleepable
Cadet
 
Posts: 6
Joined: Thu Nov 25, 2010 2:32 pm

Re: Constant crashed with Ruby bot

Postby unsleepable » Fri Nov 26, 2010 7:23 pm

I've also used this Javascript code to run the game locally: http://ai-contest.com/forum/viewtopic.p ... 790&p=7069

My BOT is working fine. So it must be something else. Can someone help about this?
unsleepable
Cadet
 
Posts: 6
Joined: Thu Nov 25, 2010 2:32 pm

Re: Constant crashed with Ruby bot

Postby narnach » Sun Nov 28, 2010 9:58 am

My bot is built in Ruby as well and it works like a charm.

When debugging local games and TCP games, when my bot crashes it is usually due to new code trying to send more ships than are available on the planet or trying to send them from enemy planets or illegal moves like that.

In the beginning my bot sometimes crashed when something would raise an error (using the wrong method or a typo in a variable name), but my main loop now rescues errors and ends the turn.
Because my bot has an ordered list of strategies to try, each with their own checks for when they should kick in or not, it is possible for the bot to play on the first couple of strategies and raise/rescue internal errors on the last strategies. The bot does not crash, but it may only trigger 80% of the strategies. Sometimes that is enough to win instead of losing due to a crash.

If you can not reproduce the error it can be either due to the Ruby version used on the server (1.9.0 instead of 1.9.2 which is the 'stable' 1.9 version, and there are probably subtle syntax/library API differences) or your bot triggering sections of the code on the live server that you have not triggered locally.

I found the best way to debug my bots is to play them locally in a big tournament, with the submission candidate playing 100+ matches against old versions of itself and against different bots I'm working on. This should expose it to enough different opponents to trigger 99% of the code paths to check for errors. It also lets you know if the bot is better or worse than your other bots.

And don't forget to add a debug parameter to your bot so you can analyze game state, move motivations and stack traces after the match. I know this helped me out a lot.

This may not be in time for the main contest, but perhaps it helps you for future contests or for playing on the TCP server.
narnach
Cadet
 
Posts: 6
Joined: Sat Nov 13, 2010 1:56 pm


Return to Technical Issues

Who is online

Users browsing this forum: No registered users and 4 guests

cron