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


Python Game.move_void_forward方法代码示例

本文整理汇总了Python中models.Game.move_void_forward方法的典型用法代码示例。如果您正苦于以下问题:Python Game.move_void_forward方法的具体用法?Python Game.move_void_forward怎么用?Python Game.move_void_forward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Game的用法示例。


在下文中一共展示了Game.move_void_forward方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import move_void_forward [as 别名]
def main():
    print("\nSemiosphere \n")
    unordered_players = create_players_from_interactive_input()
    players = []

    # Determine player order randomly
    print("Randomly deciding the order of players...")
    while len(unordered_players) > 0:
        chosen_player = unordered_players.pop(randint(0, len(unordered_players) - 1))
        players.append(chosen_player)
        print(chosen_player.name)

    game = Game(grid_rows=11, grid_columns=8, players=players)
    for player in players:
        prompt_player_for_initial_placement(player=player, game=game)

    """
      Main game loop
    """
    dead_players = []
    while True:
        for player in players:
            player.planet_action_this_turn = False
            while player.moves_left > 0:
                prompt_player_for_turn(player=player, game=game)
        # Move Void Forward
        game.move_void_forward()

        # Handle players being taken by the void
        for player in players:
            if not player.alive:
                print("{} has been lost to the void.".format(player.name))
                dead_players.append(player)
                players.remove(player)

        # Check for win condition: All players dead except one
        if len(players) == 1:
            print("{} has won the game by abandoning his fellow players to be lost to the void.".format(
                    players[0].name)
            )
            exit()

        # Assign moves to players.
        # Moves earned by having marks in the void have already been awarded.
        for player in players:
            player.moves_left += ACTION_COSTS["initial_moves_per_turn"]

            if not player.has_planet():
                player.moves_left += ACTION_COSTS["planet_dropped_bonus"]
开发者ID:fpruitt,项目名称:semiosphere,代码行数:51,代码来源:game.py


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