game.print_board() game.draw() pygame.display.update() pygame.time.wait(1000) # Processes mouse and keyboard events, dispatching events to the event bus. # The events are handled by the ConnectGame and GameRenderer classes. while not game.game_data.game_over: for event in pygame.event.get(): if event.type == pygame.QUIT: game.quit() if event.type == pygame.MOUSEMOTION: bus.emit("mouse:hover", game.renderer, MouseHoverEvent(event.pos[0])) pygame.display.update() if event.type == pygame.MOUSEBUTTONDOWN: bus.emit("mouse:click", game, MouseClickEvent(event.pos[0])) if event.type == KEYDOWN: if event.key == pygame.K_z: mods: int = pygame.key.get_mods() if mods & pygame.KMOD_CTRL: bus.emit("game:undo", game) game.update() game.draw()