Difference: TurtleRacingExample (1 vs. 2)

Revision 22018-09-18 - JimSkon

Line: 1 to 1
 
META TOPICPARENT name="IntroToCSF2018"

Turtle Racing Example

Changed:
<
<
>
>

Turtle Racing Example

r37L2zhYXG-8.png
 We can generate random numbers in a range:

Line: 15 to 17
 We can make the code nicer by breaking it into functions: https://repl.it/@JimSkon/LeafyPushyVirtualmachines

Now see if you can make the turtles race each other moving at the same time!

Added:
>
>

META FILEATTACHMENT attachment="r37L2zhYXG-8.png" attr="" comment="" date="1537310405" name="r37L2zhYXG-8.png" path="r37L2zhYXG-8.png" size="39402" user="JimSkon" version="1"

Revision 12018-09-18 - JimSkon

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="IntroToCSF2018"

Turtle Racing Example

We can generate random numbers in a range:

Consider the following. Try it out:

We want to make the turtles race each other. How? We can use the randrange function to pick a random number and go forward that much. Try it.

We can make the code nicer by breaking it into functions: https://repl.it/@JimSkon/LeafyPushyVirtualmachines

Now see if you can make the turtles race each other moving at the same time!

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback