예제 #1
0
 def update_size(self, num):
     self.board_size = num
     self.position = 0
     self.solutions = queens.get_solutions(queens.init_board(num),
                                         queens.possible_moves(num), 0, [])
     self.set_solution_label()
     self.update()
예제 #2
0
    def __init__(self, size=8, sides=30):
        super(ChessBoardWidget, self).__init__()

        self.board_size = size
        self.square_sides = sides
        self.square_color1 = Qt.darkRed 
        self.square_color2 = Qt.black
        self.queen_color = Qt.white
        self.offset = 40 # Offsets where the board is drawn and how big the spacer is
        # List of all the solutions
        self.solutions = queens.get_solutions(queens.init_board(size),
                                            queens.possible_moves(size), 0, [])
        self.position = 0 # Position in the solutions

        self.init_UI()