def setUp(self): self.board = chessboard.ChessBoard() self.board[0] = pieces.RookPiece('white') self.board[55] = pieces.RookPiece('white') self.board[4] = pieces.KingPiece('white') self.board[10] = pieces.PawnPiece('white') self.board[13] = pieces.PawnPiece('white') self.board[15] = pieces.PawnPiece('white') self.board[31] = pieces.BishopPiece('black') self.board[56] = pieces.RookPiece('black') self.board[60] = pieces.KingPiece('black') self.board[49] = pieces.PawnPiece('black') self.generator = movegenerator.MoveGenerator(self.board) return None
def setUp(self): board = chessboard.ChessBoard() board[4] = pieces.KingPiece('white') board[8] = pieces.PawnPiece('white') board[9] = pieces.PawnPiece('white') board[13] = pieces.PawnPiece('white') board[14] = pieces.PawnPiece('white') board[23] = pieces.PawnPiece('white') board[60] = pieces.KingPiece('black') board[17] = pieces.RookPiece('black') board[30] = pieces.RookPiece('black') self.generator = movegenerator.MoveGenerator(board) return None
def test_node_parent(self): # Make the parent first. parentstate = chessboard.ChessBoard() parentstate[1] = pieces.RookPiece('white') parent = engine.Node(None, (0, 1), parentstate) # Set up the board state. state = chessboard.ChessBoard() state[5] = pieces.RookPiece('white') # Then time it. with Timer() as t: for x in xrange(self.numberofloops): engine.Node(parent, (1, 5), state) print '\n\t=> elapsed time for %i loops: %s s' % (self.numberofloops, t.secs) return None
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)
def test_tree_addnode(self): # Initilise Tree tree = engine.TreeStructure() # Make the parent first. parentstate = chessboard.ChessBoard() parentstate[1] = pieces.RookPiece('white') parent = engine.Node(None, (0, 1), parentstate) # Set up the board state. state = chessboard.ChessBoard() state[5] = pieces.RookPiece('white') child = engine.Node(parent, (1, 5), state) with Timer() as t: for x in xrange(10000): tree.addnode(child) print '\n\t=> elapsed time for 10000 loops: %s s' % t.secs return None
def test_equality(self): piece2 = pieces.RookPiece('black') self.assertEqual( self.piece, piece2, errormessage( "%s =/= %s" % (self.piece, "RookPiece"), "%s == %s" % (self.piece, "RookPiece") ) ) return None
def setUp(self): self.piece = pieces.RookPiece('white') return None