def start(): """ Главный цикл отрисовки """ screen.fill((192, 192, 192)) board = Classes.Board(number_of_cells, board_size, x_coord, y_coord, BLACK) check = 1 board.draw(screen) while True: for i in pygame.event.get(): if i.type == pygame.QUIT: exit() if i.type == pygame.MOUSEBUTTONDOWN: click_x = 10 + ((i.pos[0] - board.x) // (board_size / number_of_cells)) click_y = 10 + ((i.pos[1] - board.y) // (board_size / number_of_cells)) if i.button == 1 and 100 < i.pos[0] < (100 + board_size) and 100 < i.pos[1] < (100 + board_size) and \ data[int(click_x)][int(click_y)] == 0 and win_trigger == 0: if check == 1: obj = Classes.Cross(chip_size, RED) data[int(click_x)][int(click_y)] = check check = -1 else: obj = Classes.Dot(chip_size, BLUE) data[int(click_x)][int(click_y)] = check check = 1 obj.x = (click_x - 10) * (board_size / number_of_cells) + ( board_size / number_of_cells) / 2 + 100 obj.y = (click_y - 10) * (board_size / number_of_cells) + ( board_size / number_of_cells) / 2 + 100 obj.draw(screen) win_check(data, int(click_x), int(click_y), -check) pygame.display.update() clock.tick(60)
def outcome(hand1,hand2,deck): results = [0,0,0,0] board = cl.Board("", "") board.machinehand = randomboard(deck) winner = pe.main(hand1,hand2,board) print winner if winner[0] == "Tie!": return 0.5 elif winner[0] == "hand1": return 1 else: return 0
def main(): board = Classes.Board(6, 6, 6) board.printBoard() board.mainloop()