Alice Community  

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

Reply
 
Thread Tools Display Modes
Me again! Spinning loops distance question.
Old
BadWolfGeronimo
Junior Member
 
Status: Offline
Posts: 14
Join Date: Dec 2016
Default Me again! Spinning loops distance question. - 01-04-2017, 11:55 AM

My score won't increase unless I have the "torus within 3m distance to cone". If I put it any lower it doesn't tick up the score even when the ring falls directly on the cone. Also I can't get my while loops to work! I believe I have it set that my first loop will play until the score is to 5, then I need the second while loop to start to add the other 3 rings. But it just gets to 4 and stops counting. And never moves to the other loop. I'm attaching my program below (see I'm learning!)
Attached Files
File Type: a2w Lab4-LF.a2w (495.0 KB, 5 views)
   
Reply With Quote
Old
BadWolfGeronimo
Junior Member
 
Status: Offline
Posts: 14
Join Date: Dec 2016
Default 01-04-2017, 08:29 PM

Okay, my instructor helped me figure out the array thing. I was trying to do that in the first place but for some reason I got thrown by it. But I still can't get my ring count to work. I've moved my if statement to every possible place and it's doing nothing. It worked fine with my single ring game I don't understand why I can't do it now. Here's my updated game.
Attached Files
File Type: a2w Lab4-LF.a2w (494.9 KB, 1 views)
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 210
Join Date: Dec 2012
Location: Frosno, Ca
Default 01-05-2017, 07:33 PM

Quote:
Originally Posted by BadWolfGeronimo View Post
Okay, my instructor helped me figure out the array thing. I was trying to do that in the first place but for some reason I got thrown by it. But I still can't get my ring count to work. I've moved my if statement to every possible place and it's doing nothing. It worked fine with my single ring game I don't understand why I can't do it now. Here's my updated game.
Although I know it is tempting to try and just move stuff around until it works, it is hardly ever productive and when it does work you rarely understand why.
Unfortunately the alternative is usually painful, yet it can be strangely rewarding in the end. You need to read the code and understand what it is doing. In the present case you are doing something like this:
  1. Move the ring some random amount in some random direction.
  2. Make the ring invisible.
  3. Move it back where it was to start with.
  4. Repeat these steps with another ring.
  5. See if the first ring is close to the cone If it is increment wins, else increment loss.
  6. See if the second ring is close to the cone. If it is increment wins, else increment loss.

As you can probably see unless the rings started out close enough to the cone they will probably not be close enough when they are moved back.
There is another problem with the code that is a quirk in Alice. That is that when an object is totally transparent (its opacity is 0.0), it does not work properly when used in distance and comparison measurements. This does not happen often but I have seen it.

Mark


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 210
Join Date: Dec 2012
Location: Frosno, Ca
Default 01-05-2017, 07:40 PM

Quote:
Originally Posted by BadWolfGeronimo View Post
Okay, my instructor helped me figure out the array thing. I was trying to do that in the first place but for some reason I got thrown by it. But I still can't get my ring count to work. I've moved my if statement to every possible place and it's doing nothing. It worked fine with my single ring game I don't understand why I can't do it now. Here's my updated game.
Part 2.
I would start by removing all the stuff you are not using and disable all the random instructions temporarily replacing them with values you know. It is hard, bordering on impossible to troubleshoot when you don't know what it is actually doing.

Mark


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
Old
BadWolfGeronimo
Junior Member
 
Status: Offline
Posts: 14
Join Date: Dec 2016
Default 01-05-2017, 09:54 PM

I have spent hours doing this lab and got no where. Funnily enough, I took my laptop to my daughter's girl scout meeting and half-listened half-programmed and I got it pretty quick. Apparently I had to get out of my own way and stop overthinking. Thank you so much for your constant help!
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 210
Join Date: Dec 2012
Location: Frosno, Ca
Default 01-09-2017, 04:56 PM

Quote:
Originally Posted by badwolfgeronimo View Post
i have spent hours doing this lab and got no where. Funnily enough, i took my laptop to my daughter's girl scout meeting and half-listened half-programmed and i got it pretty quick. Apparently i had to get out of my own way and stop overthinking. Thank you so much for your constant help!

yah!!


Mark Henwood
mhenwood@ieee.org
   
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 ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.