Thread: Lab 3
View Single Post
Super Moderator
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default 07-28-2015, 01:07 PM

Originally Posted by smileysand View Post
I am not sure what I did, but I got it to work. I am sure I will be counted off for something but I got the end result. lol
It is imperative in Alice, Programming in general, most course work and life to figure out why something worked. If you assume you can't understand it or it's magic you will be correct. That is to say, you will not understand it and it will continue to be magic. (From one of Robert Heinlein's Characters: Any sufficiently advanced technology is indistinguishable from magic.)
Alice gives you a couple of things to help you understand what is happening. One is at the bottom of the IDE window. Alice has a Print method. This is the oldest troubleshooting technique known to programmers. Using print you can, while running the program, display the value of variables. Everything from loop indexes to the position of an object's subparts or user created variables can be printed while the program is running. It is even possible to build strings so that you can add some context to the printout and to calculate things you are not necessarily using in the movie, like the distance from an Object's arm to the ball. The printing is done below the running movie so make sure the movie is not taking up the full screen or you will not see the print outs.

The other tool Alice gives you is the Watch window. Right clicking on an object's property or variable will present you with options, one of which is "Watch this property (or variable)." Watch creates a window to the right of the running movie showing the name of the variables or properties you have decided to watch as well as their current value.

Either of these tools can give you a view into what your program is doing thus aiding your understanding of why it behaves the way it does.


Mark Henwood
Reply With Quote