-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils (2).py
34 lines (29 loc) · 1.14 KB
/
utils (2).py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#Write a python function for the following declarations:
#Note: the location tuple contains:
#(x-coordinate, y-coordinate, orientation)
#Note: orientation is N,S,E,W
import re
class Robot:
def __init__(self, sLocation):
#TODO: finish the constructor
#Define locationX, locationY, orientation
#using the given value
self.coordinateX = sLocation[0]
self.coordinateY = sLocation[1]
self.orientation = sLocation[2]
self.initial = (coordinateX,coordinateY,orientation)
return self.initial
def moveForward(self,sLocation,distance):
#TODO: finish the moveForward definition
#accepts the tuple of location and distance
#returns a tuple of the new location
#The coordinate modified (x or y) is dependent
#upon the orientation
return newLocation
def rotate(self,sLocation, orientation):
#TODO: finish the rotate definition
#accepts the tuple of location and the
#new orientation
#returns the tuple of the new loaction and
#orientation
return newLocation