alice-teacher A2 Random Movement problem - s Digest, Vol 45, Issue 3

Robert Durtschi robert.durtschi at gcsu.edu
Sun Apr 6 08:00:43 EDT 2014


You should be able to create a certain amount of "chaos" using a list...



Unfortunately my school's email insists on deleting non-text attachments (outlook: A non-text attachment was scrubbed...), so I don't know if my solution is the same as Don's.  I did a short (4 mice list) demo using a "for all together".  It might look better with a "for all in order" ...



I included both "for all together" and "for all in order" in the demo and added a lamppost and a distance check so they didn't just disappear off the edge of the screen.



The variable "fubar" is there because the current version of Alice 2.x (they're working on it) doesn't allow a number function (distance to) to be dragged onto the "true" of an "if...else", but you can drag a number variable, make the necessary changes, then drag the "distance to" function on top of the variable name to replace it. You can remove the variable after you adjust the code. (fubar - fouled up beyond all recognition" has a long and hallowed tradition among programmers)



As far as I know I can send attachments just fine... I'll include the html listing here just in case:



world.my first method ( )
    mice = [mouse, mouse1, mouse2, mouse3] , fubar = 1
          Loop 5 times times
          For all mice , every item_from_mice together
          // turn left -1 revolution is the same as turn right 1 revolution
  item_from_mice turn left ( random number minimum = -1 maximum = 1 ) duration = 0 seconds
  // Don't let them wander away too far
  If ( ( item_from_mice distance to lampPost ) > 3 )
          item_from_mice turn to face lampPost duration = 0 seconds
  Else
        Do Nothing
  item_from_mice move forward ( random number minimum = 1 maximum = 2 ) duration = 0.25 seconds
  Wait 2 seconds
  Loop 5 times times
          For all mice , one item_from_mice at a time
          item_from_mice turn left ( random number minimum = -1 maximum = 1 ) duration = 0 seconds
  // Don't let them wander away too far
  If ( ( item_from_mice distance to lampPost ) > 3 )
          item_from_mice turn to face lampPost duration = 0 seconds
  // They end up facing the pole a lot. move them to one side or the other.
  item_from_mice turn left ( random number minimum = -0.1 maximum = 0.1 ) duration = 0 seconds
  Else
        Do Nothing
  item_from_mice move forward ( random number minimum = 1 maximum = 2 ) duration = 0.25 seconds

Note to Don: Apparently the "export code for printing" function doesn't handle lists. I had to edit the html and add the "[mouse, mouse1, mouse2, mouse3]"



Best

Bob Durtschi

________________________________________

From: alice-teachers-bounces+robert.durtschi=gcsu.edu at lists.andrew.cmu.edu <alice-teachers-bounces+robert.durtschi=gcsu.edu at lists.andrew.cmu.edu> on behalf of alice-teachers-request at lists.andrew.cmu.edu <alice-teachers-request at lists.andrew.cmu.edu>

Sent: Wednesday, April 02, 2014 2:35 PM

To: alice-teachers at lists.andrew.cmu.edu

Subject: alice-teachers Digest, Vol 45, Issue 3

Today's Topics:

   1. Re:  Random Movement problem (James Vanderhyde)

   2. Re:  Random Movement problem (Don Slater)

----------------------------------------------------------------------

Message: 1

Date: Wed, 2 Apr 2014 17:14:51 +0000

From: James Vanderhyde <jvanderhyde at benedictine.edu>

Subject: Re: alice-teacher Random Movement problem

To: Alice educators <alice-teachers at lists.andrew.cmu.edu>, Eric

        Hillstrom       <ehillstrom at durango.k12.co.us>

Message-ID: <89E55CD5-BA2F-4C38-8EF9-26368AA34A29 at benedictine.edu>

Content-Type: text/plain; charset="windows-1252"

If you?re using Alice 2, I think it will be difficult to achieve exactly what the student wants. Because Alice 2 does not support polymorphism, it will be difficult to get much advantage from putting them in a list. You would only be able to use the built-in movement methods and functions.

I think it might be better to create a few different movement actions that by themselves do not look random, but when used by 10 different objects at the same time looks like chaos. I have had students do this. Your student wants order out of the chaos, which is more difficult, but I think it could be achieved this way. For example, one mouse can move forward 6, wait 1 second, move forward 3. Another mouse can move forward 7, wait 0.8 seconds, move forward 2. Then put all the moves in a do together block.

Alice 3 may have more capability, but I haven?t used it yet.

James

--

Dr. James Vanderhyde

Math and Computer Science

Benedictine College

jvanderhyde at benedictine.edu<mailto:jvanderhyde at benedictine.edu>

http://vanderhyde.us/~james/pro/

On Apr 1, 2014, at 12:05 PM, Eric Hillstrom <ehillstrom at durango.k12.co.us<mailto:ehillstrom at durango.k12.co.us>> wrote:

>From a student

Question:

I have taken a simple story with a medieval theme and am bringing it to life.

I want to have 10 mice move around in swarm/scurry fashion the world to make it look like they are protecting a castle.  How do I do this?  Should I make a list and somehow use a proximity function?  How do I make it look random in nature to simulate mice scurrying around?

--

Eric Hillstrom

Teacher, CTE/Technology

Durango High School

970-259-1630 x2204

_______________________________________________

alice-teachers mailing list

alice-teachers at lists.andrew.cmu.edu<mailto:alice-teachers at lists.andrew.cmu.edu>

https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers

-------------- next part --------------

An HTML attachment was scrubbed...

URL: http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20140402/9932b947/attachment-0001.html

------------------------------

Message: 2

Date: Wed, 2 Apr 2014 14:35:46 -0400

From: Don Slater <dslater at andrew.cmu.edu>

Subject: Re: alice-teacher Random Movement problem

To: Alice Teachers <alice-teachers at lists.andrew.cmu.edu>

Message-ID: <5B233908-FE00-4D14-BD0F-2786E121EDCB at andrew.cmu.edu>

Content-Type: text/plain; charset="windows-1252"

See the attached screen shot and Alice world, ?mouseScurrying"?

I created a list of the 10 mice as a world variable, and used the For All together construct inside of the Loop construct.

I used a mouse turn and a mouse move command, and used the world?s random function to set the amount of the turn and the amount of the distance moved. The random? function has a ?more?option for setting the min and max of the range of random values.

Then replace ?mouse? in the turn and move methods with the ?item from list? tile.

James is correct that if the student has an animation method for moving the legs of the mouse, they will not be able to use that method in this structure?

(Alice 3 does have similar control structures, and an animation procedural method would be usable there.)

The student may want to add appropriate checks to make sure the mice do not get too far away from or too close to the castle, but this example should give them a place to start.

Let me know if you have any questions.

All the best,

Don Slater

On Apr 2, 2014, at 1:14 PM, James Vanderhyde <jvanderhyde at benedictine.edu> wrote:

> If you?re using Alice 2, I think it will be difficult to achieve exactly what the student wants. Because Alice 2 does not support polymorphism, it will be difficult to get much advantage from putting them in a list. You would only be able to use the built-in movement methods and functions.

>

> I think it might be better to create a few different movement actions that by themselves do not look random, but when used by 10 different objects at the same time looks like chaos. I have had students do this. Your student wants order out of the chaos, which is more difficult, but I think it could be achieved this way. For example, one mouse can move forward 6, wait 1 second, move forward 3. Another mouse can move forward 7, wait 0.8 seconds, move forward 2. Then put all the moves in a do together block.

>

> Alice 3 may have more capability, but I haven?t used it yet.

>

> James

> --

> Dr. James Vanderhyde

> Math and Computer Science

> Benedictine College

> jvanderhyde at benedictine.edu

> http://vanderhyde.us/~james/pro/

>

>

>

> On Apr 1, 2014, at 12:05 PM, Eric Hillstrom <ehillstrom at durango.k12.co.us> wrote:

>

>>

>> From a student

>>

>>

>> Question:

>>

>> I have taken a simple story with a medieval theme and am bringing it to life.

>>

>> I want to have 10 mice move around in swarm/scurry fashion the world to make it look like they are protecting a castle.  How do I do this?  Should I make a list and somehow use a proximity function?  How do I make it look random in nature to simulate mice scurrying around?

>>

>> --

>>

>>

>>

>>

>>

>>

>> Eric Hillstrom

>> Teacher, CTE/Technology

>> Durango High School

>> 970-259-1630 x2204

>> _______________________________________________

>> alice-teachers mailing list

>> alice-teachers at lists.andrew.cmu.edu

>> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers

>

> _______________________________________________

> alice-teachers mailing list

> alice-teachers at lists.andrew.cmu.edu

> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers

-------------- next part --------------

An HTML attachment was scrubbed...

URL: http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20140402/66ab9f3d/attachment.html

-------------- next part --------------

A non-text attachment was scrubbed...

Name: mouseScurrying.png

Type: image/png

Size: 44877 bytes

Desc: not available

Url : http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20140402/66ab9f3d/attachment.png

-------------- next part --------------

An HTML attachment was scrubbed...

URL: http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20140402/66ab9f3d/attachment-0001.html

-------------- next part --------------

A non-text attachment was scrubbed...

Name: mouseScurrying.a2w

Type: application/octet-stream

Size: 4417933 bytes

Desc: not available

Url : http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20140402/66ab9f3d/attachment.obj

-------------- next part --------------

An HTML attachment was scrubbed...

URL: http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20140402/66ab9f3d/attachment-0002.html

------------------------------

_______________________________________________

alice-teachers mailing list

alice-teachers at lists.andrew.cmu.edu

https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers

End of alice-teachers Digest, Vol 45, Issue 3

*********************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20140406/b64d27eb/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: random mice.a2w
Type: application/octet-stream
Size: 1936167 bytes
Desc: random mice.a2w
Url : http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20140406/b64d27eb/attachment-0001.obj 


More information about the alice-teachers mailing list