Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Chapter 7 Exercise 4 Lock Combination
Old
rshoe
Junior Member
 
Status: Offline
Posts: 12
Join Date: Sep 2013
Default Chapter 7 Exercise 4 Lock Combination - 10-02-2013, 12:37 PM

I was wondering if anyone has completed the lock combination in chapter seven. I could use some help looping the dial on the lock. I think there is some type of loop formula you have to use to set the combination. I have looked at some examples of locks and they do not show how to loop the lock or they manually set the lock. If anyone has done this I would appreciate any help.

Thank you,
Randy
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default 10-08-2013, 10:15 AM

Quote:
Originally Posted by rshoe View Post
I was wondering if anyone has completed the lock combination in chapter seven. I could use some help looping the dial on the lock. I think there is some type of loop formula you have to use to set the combination. I have looked at some examples of locks and they do not show how to loop the lock or they manually set the lock. If anyone has done this I would appreciate any help.

Thank you,
Randy
Do you have the 4 class level methods working?
Please attach your movie so I can see where you are.


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
Lock combo
Old
rshoe
Junior Member
 
Status: Offline
Posts: 12
Join Date: Sep 2013
Default Lock combo - 10-08-2013, 11:06 AM

Mark:

I think I found the solution but I not sure. I have uploaded the code. Let me know what you think.

Also have you worked with the Monty game Project in chapter 9. I have looked all over the web to find some clue on how to even start coding the game. If you have any type of solution or where I can find out more information please let me know.

Thanks,
Randy
Attached Files
File Type: a2w RS714.a2w (216.7 KB, 25 views)
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default 10-08-2013, 05:23 PM

Quote:
Originally Posted by rshoe View Post
Mark:

I think I found the solution but I not sure. I have uploaded the code. Let me know what you think.

Also have you worked with the Monty game Project in chapter 9. I have looked all over the web to find some clue on how to even start coding the game. If you have any type of solution or where I can find out more information please let me know.

Thanks,
Randy
Hi Randy
Lets start at the beginning.
1) It works that's great!
2) I would get rid of the do together blocks (move the instructions out of them and delete them.) While the lock seems to work as is, what you are telling Alice to do is to turn one revolution left and 9 numbers right at the same time. The other loop is simular except you are making 3 revs instead of one and I believe the the last should be rightOne not leftOne.
3) You don't need the loop for a count of 1. Looping once is the same as just calling the instruction.
4) Personal opinion: I would add at least a short wait between the revolution and moving to the number. I would probably also make the left/right one a little faster.

Over all I think you did an excellent job.
Mark


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
Monty
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default Monty - 10-08-2013, 05:32 PM

Quote:
Originally Posted by rshoe View Post
Mark:

I think I found the solution but I not sure. I have uploaded the code. Let me know what you think.

Also have you worked with the Monty game Project in chapter 9. I have looked all over the web to find some clue on how to even start coding the game. If you have any type of solution or where I can find out more information please let me know.

Thanks,
Randy
Hi Randy,
Looking at the Monty game I need to know where you are having a problem. It seems pretty straight forward especially as you are not required to keep track of the results in Alice. Just run Alice and record the results. If you name the door objects something like carDoor, monkey1Door, monkey2Door and then attache the prize objects to each door (remember the vehicle method?) then when the door moves so will the "prize" and so the swap should be easy.

Mark


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
The Monty Game
Old
rshoe
Junior Member
 
Status: Offline
Posts: 12
Join Date: Sep 2013
Default The Monty Game - 10-08-2013, 07:15 PM

Mark:

Thanks for the information on the combo lock. I will look at it and make the changes..

As far as the Monty Game - I have made a list containing the three doors, and I set the car and the two monkeys to the doors as vehicle. I have made a method called swap with two doors as parameters. I'm not sure how to swap the doors and move them 2.5 meters in opposite direction with out moving them off the screen. I am having trouble starting this.

