def __init__(self, parent=None): super().__init__(parent) # init the logic of the game self.game = logic.Game(8, 8) # init some constants self.BOARD_SIZE = 0 self.CELL_SIZE = 0 # set the minimum size of the board self.setMinimumSize(600, 600) # init the sprite sheet that contains the resources self.sprite_sheet = QImage(696, 154, QImage.Format_ARGB32_Premultiplied) self.sprite_sheet.load("./res/sprite_sheet.png")
def restart_game(self): self.central_widget.game_board_widget.game = logic.Game(8, 8) self.central_widget.update_ui(logic.PlayerTurn.RED, 0, 0, 0, 0, False) self.central_widget.update() return
if control_right is not None: data["control_right"] = control_right if control_up is not None: data["control_up"] = control_up if control_down is not None: data["control_down"] = control_down with open(filepath, "w") as file: json.dump(data, file) return True GAME = game.Game(settings_file="game_settings.json") def restart_game(): global GAME del GAME GAME = game.Game(settings_file="game_settings.json") class Window(tk.Tk): """Window handler""" def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) self.title('Hungry Python') self.iconbitmap(r'Files/Images/icon.ico')
def restart_game(): global GAME del GAME GAME = game.Game(settings_file="game_settings.json")
self.write("team08") # LOGIN data = self.read() if data <> u"PASS": raise IOError(u"Login failed: %s" % data) self.write("ludrulam") # HASŁO data = self.read() if data <> u"OK": raise IOError(u"Login failed: %s" % data) print u'DBG: LOGGED IN' return True if __name__ == u'__main__': if True: #try: server = Server(port = int(sys.argv[1])) server.connect() server.login() game = logic.Game(server = server, debug = True, game = int(sys.argv[2])) try: game.run(int(sys.argv[3])) except KeyboardInterrupt: pass #except Exception, msg: #print msg, msg.__class__.__name__ game.save()