We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a29527f commit dfa07b8Copy full SHA for dfa07b8
OO/carro.py
@@ -0,0 +1,25 @@
1
+NORTH = 'Norte'
2
+SOUTH = 'Sul'
3
+EAST = 'East'
4
+WEST = 'Oeste'
5
+class Motor:
6
+ def __init__(self):
7
+ self.velocidade = 0
8
+
9
+ def acelerar(self):
10
+ self.velocidade += 1
11
+ def frear(self):
12
+ self.velocidade -= 2
13
+ self.velocidade = max(0, self.velocidade)
14
15
16
+class Direcao:
17
+ rotation_right_dct = {NORTH: EAST, EAST: SOUTH,SOUTH: WEST}
18
+ rotation_left_dct = {NORTH: WEST, WEST: SOUTH, SOUTH: EAST}
19
20
+ self.valor = NORTH
21
22
+ def turn_right(self):
23
+ self.valor = self.rotation_right_dct[self.valor]
24
+ def turn_left(self):
25
+ self.valor = self.rotation_left_dct[self.valor]
0 commit comments