예제 #1
0
                # make_text('Remaining: {}'.format(board.remaining), x/2, y - cell_len/2, white)
                initialise = False
                board.print_board()

            # normal play starts here
            if not initialise:

                # define cell for clicked cell
                cell = board.cell_board[row][col]

                # calling methods based on player choice
                if left_click == 1 and not cell.flagged():
                    if not cell.opened():
                        board.open_cell(row, col)
                    else:
                        board.open_neighbours(row, col)

                elif right_click == 1 and not cell.opened():
                    board.flag_cell(row, col)

                # blit text for each cell
                for i in range(0, size):
                    for j in range(0, size):

                        # define new cell here, since we are looking at every single cell
                        cell = board.cell_board[i][j]
                        color = lightgrey
                        y = (cell_len + margin) * i + cell_len / 2 + margin
                        x = (cell_len + margin) * j + cell_len / 2 + margin

                        # draw value if opened