1. import random
  2. ops = {\'s\' : 2, \'j\' : 1, \'b\' : 0}
  3.  
  4. while True:
  5. x = raw_input(\'you>\')
  6. ss = random.randint(0, 2)
  7. for t in ops.iteritems():
  8. if t[1] == ss:
  9. print \'pc:\',t[0]
  10. rs = ops[x] - ss
  11. if rs == 1 or rs == -2:
  12. print \'win\'
  13. elif rs == 0:
  14. print \'equal\'
  15. else:
  16. print \'lose\'

  

版权声明:本文为iNeoWong原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/iNeoWong/p/4734261.html