hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Little Problem...

 
Reply to topic    hacker.org Forum Index » Wormageddon View previous topic
View next topic
Little Problem...
Author Message
DJSigmund



Joined: 19 Mar 2009
Posts: 6
Location: Munich

Post Little Problem... Reply with quote
Hey Folks,

I've got a little Problem with my Bot, for it ignores my instructions...

Could you just please check if the following line are OK?

Code:
class AristoWorm
{
public static int[][]$offsets ={{1,0},{0,-1},{-1,0},{0,1}};
public int think(int $dx, int $dy, int[][]$board, int $x, int $y, int $dir, int[][]$enemies)
   {


Code:
int $my_direction = $dir;


Code:
return $my_direction;
   }
}


I#M switching $my_direction multiple times and have some elementrs fo the wall avoider included, so I guess that something in the above lines is not right...

_________________
If you were MEANT to understand it, we wouldn't have called it code
Tue Mar 24, 2009 7:03 am View user's profile Send private message Visit poster's website ICQ Number
Karian



Joined: 09 Jan 2008
Posts: 75

Post Reply with quote
I just compiled the code you have given and it seems to compile fine. I can even play a bit with my_direction and get it to respond accordingly. Although maybe it is best to make your class public, then you can also run it natively.

Are you sure that your code really does what it should do? Be sure to check the console while running the simulator to see if you aren't generating any errors. Some commands (like print/println) aren't allowed in the simulator, and if your function fails, he will take a default direction.

If you want to generate output to the console, you have to check the run natively in the bot simulator (and make your class public). Then you can use prints to check if your code is really doing what you think it is, but don't forget to remove those while compiling the final version, because else, your bot will keep going to the right, because of the generated errors.
Tue Mar 24, 2009 9:16 am View user's profile Send private message
DJSigmund



Joined: 19 Mar 2009
Posts: 6
Location: Munich

Post Reply with quote
Thank you for the quick help, I'll try that later -->work Wink

_________________
If you were MEANT to understand it, we wouldn't have called it code
Tue Mar 24, 2009 10:00 am View user's profile Send private message Visit poster's website ICQ Number
Display posts from previous:    
Reply to topic    hacker.org Forum Index » Wormageddon All times are GMT
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.