本文整理汇总了Python中chess.Board.add_piece方法的典型用法代码示例。如果您正苦于以下问题:Python Board.add_piece方法的具体用法?Python Board.add_piece怎么用?Python Board.add_piece使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chess.Board
的用法示例。
在下文中一共展示了Board.add_piece方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_board
# 需要导入模块: from chess import Board [as 别名]
# 或者: from chess.Board import add_piece [as 别名]
def test_board(self):
# .. NN
# .. => NN
b = Board(2,2)
print b.free
self.assertTrue(b.add_piece([("N",0,0)]))
b2 = b.add_piece([("N",0,0),("N",0,1),("N",1,0),("N",1,1)])
self.assertTrue(b2)
self.assertEquals(len(b2.free), 0, "\n%s\n\nfree:%s"%(b2, b2.free))
self.assertFalse(b.add_piece([("Q",0,0),("Q",1,1)]))
示例2: test_free_rows_and_columns
# 需要导入模块: from chess import Board [as 别名]
# 或者: from chess.Board import add_piece [as 别名]
def test_free_rows_and_columns(self):
b = Board(2,2)
self.assertEquals(free_rows_and_columns(b.data),(2,2))
b2 = b.add_piece([("N",0,0)])
self.assertEquals(free_rows_and_columns(b2.data),(1,1))
b3 = b2.add_piece([("N",0,1)])
self.assertEquals(free_rows_and_columns(b3.data),(1,0), b3)
示例3: test_eq
# 需要导入模块: from chess import Board [as 别名]
# 或者: from chess.Board import add_piece [as 别名]
def test_eq(self):
a = Board(2,2)
b = Board(2,2)
c = a.add_piece([("N",0,0)])
self.assertTrue(a == a)
self.assertTrue(a == b)
self.assertTrue(b == a)
self.assertTrue(a != c)