Exemplo n.º 1
0
 def testKing2Piece(self):
   pass
   """Movement-Listener-Threat test of pieces on king2 map."""
   logging.info("<KING2 TEST>")
   board = Board(chset.king2)
   king1 = board.square[6][0].piece
   rook1 = board.square[4][0].piece
   rook2 = board.square[1][0].piece
   bishop1 = board.square[1][5].piece
   pawn1 = board.square[2][3].piece
   bishop2 = board.square[0][2].piece
   
   board.time = int(time()*10000)
   
   king1.update()
   
   logging.info("King1 Movement data; %s"%(str(['board.square[%i][%i],'%(square.x,square.y) for square in king1.movement])))
   logging.info("Rook1 Movement data; %s"%(str(['board.square[%i][%i],'%(square.x,square.y) for square in rook1.movement])))
   logging.info("Pawn1 Movement data; %s"%(str(['board.square[%i][%i],'%(square.x,square.y) for square in pawn1.movement])))
   logging.info("Bishop1 Movement data; %s"%(str(['board.square[%i][%i],'%(square.x,square.y) for square in bishop2.movement])))
   
   self.assertEqual(king1.movement,[board.square[7][1], board.square[7][0], board.square[6][1], board.square[5][0]])
   self.assertEqual(rook1.movement,[])
   self.assertEqual(pawn1.movement,[ board.square[2][4] ])
   self.assertEqual(bishop2.movement,[ board.square[2][4] ])
   
   logging.info("</KING2 TEST>")
Exemplo n.º 2
0
 def testRook2Piece(self):
   """Movement-Listener-Threat test of pieces on rook1 map."""
   logging.info("<ROOK2 TEST>")
   board = Board(chset.rook2)
   rook2 = board.square[3][3].piece
   king1 = board.square[2][2].piece
   queen1 = board.square[5][5].piece
   
   board.time = int(time()*10000)
   king1.update()
   
   logging.info("Rook1 Movement data; %s"%(str(['%ix%i'%(square.x,square.y) for square in rook2.movement])))
   
   logging.info("</ROOK2 TEST IS ENDED>")
   
   self.assertEqual(rook2.movement,[])
Exemplo n.º 3
0
 def testKing3Piece(self):
   """Movement-Listener-Threat test of pieces on king3 map."""
   logging.info("<KING3 TEST>")
   board = Board(chset.king3)
   king1 = board.square[4][0].piece
   king2 = board.square[4][7].piece
   logging.info("king1 time: %i",king1.time)
   board.time = int(time()*10000)
   king1.update()
   king2.update()
   
   logging.info("King1 Movement data; %s"%(str(['board.square[%i][%i],'%(square.x,square.y) for square in king1.movement])))
   logging.info("King2 Movement data; %s"%(str(['board.square[%i][%i],'%(square.x,square.y) for square in king2.movement])))
   
   self.assertEqual(king1.movement,[board.square[5][1], board.square[5][0], board.square[4][1], board.square[3][1], board.square[3][0], board.square[6][0], board.square[2][0]])
   self.assertEqual(king2.movement,[board.square[5][6], board.square[5][7], board.square[4][6], board.square[3][7], board.square[3][6], board.square[6][7], board.square[2][7]])
   
   logging.info("</KING3 TEST>")