def search(self): # The search workflow/logic will determine if you actually have a winner, but it is a bit tricky. # if the ball is in a particular hole, the search relays need to click and/or clack, and # when you have at least three going at once, it should latch on the search index and score. # This scoring is tempered by the selector disc. You have to have the card enabled that you're # winning on. This whole process will have to happen on a rotational basis. The search should really # begin immediately upon the first ball landing in the hole. # I suspect that the best, fastest way to complete the search is actually to reimplement the mechanical # search activity. For each revolution of the search disc (which happens about every 5-7 seconds), the # game will activate() each search relay for each 'hot' rivet on the search disc. This can be on a different # wiper finger for each set of rivets on the search disc. for i in range(0,49): self.r = self.closed_search_relays(self.game.searchdisc.position) self.game.searchdisc.spin() self.wipers = self.r[0] self.card = self.r[1] # From here, I need to determine based on the value of r, whether to latch the search index and score. # I need to determine the best winner on each card. To do this, I must compare the position of the replay counter before # determining the winner. Reminder that my replay counters are a 1:1 representation. self.match = [] for key in self.wipers: for number in self.holes: if number == key: self.match.append(self.wipers[key]) relays = sorted(set(self.match)) #TODO Play sound for each relay closure. s = functions.count_seq(relays) if self.game.selector.position >= self.card: if s >= 3: self.find_winner(s, self.card) break
def search(self): # The search workflow/logic will determine if you actually have a winner, but it is a bit tricky. # if the ball is in a particular hole, the search relays need to click and/or clack, and # when you have at least three going at once, it should latch on the search index and score. # This scoring is tempered by the selector disc. You have to have the card enabled that you're # winning on. This whole process will have to happen on a rotational basis. The search should really # begin immediately upon the first ball landing in the hole. # I suspect that the best, fastest way to complete the search is actually to reimplement the mechanical # search activity. For each revolution of the search disc (which happens about every 5-7 seconds), the # game will activate() each search relay for each 'hot' rivet on the search disc. This can be on a different # wiper finger for each set of rivets on the search disc. for i in range(0, 49): self.r = self.closed_search_relays(self.game.searchdisc.position) self.game.searchdisc.spin() self.wipers = self.r[0] self.card = self.r[1] # From here, I need to determine based on the value of r, whether to latch the search index and score. # I need to determine the best winner on each card. To do this, I must compare the position of the replay counter before # determining the winner. Reminder that my replay counters are a 1:1 representation. self.match = [] for key in self.wipers: for number in self.holes: if number == key: self.match.append(self.wipers[key]) relays = sorted(set(self.match)) #TODO Play sound for each relay closure. s = functions.count_seq(relays) if self.game.selector.position >= self.card: if s >= 3: self.find_winner(s, self.card) break