We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9a94ad4 commit c8e3f9dCopy full SHA for c8e3f9d
1 file changed
oo/carro.py
@@ -0,0 +1,31 @@
1
+NORTE = 'Norte'
2
+LESTE = 'Leste'
3
+SUL = 'Sul'
4
+OESTE = 'Oeste'
5
+
6
+class Direcao:
7
+ rotacao_a_direita_dct = {
8
+ NORTE : LESTE, LESTE : SUL, SUL : OESTE, OESTE : NORTE
9
+ }
10
+ rotacao_a_esquerda_dct = {
11
+ NORTE : OESTE, LESTE : NORTE, SUL : OESTE, OESTE : NORTE
12
13
+ def __init__(self):
14
+ self.valor = NORTE
15
16
+ def girar_a_direita(self):
17
+ self.valor = self.rotacao_a_direita_dct[self.valor]
18
19
+ def girar_a_es(self):
20
+ self.valor = self.rotacao_a_esquerda_dct[self.valor]
21
22
+class Motor:
23
24
+ self.velocidade = 0
25
26
+ def acelerar(self):
27
+ self.velocidade += 1
28
29
+ def frear(self):
30
+ self.velocidade -= 2
31
+ self.velocidade = max(0, self.velocidade)
0 commit comments