It is currently Fri Apr 20, 2018 2:35 pm Advanced search

System.out

Random stuff about the contest, posts that don't fit in the other forums.

System.out

Postby MrMooh » Thu Feb 04, 2010 5:08 pm

I'd like to see what my bot is "thinking".
Now usually, I'd just add a few sysouts that show up during execution.
However, the Tron class starts up the AIs so they do not print to the same/any terminal.
Does anyone know how to circumvent this or am I just missing some really obvious thing?
MrMooh
Cadet
 
Posts: 8
Joined: Thu Feb 04, 2010 4:33 pm

Re: System.out

Postby amstan » Thu Feb 04, 2010 5:43 pm

If this is C++ you're talking about.

You can print at any time any status, however you might want to provide the bot input manually, since the tournament engine will give you errors if it doesn't expect that output.

What I have done, in my local makefile(that is ignored by the actual contest, compilation is done a different way) a define that sets DEBUG on. Then all over my code i have debug outputs that write to a file.
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: System.out

Postby MrMooh » Thu Feb 04, 2010 5:45 pm

I was actually talking about Java, I guess I should have mentioned that.
MrMooh
Cadet
 
Posts: 8
Joined: Thu Feb 04, 2010 4:33 pm

Re: System.out

Postby amstan » Thu Feb 04, 2010 5:46 pm

I repeat you can output at any time and write to files at any times.

Just make sure you don't submit your code with all those outputs because you will time out and you won't play any games.
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: System.out

Postby MrMooh » Thu Feb 04, 2010 6:00 pm

Well, the problem is that I can't.
I use 'java -jar engine/Tron.jar maps/empty-room.txt "java -jar example_bots/WallHugger.jar" "java MyTronBot"' to start the game.
Now Tron.jar is running in the terminal and prints its outputs to it but it seems that since the Comm class uses Runtime.getRuntime().exec(foo) to start the bots, those bots don't send any output to the terminal in which Tron.jar is running. They are executed in the background.
So how can I get the bots to use the same terminal?

I use Linux by the way.
MrMooh
Cadet
 
Posts: 8
Joined: Thu Feb 04, 2010 4:33 pm

Re: System.out

Postby amstan » Thu Feb 04, 2010 7:13 pm

Short answer is that you can't.

Output separately to another file all your debug info.
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: System.out

Postby smf68 » Fri Feb 05, 2010 10:39 am

You can use System.err.print() to debug while running locally, it won't affect the test engine. I'd disable it when uploading your bot, though.
smf68
Lieutenant
 
Posts: 11
Joined: Thu Feb 04, 2010 11:24 pm


Return to Misc

Who is online

Users browsing this forum: No registered users and 1 guest

cron