本文整理汇总了Python中Board.initializeBoard方法的典型用法代码示例。如果您正苦于以下问题:Python Board.initializeBoard方法的具体用法?Python Board.initializeBoard怎么用?Python Board.initializeBoard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board
的用法示例。
在下文中一共展示了Board.initializeBoard方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import Board [as 别名]
# 或者: from Board import initializeBoard [as 别名]
def main():
print "Welcome to King Saul Checkers! [5x5, two Kings each]"
# test default CTOR
B = Board()
print B
# test setting up an initial board
B.initializeBoard()
print B
# test iterating over all the pieces (kings) on the board
# whichKing is hash: key: name, value: King object
for nextKing in B.whichKing.keys():
print B.whichKing[nextKing]
# test making (potential) moves of each King on board B
nextMoves = []
for moveThisKing in B.whichKing.keys():
newBoards = B.getNextMoves( B.whichKing[moveThisKing] )
print "----------------------------------------------"
print "Potential Moves for King: ", moveThisKing
for nextBoard in newBoards:
print "\tFROM", B.whichKing[ moveThisKing ].chinookNum, "TO", nextBoard.whichKing[ moveThisKing ].chinookNum
示例2: main
# 需要导入模块: import Board [as 别名]
# 或者: from Board import initializeBoard [as 别名]
def main():
print "\nWelcome to King Saul Checkers! [6x6, two Kings each]\n"
B = Board() # get new board
B.initializeBoard() # set up starting board
playGame(B)