Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Simon_Says:
- matrix = Matrix()
- buttons = Button_Array()
- def __init__(self, maximum_rounds):
- self.actual_list = []
- self.answer_list = []
- self.maximum_rounds = maximum_rounds
- self.current_round = 0
- return
- def add_element(self):
- self.actual_list.append(random.randrange(4))
- def receive_list(self):
- matrix.display_message("Ronda " + str(len(self.actual_list)))
- for i in range(0, len(self.actual_list)):
- input = buttons.get_input()
- if self.actual_list[i] == input:
- matrix.display_letter(input, '*')
- else:
- matrix.display_letter(input, 'x')
- return True
- def show_actual_list(self):
- matrix.clear_screen()
- for element in self.actual_list:
- matrix.display_letter(element, "*")
- time.sleep(2)
- def run(self):
- aux = 0
- while self.maximum_rounds >= self.current_round:
- while aux < self.current_round:
- self.add_element()
- aux += 1
- self.show_actual_list()
- coorect = self.receive_list()
- if not correct:
- print "perdiste"
- break
- self.actual_list = []
- aux = 0
- self.current_round += 1
- print "Ganaste"
- simon = Simon_Says(8)
- simon.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement