Debug AI using XCode
Debug AI using XCode
Anyone interested in knowing how to debug a LuxAgent using XCode?
Nothing like walking through pickCountry to realize why Chess is confusing your bot.
Nothing like walking through pickCountry to realize why Chess is confusing your bot.
Well since I'm not getting any responses i'll post what I did.
In the project add a new executable with path "/Applications/Lux.app"
Set the target Java Archive Settings to Class Hierarchy
copy class file <project>.class from
<project dir>/build/<project>.build/<project>.build/JavaClasses
to
/Library/Application\ Support/Lux/Agents
Debug away.
It wiped my preferences the first time I ran it. I think changing the working directory in the executable settings fixed it.
Unsolved issues:
It will step into BoardHelper function but the source is misaligned, same thing happened to the class file when copied the class file from <project dir>
In the project add a new executable with path "/Applications/Lux.app"
Set the target Java Archive Settings to Class Hierarchy
copy class file <project>.class from
<project dir>/build/<project>.build/<project>.build/JavaClasses
to
/Library/Application\ Support/Lux/Agents
Debug away.
It wiped my preferences the first time I ran it. I think changing the working directory in the executable settings fixed it.
Unsolved issues:
It will step into BoardHelper function but the source is misaligned, same thing happened to the class file when copied the class file from <project dir>
Cool, thanks for the info. There were some questions about how to do this a while ago.
Sometimes the xCode java debugger will not be lined up properly with the source when I use it. It's fecking annoying. I think Apple needs to spend a little more time on xCode's java support. Although if you find a solution I'd love to here it.
And why not register for the forums so we know who the lovely new agent daddy is?
Sometimes the xCode java debugger will not be lined up properly with the source when I use it. It's fecking annoying. I think Apple needs to spend a little more time on xCode's java support. Although if you find a solution I'd love to here it.
And why not register for the forums so we know who the lovely new agent daddy is?
Re: Debug AI
THANK YOU!guest wrote:Anyone interested in knowing how to debug a LuxAgent using XCode?
Nothing like walking through pickCountry to realize why Chess is confusing your bot.
THANK YOU!
THANK YOU!
*maniacal cackle*
*rubs hands in glee*
I've been trying to get this working using eclipse but have been unsuccessful in that regard.
rip
Your welcome.
Though I doubt the other will thank me in a few days/weeks.
How many lines of code is your AI? Though yours may be smaller if your using SmartAgentBase or making a derivative of cluster. I may end up grabbing parts of cluster well see when I get that far.
If I had to guess I'd say I was a sixth of the way done with my first version. Then theres all the tweaking to get it to behave how I want it to.
Though I doubt the other will thank me in a few days/weeks.
How many lines of code is your AI? Though yours may be smaller if your using SmartAgentBase or making a derivative of cluster. I may end up grabbing parts of cluster well see when I get that far.
If I had to guess I'd say I was a sixth of the way done with my first version. Then theres all the tweaking to get it to behave how I want it to.
It can be amazing sometimes how even though I know exactly what it is going to do I will be powerless to prevent it from doing it to me . It won't start to get unpredictable till later on in development when it has more choices as to what to do.wc -l /Users/<name removed to protect the guilty>/Projects/<name removed to protect the inocent>/*.java
742 total
*more maniacal laughter*guest wrote:Though I doubt the other will thank me in a few days/weeks.
Currently, Ravitar is 3890 (wc -l), however 20% of that is probably comments. So around 3200 lines I'd say.How many lines of code is your AI?
But remember, Ravitar is a tech test bed. Goldy, which implements only Ravitar's "biggest" algorhythm (correctly, *heh*), is half that.
rip
rats.
Ok, I am defeated by the interface. Sadly, I can't figure out what is supposed to happen. I did what you suggested, but what I expect to happen (Lux to start when I click the 'Run and Debug' icon) doesn't. Everything compiles, I get 'Succeeded', and then nothing.
Are you on skype?
What do I need to do to get Lux to launch from XCode, or do I launch Lux externally? (that doesn't seem to get me to the debugger though)
Help?
rip
Are you on skype?
What do I need to do to get Lux to launch from XCode, or do I launch Lux externally? (that doesn't seem to get me to the debugger though)
Help?
rip
- Preacherman
- Semiholy Priest
- Posts: 4496
- Joined: Tue Feb 24, 2004 3:52 am
- Location: Sweden (capital of Denmark, an island in Norway, southern Europe)
- Contact:
Nef is currently about 1400 lines. She no longer extends SmartAgentBase (some functions have been lifted and modified), and v2 is about 80% complete.
The problem is that the standard bots were built at a time where there were no custom maps. They play well on Classic, but if you really want to see how smart your bot is, put her in Hex Cubed, Snakes & Ladders, ScaLuxtric, or other maps that have non-standard playing styles...
The problem is that the standard bots were built at a time where there were no custom maps. They play well on Classic, but if you really want to see how smart your bot is, put her in Hex Cubed, Snakes & Ladders, ScaLuxtric, or other maps that have non-standard playing styles...
(MacOS X.3.7, XCode 1.1 Core 300)
Ok so this is what I did.
Started XCode.
File->New Project...
-- Empty Project -> Next
---- Project Name: ZRavitar
---- Project Location: ~/Bots/ZRavitar
-- --> Finish
In project window 'ZRavitar',
-- Ctrl+Click Executables
---- -> Add -> New Custom Executable
------ Executable Name: Lux
------ Executable Path: /Applications/Lux.app
------ Add To Project: ZRavitar
---- --> Finish
In project window 'ZRavitar',
-- Ctrl+Click Targets
---- -> Add -> New Target
------ Java Package
------ -> Next
------ Target Name: Lux
------ Ad To Project: ZRavitar
---- -> Finish
In project window 'ZRavitar',
-- Ctrl+Click ZRavitar
---- -> Add -> Existing Files
{navigated to, added all the necessary files, including Ravitar.java)
Debug -> Show Debugger
Debug - ZRavitar (Lux)
-- Build and Debug
(Shows... 'Building' and 'Succeeded', then 'Building...' goes away)
There is a simlink in my Library/.../Agents/ that points at the built Ravitar.class
So what did I miss.
TIA,
rip
Ok so this is what I did.
Started XCode.
File->New Project...
-- Empty Project -> Next
---- Project Name: ZRavitar
---- Project Location: ~/Bots/ZRavitar
-- --> Finish
In project window 'ZRavitar',
-- Ctrl+Click Executables
---- -> Add -> New Custom Executable
------ Executable Name: Lux
------ Executable Path: /Applications/Lux.app
------ Add To Project: ZRavitar
---- --> Finish
In project window 'ZRavitar',
-- Ctrl+Click Targets
---- -> Add -> New Target
------ Java Package
------ -> Next
------ Target Name: Lux
------ Ad To Project: ZRavitar
---- -> Finish
In project window 'ZRavitar',
-- Ctrl+Click ZRavitar
---- -> Add -> Existing Files
{navigated to, added all the necessary files, including Ravitar.java)
Debug -> Show Debugger
Debug - ZRavitar (Lux)
-- Build and Debug
(Shows... 'Building' and 'Succeeded', then 'Building...' goes away)
There is a simlink in my Library/.../Agents/ that points at the built Ravitar.class
So what did I miss.
TIA,
rip
Well that way you only have one executable option.
I created my project as Java Tool
And I Set the java compiler to target v1.4
here is how I have my executable set up, don't know if it will help.
http://blazemkiv.dyndns.org/Files/executable.tiff
I created my project as Java Tool
And I Set the java compiler to target v1.4
here is how I have my executable set up, don't know if it will help.
http://blazemkiv.dyndns.org/Files/executable.tiff
I've now upgraded Xcode to 1.5, and verified that I'm using Java 1.4.2 update 1.guest wrote:I'm using Xcode 1.5
When I try and launch the debugger, I get:
Run session cancelled: No launchable executable present to run.
Please run through every single step. Assume I'm not a regular user of the XCode development tools.
rip
I'll walk through what I did, step by step.
1. Create new Project type:Java Tool
2. Add SDK files to project
3. edited Project.java so "class Project implememnts LuxAgent"
3. built
4. Tested to see if Lux would load the jar from the Agents directory
5. Added new executable "Lux" with path "/Applications/Lux.app"
6. Changed Java Archiver to output class heirarchy.
7. built.
8. Copied Project.class from Project/Build to Agents directory.
9. Launched Lux agent appeared in list.
10. Debugged source file and code were out of alignment
11. Copied Project/build/Project.build/Project.build/JavaClasses to Agents directory
12. Debugged and source was lined up.
13. Added Shell Script Files to Target to cp class files to Agents dir.
1. Create new Project type:Java Tool
2. Add SDK files to project
3. edited Project.java so "class Project implememnts LuxAgent"
3. built
4. Tested to see if Lux would load the jar from the Agents directory
5. Added new executable "Lux" with path "/Applications/Lux.app"
6. Changed Java Archiver to output class heirarchy.
7. built.
8. Copied Project.class from Project/Build to Agents directory.
9. Launched Lux agent appeared in list.
10. Debugged source file and code were out of alignment
11. Copied Project/build/Project.build/Project.build/JavaClasses to Agents directory
12. Debugged and source was lined up.
13. Added Shell Script Files to Target to cp class files to Agents dir.
Sorry, but we're still making assumptions about what I know.
Here's a hint: I am a real-time C programmer with a background in operating systems. My secondary skills are assembler for the Arc Core (a configurable processor. No fixed instruction set.). I'm also an ex tech support weeny for Wind River Systems, otherwise known as 'Tech Support for Rocket Scientists'. NASA, ESA, people like that.
I. am. not. a. Java. Programmer. I can fake it, izall.
I. am. not. an. XCode. User. It seems I can't fake that, at all.
1. Create new Project type:Java Tool
--- A. Launch XCode, ver. 1.5
--- B. File->New Project...
--- C. Selected Java Tool from the list, clicked next.
--- D. Set 'Project Name' to MyProj
--- E. Set 'Project Directory' to ~/Bots/MyProj
2. Add SDK files to project
--- A. In Groups&Files, ctrl+clicked on MyProj and then Add->Existing Files...
--- B. Selected the LuxAgentSDK/sources directory
2.1 Added existing bot code, try one
--- A. Opened existing bot code and hilite/copy
--- B. Opened MyProj.java and hilite/paste
--- C. Changed project name from existing (Ravitar) to MyProj
2.2 Added existing bot code, try two
--- A. Opened existing bot code and hilite/copy
--- B. Opened MyProj.java and inserted all code just after 'public static void main...' closure brace
3. edited Project.java so "class Project implememnts LuxAgent"
--- A. At the moment, MyProj.java is 'class MyProj extends SmartAgentBase'. SAB in turns 'implements LuxAgent'. That should work, right, if I understand that much. but keep in mind: I am not a java programmer.
3. built
4. Tested to see if Lux would load the jar from the Agents directory
(I'm assuming it didn't? or did it?)
5. Added new executable "Lux" with path "/Applications/Lux.app"
--- In Files&Groups, ctrl+click and Add->New Custom Executable
--- Set Executable Name: Lux
--- Set Executable Path: /Applications/Lux.app
--- clicked Finish.
--- double-clicked 'Lux' in list of executables
--- changed settings to agree with the tiff image that you posted, link elsewhere in this thread.
6. Changed Java Archiver to output class heirarchy.
--- How?
??? Double-clicked on the Targets entry 'MyProj'
??? Clicked 'Java Archive Settings'
??? Set Product Type to 'Class heirarchy'
7. built.
--- Clicked on Targets entry 'MyProj'
--- Clicked the Build icon in the toolbar
8. Copied Project.class from Project/Build to Agents directory.
9. Launched Lux agent appeared in list.
--- HOW? From inside Xcode? From the finder?
if launched from Finder, MyProj is available, but no break points are hit.
if attempted from XCode, (Build&Go, Build&Debug, etc) I just get 'Debug session canceled: no launchable executable present to debug'. The executable 'Lux' has a blue bullet next to it, MyProj is the selected Target.
So did I screw something above up? What have we missed?
rip
Here's a hint: I am a real-time C programmer with a background in operating systems. My secondary skills are assembler for the Arc Core (a configurable processor. No fixed instruction set.). I'm also an ex tech support weeny for Wind River Systems, otherwise known as 'Tech Support for Rocket Scientists'. NASA, ESA, people like that.
I. am. not. a. Java. Programmer. I can fake it, izall.
I. am. not. an. XCode. User. It seems I can't fake that, at all.
1. Create new Project type:Java Tool
--- A. Launch XCode, ver. 1.5
--- B. File->New Project...
--- C. Selected Java Tool from the list, clicked next.
--- D. Set 'Project Name' to MyProj
--- E. Set 'Project Directory' to ~/Bots/MyProj
2. Add SDK files to project
--- A. In Groups&Files, ctrl+clicked on MyProj and then Add->Existing Files...
--- B. Selected the LuxAgentSDK/sources directory
2.1 Added existing bot code, try one
--- A. Opened existing bot code and hilite/copy
--- B. Opened MyProj.java and hilite/paste
--- C. Changed project name from existing (Ravitar) to MyProj
2.2 Added existing bot code, try two
--- A. Opened existing bot code and hilite/copy
--- B. Opened MyProj.java and inserted all code just after 'public static void main...' closure brace
3. edited Project.java so "class Project implememnts LuxAgent"
--- A. At the moment, MyProj.java is 'class MyProj extends SmartAgentBase'. SAB in turns 'implements LuxAgent'. That should work, right, if I understand that much. but keep in mind: I am not a java programmer.
3. built
4. Tested to see if Lux would load the jar from the Agents directory
(I'm assuming it didn't? or did it?)
5. Added new executable "Lux" with path "/Applications/Lux.app"
--- In Files&Groups, ctrl+click and Add->New Custom Executable
--- Set Executable Name: Lux
--- Set Executable Path: /Applications/Lux.app
--- clicked Finish.
--- double-clicked 'Lux' in list of executables
--- changed settings to agree with the tiff image that you posted, link elsewhere in this thread.
6. Changed Java Archiver to output class heirarchy.
--- How?
??? Double-clicked on the Targets entry 'MyProj'
??? Clicked 'Java Archive Settings'
??? Set Product Type to 'Class heirarchy'
7. built.
--- Clicked on Targets entry 'MyProj'
--- Clicked the Build icon in the toolbar
8. Copied Project.class from Project/Build to Agents directory.
9. Launched Lux agent appeared in list.
--- HOW? From inside Xcode? From the finder?
if launched from Finder, MyProj is available, but no break points are hit.
if attempted from XCode, (Build&Go, Build&Debug, etc) I just get 'Debug session canceled: no launchable executable present to debug'. The executable 'Lux' has a blue bullet next to it, MyProj is the selected Target.
So did I screw something above up? What have we missed?
rip
Ok.. so /that/ is what is supposed to happen.guest wrote:I just updated to 4.4 and now it won't debug for me either. I was using 3.8 or something.
The package has changed somewhat and its confusing the debugger use this path instead of /Applications/Lux.app
/Applications/Lux.app/Contents/MacOS/LuxDelux
queue maniacal laughter.
*cackle*
Thanks! And I mean that. Of course, everyone else on this board probably won't be thanking you :>
rip
Who is online
Users browsing this forum: No registered users and 50 guests