Example #1
0
 def setUp(self):
     self.notation = [["WR", "WN", "WB", "WQ", "WK", "WB", "WN", "WR"],
                      ["WP", "WP", "WP", "WP",   "", "WP", "WP", "WP"], 
                      [  "",   "",   "",   "",   "",   "",   "",   ""],
                      [  "",   "",   "",   "", "WP",   "",   "",   ""],
                      [  "",   "",   "",   "", "BP",   "",   "",   ""],
                      [  "",   "",   "",   "",   "",   "",   "",   ""],
                      ["BP", "BP", "BP", "BP",   "", "BP", "BP", "BP"], 
                      ["BR", "BN", "BB", "BQ", "BK", "BB", "BN", "BR"]]
     self.flat_notation = list(itertools.chain(*self.notation))
     self.num_pieces = len([square for square in self.flat_notation if square != ""])
     self.empty_board = Board()
     self.board = Board.from_notation(self.notation)
Example #2
0
 def setUp(self):
     self.board = Board.from_notation([[  "",   "",   "",   "",   "",   "",   "",   ""],
                                       [  "", "WR",   "",   "",   "",   "",   "",   ""], 
                                       [  "",   "",   "",   "",   "",   "",   "",   ""],
                                       [  "",   "",   "",   "",   "",   "",   "",   ""],
                                       [  "", "WR",   "", "BR",   "", "WR",   "",   ""],
                                       [  "",   "",   "",   "",   "",   "",   "",   ""],
                                       [  "",   "",   "",   "",   "",   "",   "", "BR"], 
                                       [  "",   "",   "",   "",   "",   "",   "",   ""]])
     self.upper_rook = self.board[1][1]
     self.left_rook = self.board[4][1]
     self.right_rook = self.board[4][5]
     self.middle_rook = self.board[4][3]
     self.lower_rook = self.board[6][7]
Example #3
0
 def setUp(self):
     self.board = Board.from_notation(
         [["", "", "", "", "", "", "", ""],
          ["", "WR", "", "", "", "", "", ""],
          ["", "", "", "", "", "", "", ""],
          ["", "", "", "", "", "", "", ""],
          ["", "WR", "", "BR", "", "WR", "", ""],
          ["", "", "", "", "", "", "", ""],
          ["", "", "", "", "", "", "", "BR"],
          ["", "", "", "", "", "", "", ""]])
     self.upper_rook = self.board[1][1]
     self.left_rook = self.board[4][1]
     self.right_rook = self.board[4][5]
     self.middle_rook = self.board[4][3]
     self.lower_rook = self.board[6][7]
Example #4
0
 def setUp(self):
     self.board = Board.from_notation(chess.STARTING_NOTATION)
Example #5
0
 def _reset(self):
     self._board = Board.from_notation(chess.STARTING_NOTATION)
     self.turn_count = 1
     self.cur_player = Color.white
Example #6
0
 def _load_from_response(self, resp):
     next_turn = {"turn": resp["turn"], "current_player": resp["current_player"]}
     self._cached_board = Board.from_notation(resp["board"])
     return next_turn
Example #7
0
 def setUp(self):
     self.board = Board.from_notation(chess.STARTING_NOTATION)