PDA

View Full Version : Lab 3


Ylu
07-25-2015, 01:09 PM
Oh....what can I say about this lab than I found it horrible.

It took me days to figure out how to make the counting mechanism worked. The example in the book about the cow was not really helpful. I had to do internet research to trying and get some level of understanding but I was still confused. Only by accident did my animation start picking up the ring amount. Then I had to modify the ringdrop method I had created because it was part of the problem. Here I am trying to be a bit creative and it is stopping my Lab from properly functioning. I am sooo over the rings but unfortunately there is another lab with the same rings.

My main problem is the book which does not do a good job explaining the things that it needs to. I feel like it assumes that I already know Alice aspects and that it asks me to do certain things that it did not go over. I need descriptive examples( each part broken down) and not only information on what the chapters cover but on programming project subject contents. I'm doing this without a programming background so I need details and the book totally lacks it.

CodeMan
07-26-2015, 09:59 AM
If you ever need help just ask, im sure your not the only one with that question, and it will help others too.

shaolinkidd
07-27-2015, 04:24 PM
I am also finding the labs challenging due to no programming background. It looks like you are doing well though. I haven't gotten to Lab 3 yet so any insight you have will be appreciated.

smileysand
07-27-2015, 10:01 PM
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:)

chickentree
07-28-2015, 01:07 PM
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

Petit Suisse
07-28-2015, 01:27 PM
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

Don't you know a magician never tells!! Ts ts!

;)

Thanks for this, I wasn't aware of the Watch Window tool. I have yet to do lab 3 but sounds like it might be challenging.

Ylu
07-28-2015, 05:43 PM
Mark, I will lookup how to use the print method on youtube, might help me with my game. The watch variable function I am aware of and used in Lab 4.


You mentioned building strings. How is that done ?

MrMoke
07-28-2015, 07:12 PM
Look for the "strings" group in the World functions.

1) ["a" joined with "b"] to concatenate two strings, or more strings if you drag one into the "b".

2) ["what" as a string] converts things like numbers into a sting. You can drag into a say or into part of a join.

Also check out my reply to the recent diving penguin thread.;)

Petit Suisse
07-30-2015, 12:40 AM
Hey did you have to define a position somehow, or did you just put the rings close to the cone and use a proximity function? Just getting started on this now.

Petit Suisse
07-30-2015, 02:24 AM
Another question. How did you guys make it so the ring would stay solid? Right now it sort of goes through the cone, instead of being caught on it as a solid object.

chickentree
07-30-2015, 09:35 AM
Another question. How did you guys make it so the ring would stay solid? Right now it sort of goes through the cone, instead of being caught on it as a solid object.

All objects in Alice behave this way, there is no provision for making something solid, so you have to fake it. The easiest way I can think of would be to use Dummy objects set a dummy on the cone and have the ring move to it when it "lands" on the cone.

Hints:

Set the vehicle of the dummy object to the cone. This way if the cone moves you will not have to reposition all your dummy objects.
Name the dummy objects so that you can keep track of which dummy is paired with which ring.
The ring must move down from above the cone to look right. If you just move the ring to the dummy object from anywhere it will go through the cone.


Mark

Petit Suisse
07-30-2015, 10:33 PM
All objects in Alice behave this way, there is no provision for making something solid, so you have to fake it. The easiest way I can think of would be to use Dummy objects set a dummy on the cone and have the ring move to it when it "lands" on the cone.

Hints:

Set the vehicle of the dummy object to the cone. This way if the cone moves you will not have to reposition all your dummy objects.
Name the dummy objects so that you can keep track of which dummy is paired with which ring.
The ring must move down from above the cone to look right. If you just move the ring to the dummy object from anywhere it will go through the cone.


Mark

Thank you very much for your help and time Mark. You've been very good with us. With the deadline that is definitely something I want to try, however since it would be ok for the ring to go through the cone, I will keep it simple for now. I did try setting the rings vehicle to cone in one of my attempts (not quite the right effect hehe), but dummy will be something to look at later.

chickentree
08-02-2015, 12:30 PM
Thank you very much for your help and time Mark. You've been very good with us. With the deadline that is definitely something I want to try, however since it would be ok for the ring to go through the cone, I will keep it simple for now. I did try setting the rings vehicle to cone in one of my attempts (not quite the right effect hehe), but dummy will be something to look at later.

It is not the ring's vehicle you want to set to the cone. That would cause the ring to move whenever the cone does. You want to set the dummy object, which is basically your target for a ring on the cone, to the cone. So that if the cone moves during the movie, or you have to move it while building the movie, the dummy will still be in the correct position relative to the cone.

shaolinkidd
08-05-2015, 12:19 PM
I can get the cone to catch the ring but my program does not repeat after the ring is caught. Do you think you can help me with this? I've included my program.

chickentree
08-06-2015, 12:24 PM
I can get the cone to catch the ring but my program does not repeat after the ring is caught. Do you think you can help me with this? I've included my program.

I am not sure of the exact requirements for this project so I am shooting from the hip.
In order to drop another ring ask yourself what has to happen. In the general case this can be broken down into the following:
Initialize the movie
Set the items, variables etc to their initial values.
In a great many cases you can do this in the Alice IDE (while you are authoring the movie.)
Start the looping part.
Make sure things are initialized (objects in their proper place, variables have the correct values.) Remember the instructions will be repeated so the movie will probably not be in the same configuration when it starts through the loop on the second or subsequent runs.
Do the instructions you want to repeat.
In the general programming case one or more of these instructions will result in changes that will cause the loop to end. Alice’s interactive nature provides other options, like the one demonstrated in the attached movie.
Check the conditions to see if the loop is done
Continue with the rest of the program.

In general any loop whether a ‘for’ loop, a ‘while’ loop or some other more exotic type has to accomplish a couple of things. It must repeatedly perform the operations it was designed to do. And it must have a way to end when it has repeated ‘enough’ times.
In a lot of cases we know (or can calculate) how many times the loop will need to repeat and in these cases a ‘for’ loop is great. But what if we do not know how many times the operations must be repeated? In that case we need to do something different. This is where the ‘while’ loop comes in. The while loop uses a Boolean value (called a monitor) to determine whether to run the loop and if so when to stop. The key here is that this value (the monitor) must initially be true, or the instructions within the while loop will never be run, and some action must be capable of changing the monitor from true to false in order to end the loop. This action can be something within the loop that signals the the desired condition has been met or it can be an ‘external’ event that changes the value the monitor is using to tell whether to continue.
In the movie I have attached the loop is controlled by an outside event (clicking on the rabbit.)
Using the logic operators and object properties and functions you can make the continuation of your while loop depend on one or several conditions being true or false so you have a lot of control over whether the loop continues or not.
Be aware that if you are looping you may need to set things up each time the loop repeats. In your case, if the cone and ring are not moved back to their starting positions at the beginning of the loop, they will be wherever they were when the last loop ended.

Hope this helps.
Mark