Skip to content

Commit

Permalink
generalize motion to floats
Browse files Browse the repository at this point in the history
  • Loading branch information
enfascination authored Apr 16, 2019
1 parent 3aa1941 commit 0fc5759
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ColabTurtle/Turtle.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def _moveToNewPosition(new_pos):

# makes the turtle move forward by 'units' units
def forward(units):
if not isinstance(units, int):
raise ValueError('units should be an integer')
if not (isinstance(units, int) or isinstance(units, float)):
raise ValueError('units should be int or float')

alpha = math.radians(turtle_degree)
ending_point = (turtle_pos[0] + units * math.cos(alpha), turtle_pos[1] + units * math.sin(alpha))
Expand Down

0 comments on commit 0fc5759

Please sign in to comment.