def test__setitem__vector(self):
        piece = pieces.QueenPiece('white')
        self.board[core.Vector(6, 6)] = piece

        self.assertEqual(self.board._board[54], piece,
                         errormessage(self.board._board[54], piece))
        return None
Beispiel #2
0
    def setUp(self):
        self.board = chessboard.ChessBoard()
        self.board[18] = pieces.QueenPiece('white')
        self.board[19] = pieces.PawnPiece('white')
        self.board[23] = pieces.RookPiece('black')
        self.board[42] = pieces.KnightPiece('black')

        self.generator = movegenerator._CoreMoveGenerator(self.board)
Beispiel #3
0
    def test_equality(self):
        piece2 = pieces.QueenPiece('black')

        self.assertEqual(
            self.piece, piece2,
            errormessage(
                "%s =/= %s" % (self.piece, "QueenPiece"),
                "%s == %s" % (self.piece, "QueenPiece")
            )
        )
        return None
    def test_duplicateboard(self):
        piece = pieces.QueenPiece('black')
        self.board[11] = piece

        newboard = self.board.duplicateboard()
        self.board[12] = piece

        self.assertNotEqual(
            newboard[12], self.board[12],
            errormessage('%s == %s' % (newboard[12], self.board[12]),
                         '%s =/= %s' % (newboard[12], self.board[12])))
        self.assertEqual(
            newboard[11], self.board[11],
            errormessage('%s =/= %s' % (newboard[11], self.board[11]),
                         '%s == %s' % (newboard[11], self.board[11])))
        return None
Beispiel #5
0
 def setUp(self):
     self.piece = pieces.QueenPiece('white')
     return None
 def test_uppiece_black(self):
     self.board[55] = pieces.QueenPiece('black')
     self.assertLessEqual(self.evaluate(self.board), -9)
     return None
 def test_uppiece_white(self):
     self.board[55] = pieces.QueenPiece('white')
     self.assertGreaterEqual(self.evaluate(self.board), 9)
     return None