本文整理汇总了Python中state.State.get_current方法的典型用法代码示例。如果您正苦于以下问题:Python State.get_current方法的具体用法?Python State.get_current怎么用?Python State.get_current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类state.State
的用法示例。
在下文中一共展示了State.get_current方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_roll
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import get_current [as 别名]
def start_roll():
players = [State(1),State(2),State(3)]
while True:
current = State.get_current()
roll = Roll()
tmpScore = 0
while True:
clear()
print 'its player {}\'s turn'.format(current.id)
d = roll.get_new_roll()
print 'Rolled:\n{}'.format(d)
c = get_choice(d)
if not c:
print 'damn i lost my turn',
if tmpScore > 0:
print 'and i lost {} points, lame'.format(tmpScore)
break
raw_input('thinking about what i want to hold....')
roll.hold_dice(c)
print 'I held:\n{}\nThats worth {} points'.format(c,score_dice(c))
tmpScore += score_dice(c)
if tmpScore != score_dice(c):
print '{} points so far this roll'.format(tmpScore)
if raw_input('press enter to keep rolling\nor q to quit now and keep {} points '.format(tmpScore)).lower() == 'q':
current.set_score(tmpScore)
current.change_state()
clear()
print 'press enter to go again, or q to quit',
quit = raw_input()
if quit == 'q':
current.change_state()
tmpScore = 0
clear()
break
else:
continue
示例2: get_current
# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import get_current [as 别名]
def get_current(self):
return State.get_current()