Untitled
unknown
plain_text
a year ago
1.5 kB
23
Indexable
from mblock import event
import random
rock_paper_scissor=['Rock','Paper','Scissor']
@event.received('message1')
def on_received():
for i in range(5):
sprite.say('Are you ready for the next Round ?',2)
result = sprite.input('Rock,Paper or Scissor?')
sprite.set_variable('result', result)
player_choice= sprite.get_variable('result')
sprite.say('Computer Thinking',2)
computer_choice= rock_paper_scissor[random.randint(0,2)]
sprite.say(computer_choice,2)
if player_choice =='Rock' and computer_choice =='Rock':
sprite.say('Draw!',2)
elif player_choice =='Rock' and computer_choice =='Paper':
sprite.say('Computer Win!',2)
elif player_choice =='Rock' and computer_choice =='Scissor':
sprite.say('You Win!',2)
if player_choice =='Scissor' and computer_choice =='Rock':
sprite.say('Computer Win!',2)
elif player_choice =='Scissor' and computer_choice =='Paper':
sprite.say('You Win!',2)
elif player_choice =='Scissor' and computer_choice =='Scissor':
sprite.say('Draw!',2)
if player_choice =='Paper' and computer_choice =='Rock':
sprite.say('You Win!',2)
elif player_choice =='Paper' and computer_choice =='Paper':
sprite.say('Draw!',2)
elif player_choice =='Paper' and computer_choice =='Scissor':
sprite.say('Computer Win!',2)
Editor is loading...
Leave a Comment