Any Debugging tips?

AI discussion, ideas, and SDK help.
Post Reply
User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Any Debugging tips?

Post by SunTzu » Fri Jul 20, 2007 1:12 pm

Does anybody have any debugging tips they'd like to share?

I'm currently using debug() to write in log.txt where the bot is running in the code and what certain variables are.

User avatar
guest
Luxer
Posts: 189
Joined: Fri Dec 17, 2004 9:17 pm
Location: Southern NH

Post by guest » Fri Jul 20, 2007 1:30 pm

I used a window.

Create a JFrame add a text view etc. Maybe even a pause button. Call Show().

http://sillysoft.net/forums/viewtopic.p ... ight=frame

User avatar
Bertrand
Reaper Creator
Posts: 568
Joined: Mon Nov 28, 2005 4:35 pm
Location: Montreal

Post by Bertrand » Fri Jul 20, 2007 6:36 pm

Real-time debugging is the best way to debug.

http://sillysoft.net/wiki/?real%20debugging

User avatar
RandomGuy
Lux Veteran
Posts: 1463
Joined: Mon Mar 05, 2007 12:02 am
Location: Central American Jungle
Contact:

Post by RandomGuy » Sat Jul 21, 2007 11:45 am

Bertrand wrote:Real-time debugging is the best way to debug.

http://sillysoft.net/wiki/?real%20debugging
QFT

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Mon Jul 23, 2007 9:19 am

Thanks guys, those are real time-savers!

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Mon Jul 23, 2007 1:13 pm

Is there an easy way to see what the bot is doing besides manually stepping through the code via NetBeans?

I'm looking to fix a bug that occurs very infrequently, and I don't want to simply step through until it occurs.

I usually just let Lux automatically restart the game, and then come back in an hour or so to see if the bot has gotten itself into an endless loop.

User avatar
dustin
Lux Creator
Lux Creator
Posts: 10998
Joined: Thu May 15, 2003 2:01 am
Location: Cascadia
Contact:

Post by dustin » Mon Jul 23, 2007 4:52 pm

When you're running the app inside the debugger, there should be a 'pause' button. So you can leave it running, and then 'pause' it once it's inside the infinite loop, and the debugger should show you where in the code it's stuck.

User avatar
guest
Luxer
Posts: 189
Joined: Fri Dec 17, 2004 9:17 pm
Location: Southern NH

Post by guest » Mon Jul 23, 2007 5:59 pm

Or put code in to detect the loop and display a dialog, maybe beep to get your attention, them make use of the pause. That way the machine waits for the dialog doing nothing instead of running full tilt in some loop.

User avatar
SunTzu
Lux Cartographer
Posts: 1586
Joined: Sat Jan 14, 2006 1:48 am
Location: Maryland

Post by SunTzu » Tue Jul 24, 2007 10:44 am

Thanks for the tips everybody!

Post Reply

Who is online

Users browsing this forum: No registered users and 51 guests