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


Python Map.turn_data_for_p1方法代码示例

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


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

示例1: partial

# 需要导入模块: from map import Map [as 别名]
# 或者: from map.Map import turn_data_for_p1 [as 别名]
    Player2 = partial(NetworkPlayer, sys.argv[2])


m = Map()
p1 = Player1(*m.constructor_data_for_p1())
p2 = Player2(*m.constructor_data_for_p2())


json_data = {'p1_spawn': m.p1_spawn, 'p2_spawn': m.p2_spawn,
     'money_payout_rates': m.money_payout_rates, 'turns': [m.board_state_for_json()]}

for i in range(NUM_TURNS):
    print 'Turn #%d' % i

    # Get the players' actions
    p1_actions = p1.take_turn(*m.turn_data_for_p1())
    p2_actions = p2.take_turn(*m.turn_data_for_p2())

    m.apply_moves(p1_actions, p2_actions)
    m.resolve_combat()

    m.give_payouts()
    m.spawn_new_guys()

    m.resolve_combat() #in case the new guys spawned into combat

    json_data['turns'].append(m.board_state_for_json())


print '---- FINAL SCORE ----'
print '%s:\t%f' % (sys.argv[1], m.p1_money)
开发者ID:Echo1337,项目名称:chickenAttack,代码行数:33,代码来源:game.py

示例2: Map

# 需要导入模块: from map import Map [as 别名]
# 或者: from map.Map import turn_data_for_p1 [as 别名]
m = Map()
p1_crashed = False
p2_crashed = False
p1 = Player1(*m.constructor_data_for_p1())
p2 = Player2(*m.constructor_data_for_p2())


json_data = {'p1_spawn': m.p1_spawn, 'p2_spawn': m.p2_spawn,
     'money_payout_rates': m.money_payout_rates, 'turns': [m.board_state_for_json()]}

for i in range(NUM_TURNS):
    print 'Turn #%d' % i

    # Get the players' actions
    try:
        p1_actions = [] if p1_crashed else p1.take_turn(*m.turn_data_for_p1())
    except:
        p1_crashed = True

    try:
        p2_actions = [] if p2_crashed else p2.take_turn(*m.turn_data_for_p2())
    except:
        p2_crashed = True

    m.apply_moves(p1_actions, p2_actions)
    m.resolve_combat()

    m.give_payouts()
    m.spawn_new_guys()

    m.resolve_combat() #in case the new guys spawned into combat
开发者ID:tristang85,项目名称:chickenAttack,代码行数:33,代码来源:game.py


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