if mx >= x_r+160 and mx <= x_r+160+70 and my >= y_r+40 and my<= y_r+40+5: #se os vertices ja tiverem conectados, o jogador tem que jogar de novo if graph.is_connected(vertex['value'], vertex['value'] + 1): print('repeat') repeat = True break repeat = False graph.connect_egde(vertex['value'], vertex['value'] + 1, 'horizontal') vertex['axis']['right']['clicked'] = 1 pygame.draw.rect(screen, BLUE ,[x_r+160, y_d+40, 60,5]) bots_turn = True elif mx >= x_d+150 and mx <= x_d+150+5 and my >= y_d+50 and my<= y_d+50+60: if graph.is_connected(vertex['value'], vertex['value'] + graph.get_columns()): print('repeat') repeat = True break repeat = False pygame.draw.rect(screen, BLUE ,[x_d+150, y_d+50, 5, 70]) vertex['axis']['down']['clicked'] = 1 graph.connect_egde(vertex['value'], vertex['value'] + graph.get_columns(), 'vertical') bots_turn = True if repeat: continue #parte em que o algoritmo "joga" (aleatorio) if bots_turn: