Error: no such theme PatternSkinTheme
You are here: Foswiki>Main Web>CSAndRobotsExco>ExcoLab3>Lab3Code (2013-02-27, KateIngersoll)EditAttach
###################################

from myro import *

#forward(.8, 6) is approx. 29.5 inches

def forwardInches(distance_in_inches):
time = (6/29.5)*distance_in_inches
forward(.8, time)

def backwardInches(distance_in_inches):
time = (6/29.5)*distance_in_inches
backward(.8, time)

###################################

from myro import *

def turnLeftDegrees(degrees):
timeForFullTurn = 6.26
# notice that I divide by 360.0, not 360 why do I do this?
# Because when Python divides two integers, it rounds to the nearest
# integer, so for example, 90/360 = 0 (rounding to zero)
# but 90/360.0 = .25 (what we want)
# test this in the terminal!
time = (degrees/360.0)*timeForFullTurn
turnLeft(.5, time)

def turnRightDegrees(degrees):
timeForFullTurn = 6.26
time = (degrees/360.0)*timeForFullTurn
turnRight(.5, time)

def turn180():
turnLeftDegrees(180)

def turn360():
turnLeftDegrees(360)

###################################

from distance import
from turning import *


def star_side(side_length):
forwardInches(side_length)
turnLeftDegrees(144)

def star(side_length):
star_side(side_length)
star_side(side_length)
star_side(side_length)
star_side(side_length)
star_side(side_length)

def starspiral(start_length):
star(start_length)
turnLeftDegrees(10)
star(start_length
.8)
turnLeftDegrees(10)
star(start_length*.8*.8)
turnLeftDegrees(10)
star(start_length*.8*.8*.8)

###################################
Topic revision: r1 - 2013-02-27, KateIngersoll
 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback