alice-teacher s Digest, Vol 38, Issue 6 - Edward Bujak comment

Edward Bujak edward_bujak at hotmail.com
Mon Sep 9 10:50:03 EDT 2013


The 10.5 meters concept is used in the "Learning to Program with Alice" book by Dann, Cooper, Pausch (http://www.aliceprogramming.net/) with Chapter 7, Exercise 6 Bumper Cars, page 231-232, with the bumper arena.

> From: robert.durtschi at gcsu.edu
> To: alice-teachers at lists.andrew.cmu.edu
> Date: Mon, 9 Sep 2013 11:34:58 +0000
> Subject: Re: alice-teacher s Digest, Vol 38, Issue 6 -  Edward Bujak comment
> 
> >> try to not code with numbers
> 
> Point well taken.  
> If I had submitted something like that to a code review I would have been shot down immediately for using "magic numbers"
> 
> In my defense, The example I provided was from the materials supplied by the publisher of the book.  It took me a while studying the code to figure out what the 10.5 meters ment.
> 
> ________________________________________
> 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: Sunday, September 08, 2013 5:34 PM
> To: alice-teachers at lists.andrew.cmu.edu
> Subject: alice-teachers Digest, Vol 38, Issue 6
> 
> Send alice-teachers mailing list submissions to
>         alice-teachers at lists.andrew.cmu.edu
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
> or, via email, send a message with subject or body 'help' to
>         alice-teachers-request at lists.andrew.cmu.edu
> 
> You can reach the person managing the list at
>         alice-teachers-owner at lists.andrew.cmu.edu
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of alice-teachers digest..."
> 
> 
> Today's Topics:
> 
>    1.  Subject: Re:  questions RE: Angela Brown (Distler, Chari)
>    2. Re:  collsion detection (s Digest, Vol 38, Issue 2) (Edward Bujak)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Sat, 7 Sep 2013 22:38:17 -0400
> From: "Distler, Chari" <DistlerC at NBPS.ORG>
> Subject: alice-teacher Subject: Re:  questions RE: Angela Brown
> To: "alice-teachers at lists.andrew.cmu.edu"
>         <alice-teachers at lists.andrew.cmu.edu>
> Message-ID: <CE515B59.7E4E%DistlerC at nbps.org>
> Content-Type: text/plain; charset="us-ascii"
> 
> Hi all,
> I created a website for my students to follow my 12 week Alice course. Most of the material is from Adventures in Alice. I put the information in a format that was easy for my students to follow. Hope this helps.
> https://sites.google.com/site/alicewithmsdistler/
> Regards,
> Chari Distler
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20130907/992151ba/attachment-0001.html
> 
> ------------------------------
> 
> Message: 2
> Date: Sat, 7 Sep 2013 21:53:04 -0400
> From: Edward Bujak <edward_bujak at hotmail.com>
> Subject: Re: alice-teacher collsion detection (s Digest, Vol 38, Issue
>         2)
> To: "alice-teachers at lists.andrew.cmu.edu"
>         <alice-teachers at lists.andrew.cmu.edu>
> Message-ID: <BLU175-W4598B633D6785768E915F4E63E0 at phx.gbl>
> Content-Type: text/plain; charset="windows-1252"
> 
> Sorry about the previous mis-send with incomplete response.
> Thanks you for the great example.As a software engineer and teacher, try to not code with numbers.  Get away from using hard coded numbers interspersed in code as fast as you can.  It is not good practice in the real world to have numbers within the code.  Documentation is not an excuse for not writing robust code.
> For example if the penguin changed size the 1.1 meters would need to be adjusted.If the holes sizes were different then the 1.1 meters would surely be incorrect some of the time.If the snowbank donut object changed size then the 10.5 meters would need adjustment.
> Please use the objects size properties of width, height, depth
> The penguin cannot fall into a hole smaller than itselfif (penguin.width > hole.width)   cannot fall into this hole
> For example a penguin being on the perimeter of a particular hole would beif (penguin.distance to hole) <= (hole.width + peguin.width)
> For example a penguin being completely within a particular hole would beif (penguin.distance to hole) <= (hole.width -  penguin.width)
> 
> 
> The 10.5 meters is probably the snowbank width, so use it. instead of hard coded numbers.if (penguin is at least snowbank.width away from snowbank)
> Also using an objects many attributes helps teach better object-oriented coding practices.With Alice objects interacting in a 3-D world it also helps think more geometrically.
> Of course the initial few weeks before the students realize that these are objects that have methods, functions, and properties using hard coded numbers are acceptable.
> From: robert.durtschi at gcsu.edu
> To: alice-teachers at lists.andrew.cmu.edu
> Date: Sat, 7 Sep 2013 00:51:15 +0000
> Subject: Re: alice-teacher collsion detection (s Digest, Vol 38, Issue 2)
> 
> 
> 
> 
> 
> 
> 
> The book "An Introduction to Programming Using Alice 2.2 Second Edition" by Charles W. Herbert has a rather nice collision detection method in Chapter 10: "TUTORIAL 10B?DON'T SPLASH
>  THE PENGUIN!"
> 
> 
>  I'll see if I can paste the relevent code here:
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  This is a screenshot of what the playing field looks like. The goal is to manuever the penquin past the holes to the flag.  The collison dectection code checks if the penguin is within 1.1 meter of the center of each hole in the list; within 1/2 meter of the flag; or if trying to go through the snowbank surrounding the arena.
> 
> 
> 
> It rather cleverly defines the snowBank as a donut with the center in the center of the playing field.  so the check is to see if the penguin is 10.5 meters from the
> center of the snowBank boundry
> 
> 
> 
> We found that if one didn't use a "Do together" it was possible for the penguin to beat its way through the snowbank and disappear over the horizon.
> 
> 
> 
> the check is invoked by a runtime event:
> 
> 
> 
> 
> 
> 
> 
> 
> While the world is running
> 
> 
> 
> 
> 
> 
> 
> 
> Begin:
> 
> 
> 
> 
> 
> 
> <None>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> During:
> 
> 
> 
> 
> 
> 
> World.checkPenguinLocation
> 
> 
> 
> 
> 
> 
> 
> 
> 
> End:
> 
> 
> 
> 
> 
> 
> <None>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> The first check below: For all
> hole1.holes , every item_from_holes
> together" runs through the list of holes.  If the penguin is less than 1.1 meter from the center of any of the holes it pops up a "splash" billboard that covers the screen.
> 
> 
> 
> The second check
> If (
> penguin is at least
> 10.5 meters away from
> snowBank ) checks if the penguin is too far from the center of the snowbank donut (center of the playing field) and moves it back towards the center.
> 
> 
> 
> The third checks
> 
> If ( (
> penguin distance to
> flagpole ) < 0.5 )
> when the penguin is close enough to the goal.  It then invokes another method to indicate "Victory"
> 
> 
> 
> 
> 
> 
> 
> 
> 
> World.checkPenguinLocation
>  ( )
> 
> No variables
> 
> 
> 
> 
> 
> Do together
> 
> 
> 
> 
> 
> 
> For all
> hole1.holes , every item_from_holes
> together
> 
> 
> 
> 
> 
> 
> If
>  ( ( penguin distance to
> item_from_holes ) < 1.1 )
> 
> 
> 
> 
> 
> 
> 
> penguin
> move down 5
> meters
> duration = 0.25 seconds
> 
> 
> 
> 
> splash
> set opacity to 1 (100%)
> 
> 
> 
> 
> Else
> 
> 
> 
> 
> 
> 
> Do Nothing
> 
> 
> 
> 
> 
> If
>  ( penguin is at least
> 10.5 meters away from
> snowBank )
> 
> 
> 
> 
> 
> 
> penguin
> move amount = 1 meter toward
> target = snowBank
> duration = 0 seconds style = abruptly
> 
> 
> 
> 
> Else
> 
> 
> 
> 
> 
> 
> Do Nothing
> 
> 
> 
> 
> 
> If
>  ( ( penguin distance to
> flagpole ) < 0.5 )
> 
> 
> 
> 
> 
> 
> 
> World.reachedFlagpole
> 
> 
> 
> 
> Else
> 
> 
> 
> 
> 
> 
> Do Nothing
> 
> 
> 
> 
> 
> 
> 
> ________________________________________
> 
> 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: Thursday, September 05, 2013 12:00 PM
> 
> To: alice-teachers at lists.andrew.cmu.edu
>  Subject: alice-teachers Digest, Vol 38, Issue 2
> 
> 
>  Send alice-teachers mailing list submissions to
> 
>         alice-teachers at lists.andrew.cmu.edu
> 
> 
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 
>         https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
> 
> or, via email, send a message with subject or body 'help' to
> 
>         alice-teachers-request at lists.andrew.cmu.edu
> 
> 
> 
> You can reach the person managing the list at
> 
>         alice-teachers-owner at lists.andrew.cmu.edu
> 
> 
> 
> When replying, please edit your Subject line so it is more specific
>  than "Re: Contents of alice-teachers digest..."
> 
> 
> 
> 
> 
> Today's Topics:
> 
> 
> 
>    1.  Collision and walking speed questions (Lori Fuller)
> 
> 
> 
> 
>  ----------------------------------------------------------------------
> 
> 
> 
> Message: 1
> 
> Date: Wed, 04 Sep 2013 13:46:25 -0400
> 
> From: "Lori Fuller" <lori.fuller at browardschools.com>
>  Subject: alice-teacher Collision and walking speed questions
> 
> To: alice-teachers at lists.andrew.cmu.edu
> 
> Message-ID:
> 
>         <fc.0119ec0746d675b63b9aca00e8ed6537.46d6890f at browardschools.com>
> 
> Content-Type: text/plain; charset="utf-8"
> 
> 
> 
> I have an advanced student among all of my beginners... and he is working
> 
> on a maze game.
> 
> 2 questions:
> 
> 1.   In Alice 2.3, is it possible to set up a collision indication method?
> 
> If so, where do I find information on this?
> 
> 2.  Is there a way to slow down the person object walking while using the
> 
> arrow keys as controllers?
> 
> 
> 
> 
> 
> 
> 
> thanks,
> 
> 
> 
> Lori Fuller, M.Ed.
> 
> Monarch High School
> 
> Career Technology Department Head
> 
> Technology Coordinator
>  Asst. Athletic Director
> 
> 
>  "A posse ad esse", from possibility to actuality...
> 
> 
> 
> Big brother is watching so watch what you put in the email!
> 
> 
> 
> Under Florida law, e-mail addresses, and all communications, including
> 
> e-mail communications, made or received in connection with the transaction
> 
> of School Board business are public records, which must be retained as
> 
> required by law and must be disclosed upon receipt of a public records
> 
> request, except as may be excluded by federal or state laws.  If you do
> 
> not want your e-mail address released in response to a public records
> 
> request, do not send electronic mail to this entity. Instead, contact this
> 
> office by phone or in writing.
> 
> 
> 
> 
> 
> -------------- next part --------------
> 
> An HTML attachment was scrubbed...
> 
> URL: http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20130904/b630acd1/attachment-0001.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 38, Issue 2
> 
> *********************************************
> 
> 
> 
> 
> _______________________________________________ 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/20130907/19ebf392/attachment.html
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: don't splash the penguin fig 10-11.png
> Type: image/png
> Size: 134644 bytes
> Desc: not available
> Url : http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20130907/19ebf392/attachment.png
> 
> ------------------------------
> 
> _______________________________________________
> 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 38, Issue 6
> *********************************************
> _______________________________________________
> 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/20130909/864cb844/attachment-0001.html 


More information about the alice-teachers mailing list