def setUp(self): self.board = chessboard.ChessBoard() self.board[60] = pieces.KingPiece('black') self.board[4] = pieces.KingPiece('white') self.evaluate = engine.Evaluator().evaluate return None
def setUp(self): self.numberofloops = 10 self.board = chessboard.ChessBoard() self.board[27] = pieces.KingPiece('white') self.board[45] = pieces.KingPiece('black') self.generator = movegenerator.MoveGenerator(self.board) return None
def test_search_single_twokings(self): # Set up board with kings. self.board[21] = pieces.KingPiece('white') self.board[35] = pieces.KingPiece('black') # Search the moves. nodes = self.engine.search_single(self.board, 1, 'white') print[x.moves for x in nodes] self.assertIn(engine.Node((35, 44), engine.Node((21, 29))), nodes) self.assertNotIn(engine.Node((35, 36), engine.Node((21, 29))), nodes) 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 setUp(self): self.board = chessboard.ChessBoard() self.board[60] = pieces.KingPiece('black') self.board[4] = pieces.KingPiece('white') self.board[51] = pieces.PawnPiece('black') self.board[52] = pieces.PawnPiece('black') self.board[53] = pieces.PawnPiece('black') self.board[49] = pieces.PawnPiece('black') self.board[36] = pieces.PawnPiece('white') self.board[34] = pieces.PawnPiece('white') self.generator = movegenerator.MoveGenerator(self.board) return None
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 test__setitem__index(self): piece = pieces.KingPiece('white') self.board[36] = piece self.assertEqual(self.board._board[36], piece, errormessage(self.board._board[36], piece)) return None
def test_findpiece_black(self): self.board[22] = pieces.KingPiece('black') blackkingpos = self.board.findpiece(pieces.KingPiece, 'black')[0] self.assertEqual( blackkingpos, 22, errormessage("The king is at %i" % blackkingpos, "The king is at %i" % 22)) return None
def test_findpiece_white(self): self.board[25] = pieces.KingPiece('white') whitekingpos = self.board.findpiece(pieces.KingPiece, 'white')[0] self.assertEqual( whitekingpos, 25, errormessage("The king is at %i" % whitekingpos, "The king is at %i" % 25)) return None
def test_equality(self): piece2 = pieces.KingPiece('black') self.assertEqual( self.piece, piece2, errormessage( "%s =/= %s" % (self.piece, "KingPiece"), "%s == %s" % (self.piece, "KingPiece") ) ) return None
def test_kingincheck_false(self): self.generator.board[1] = pieces.KingPiece('black') self.assertFalse(self.generator.kingincheck('black'))
def test_kingincheck_true(self): self.generator.board[34] = pieces.KingPiece('black') # Add black king. self.assertTrue(self.generator.kingincheck('black')) return None
def setUp(self): self.piece = pieces.KingPiece('white') return None