本文整理汇总了Python中Map.display方法的典型用法代码示例。如果您正苦于以下问题:Python Map.display方法的具体用法?Python Map.display怎么用?Python Map.display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map.display方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import Map [as 别名]
# 或者: from Map import display [as 别名]
def main():
player1 = Player("Player 1")
player2 = Player("Player 2")
players = [player1, player2] # TODO: Change when number of players changes
numOfPlayers = len(players)
currentPlayer = player1.id
inf1 = Unit("infantry", 0, 5, "green", 0, 0)
cav1 = Unit("cavalry", 0, 1, "blue", 1, 1)
# Test code for Map
unitsList = []
terrainList = []
initialize_map_1(unitsList, terrainList, 15, 8)
unitsList[inf1.y][inf1.x] = inf1
unitsList[cav1.y][cav1.x] = cav1
map = Map(unitsList, terrainList)
# Main game loop
choice = " "
while choice != "exit":
displayUnits(unitsList)
map.display()
menuDisplay(players, currentPlayer)
choice = input("> ")
# Make the appropriate action
takeAction(choice, map, players, currentPlayer)
# switch to next player's turn
currentPlayer = nextTurn(currentPlayer, numOfPlayers)