PDA

View Full Version : How do I find the objects near me? Is there a piece of wall?


cayhorstmann
09-21-2009, 08:03 AM
I am trying to translate a Karel exercise into an Alice3/Java world, and I need to have some way of testing for obstruction/looking for markers. Netbeans code completion gives me the names of methods that I might call, but unfortunately no javadoc, and it has been rather slow going trying to discover methods that way. Is that javadoc available somewhere?

Also, a really silly question. Is there a piece of wall in the gallery? I couldn't seem to find one. With Java, it is an easy matter to write a loop that places a bunch of pieces together, so I am much more interested in building blocks than a whole house or maze.

Thanks,

Cay

cayhorstmann
09-28-2009, 10:15 AM
I implemented a version of Karel in Alice 3, and it works great. See http://www.horstmann.com/sjsu/cs46a/lab6/ for the code. This is something that would have been incredibly tedious in Alice 2, but in Alice 3 with Netbeans, it is pretty straighforward once you figure out your quaternions :-)

No, students don't need to know anything about quaternions. They just use the robot just like they would with Karel. Why bother? 3D is prettier, and more importantly, I already use Alice and don't want to introduce yet another piece of software.

http://www.horstmann.com/sjsu/cs46a/lab6/maze.png

lanceA
09-28-2009, 03:56 PM
What a great exercise for Alice 3.0!! Thanks for sharing.:)

cayhorstmann
09-28-2009, 11:55 PM
It really shows off one of the great strengths of programming Alice 3 in Java. With Alice 2, I would not have had the energy to make those maze walls. Or the toasters that mark the path of the drunkard :-)

I blogged about it on java.net: http://weblogs.java.net/blog/cayhorstmann/archive/2009/09/28/alice-3-cs1-and-quaternions