当前位置: 首页>>代码示例>>Python>>正文


Python Board.initializeBoard方法代码示例

本文整理汇总了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
开发者ID:bawjensen,项目名称:COMP-255-AI,代码行数:30,代码来源:KingSaul_main.py

示例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)   
开发者ID:cpudvar,项目名称:Past-Work-Samples,代码行数:11,代码来源:KingSaul_main.py


注:本文中的Board.initializeBoard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。