The book reads: "Use a method called swap that takes two doors as parameters. Swap the two doors by having them move 2.5 meters in opposite directions. Important: Two doors should swap only if they are different ( a door cannot swap places with itself).

Thank you for all your help.
Randy
   
Reply With Quote
Setup and using dummies.
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default Setup and using dummies. - 10-11-2013, 11:18 AM

Quote:
Originally Posted by rshoe View Post
Mark:

Thanks for the information on the combo lock. I will look at it and make the changes..

As far as the Monty Game - I have made a list containing the three doors, and I set the car and the two monkeys to the doors as vehicle. I have made a method called swap with two doors as parameters. I'm not sure how to swap the doors and move them 2.5 meters in opposite direction with out moving them off the screen. I am having trouble starting this.

The book reads: "Use a method called swap that takes two doors as parameters. Swap the two doors by having them move 2.5 meters in opposite directions. Important: Two doors should swap only if they are different ( a door cannot swap places with itself).

Thank you for all your help.
Randy
Sorry for the delay in answering.
The short answer is you don't because the 2.5 meters will only work if the doors are (I am assuming) next to each other and if they are aligned exactly. This means they are not on an angle and one is not in front or behind another.
As in so many cases with Alice, setup is 80% of the exercise.
So the situation is as follows:
You have three doors, you want them spaced evenly and you want to know how far away each door is from the others. Lets look at one way to do this:
You already have your doors so this is what I would do:
  1. Pick a door to you want to be on the far left and move it to the center of the stage.
  2. Right click on the object in the list to the left of the stage, go to methods and select "turn to face" and pick the camera.
  3. Using the same "right click and pick a method" procedure move the door back far enough so that all three doors will fit in the scene.
  4. Still using the method above move the door to the left side of the scene.
You have one door where you want it for the start of the movie. I said to use methods instead of moving the object with the mouse so that the object's orientation to the camera does not change. And we started in the middle of the scene so that the door would be straight on to the camera. If the door were on the left and instructed to turn to face the camera, it would turn to the right some amount and the rest of our work would be slightly off.
  1. Make sure the Door you just positioned is selected.
  2. Drop a dummy object at the selected object. If you don't see the "Drop a dummy at the selected object" ensure you are in the "Add Objects" view and click the "more controls" button on the right under the icons.
  3. In the Object tree on the left click on the + sign to the left of Dummy
  4. Right click on the dummy object and name it left door.
  5. Select the right door
  6. Right click on the object tree, hover over methods and select "set point of view to" and pick the left door.
  7. Using the same procedure select "Move Right" and move the right door to the right of the screen. Keep track of how far you move it! and remember you can always use the undo button.
  8. Drop a dummy at the right door and name it right door.
  9. Follow the same procedure to orient and move the center door and move it 1/2 the distance you moved the right door.
  10. Again drop a dummy object and name it "center door"
You should now have 3 doors and more importantly you know how far to move a door so that it is in the place of another door. You should also be able to see that swapping one of the outside doors (right or left) with the center door will involve each door moving some distance while swapping the end doors will require each door to move twice that distance. If the door goes off the stage it is because it was moved in the wrong direction. In other words to swap the door on the left with the center door, we move the left door to the right and the center door the same amount to the left. Neither should leave the stage.

But wait there's more! You can now move the doors around without worrying about moving how far or in what direction or even which door is moving. How? By using the dummy objects!
  • Pick two dummy objects.
  • Find the doors with the same position as these dummy objects.
  • Set the "point of view" of each door to the other dummy object.
Finding the doors with the same position as the selected dummy objects involves using the list methods, since you already said your doors were in a list.

Hope this helps
Mark


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
lock combination
Old
youngskul
Junior Member
 
Status: Offline
Posts: 1
Join Date: Mar 2019
Exclamation lock combination - 03-04-2019, 12:06 PM

hey , can someone please help me with the lock combination , I'm not getting the concepts .
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.