- 帖子
- 32
- 精华
- 0
- 积分
- 215
- 阅读权限
- 30
- 注册时间
- 2015-4-20
- 最后登录
- 2015-5-4
|
- from random import choice
- s = [0,0]
- direction = ['left','center','right']
- def kick():
- print '===You Kick!==='
- print 'choose one side to shoot:'
- print 'left,center,right'
- you = raw_input()
- print 'You kicked' + you
- com = choice(direction)
- print 'computer saved' + com
- if you != com:
- print 'Goal!'
- s[0] += 1
- else:
- print 'Oops...'
- print 'score: %d(you) - %d(com)\n' % (s[0],s[1])
- print '===You Save!==='
- print'choose one side you save:'
- print'left,center,right'
- you = raw_input()
- print 'you saved' + you
- com = choice(direction)
- print 'computer kicked' + com
- if you == com:
- print 'saved'
- else:
- print'Oop...'
- s[1] += 1
- print 'score: %d(you) - %d(com)\n' % (s[0],s[1])
- for i in range(1):
- print '===Round %d ===' %(i+1)
- kick()
- while (s[0] ==s[1]):
- i +=1
- print '===Round %d ===' % (i+1)
- kick()
- if s[0] > s[1]:
- print 'You Win!'
- else:
- print 'You Lose.'
复制代码 |
|