def run_reset_for_game2(self): self.root_game2 = w = Widget() self.build_canvas(w.canvas) self.controler.app.show(w) self.send_all('CLEAR') self.msg_all('Remplis le rectangle avec les pentaminos') self.state = 'game2' # extract all pentaminos pentas = [] for player in self.players.itervalues(): for penta in player['pentaminos']: pentas.append((penta, player)) # do game 2 self.send_all('GAME2') self.send_all('SIZE %d %d' % PENTAMINOS_SIZE2) # distribute for k, v in penta_schemes.iteritems(): size, string = v[0] w, h = size # send the penta to the user self.send_all('PENTA %s %d %d %s' % ( k, w, h, string)) self.timeout = time() + TIMER self.send_all('TIME %d' % int(self.timeout))
def run_reset_for_game2(self): self.root_game2 = w = Widget() self.build_canvas(w.canvas) self.controler.app.show(w) self.send_all('CLEAR') self.msg_all('Remplis le rectangle avec les pentaminos') self.state = 'game2' # extract all pentaminos pentas = [] for player in self.players.itervalues(): for penta in player['pentaminos']: pentas.append((penta, player)) # do game 2 self.send_all('GAME2') self.send_all('SIZE %d %d' % PENTAMINOS_SIZE2) # distribute for k, v in penta_schemes.iteritems(): size, string = v[0] w, h = size # send the penta to the user self.send_all('PENTA %s %d %d %s' % (k, w, h, string)) self.timeout = time() + TIMER self.send_all('TIME %d' % int(self.timeout))
def search_pentamino(self, penta, w, h): penta_size = (w, h) for k, possibilities in penta_schemes.iteritems(): for d_size, d_penta in possibilities: if penta_size != d_size: continue if penta != d_penta: continue return k return None