alice-teacher For All Together checking a list
Don Slater
dslater at andrew.cmu.edu
Tue May 17 13:43:23 EDT 2011
I would really want to see this code fragment, either as a screen shot, or send me the world, as I am having a difficult time parsing what exactly is going on.
If I understand what is going on, it sounds like you have something like
for (all boxes in my list) together
if (my car is in a box in the list)
set variable to true
else
set variable to false
If the above is accurate, the
else
set variable to false
may be the problem, as what you are doing is checking to see if the car in all of the boxes in the list _At the same time_
The car can only be in one of the boxes at any point in time, and will be in none of the others at that same point in time, and so the variable will be set to true for one box, and false for all of the others.
But I am not sure that I really understand the code that you are working with. Feel free to send me the world (directly to dslater at cmu.edu), not to the whole list.
All the best,
Don Slater
On May 16, 2011, at 8:13 PM, Susan Simonson wrote:
> I have a student with the following question:
>
> We are trying to create a racing game in which we use invisible boxes to keep the car at a regular speed on the road, while it has a lower speed and can stop completely off the road. We used a "for all together" statement within an infinite loop using a list with all the boxes inside the list. We then use a "if then" inside the "for all together" statement and declare a variable we are watching true if it is in the box and false if it is not. The problem we are having is that the statement only recognizes the first item in the list, and we want to have it recognize all the boxes. Please help us with suggestions. Thanks!
>
>
> Sue Simonson
> Business/Computer Education Teacher
> DECA Advisor
> Link Crew Advisor
> Mound Westonka High School
> (952) 491-8169
> simonsons at westonka.k12.mn.us
>
> www.westonka.k12.mn.us
> The Westonka Edge: Small School Advantages; Big School Opportunities; Real-Life Success Stories
>
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
More information about the alice-teachers
mailing list