Nothing to do, write a small program, practice python, haha:
#!/usr/bin/env python
#coding: UTF8
#author: [Email protected]
#date: 2014-09-11
Import Random,sys
#定义石头剪子布字典
Dict = {
1: ' Scissors ',
2: ' Stone ',
3: ' Cloth ',
}
For row in Dict:
print ' number: ', row, ' = ', Dict[row]
loop = True
While loop:
print ' What are you out of? '
you = Raw_input (' Please enter the number of carriage return: If you want to exit the game press the Q key '). Strip ()
If you = = ' Q ':
loop = False
Print "Friendly reminder: The game will exit, welcome to play next time"
Sys.exit ()
Else
Try
DN = Random.randint (1,3)
you = Int (you)
If you >= 1 and <= 3:
loop = True
print ' You out: ', dict[you]
print ' Computer out: ', DICT[DN]
print ' Result: ',
If DN = = You:
print ' Draw '
Elif (You > DN and you-dn = = 1) or you + 2 = = DN:
print ' You win '
Else
print ' computer wins '
Continue
This article from "Easier Avenue to Jane" blog, declined reprint!
Python applet: Scissors, stone, cloth