You might have heard of Python, it’s a type of programming language where you get to program websites and games. Today I have made a game, rock, paper, scissors, it might be familiar to you ^__^……
When you look at the right side of the screenshot, you would see the terminal, where I play the game by calling the program and start playing. On the left side, is the behind – the – scenes of the game, where I program the game to make it work the way it works. It was a bit challenging when I started this but when I finally finished the whole program, it was fun!
[Updated Part]
Here is the rest of the code for those who would want to experiment and have fun!!!
from random import randint
moves = [‘Rock’, ‘Paper’, ‘Scissors’]
def ask_move(player = False):
if player:
return moves.index(moves[int(raw_input(“Pick a move, 1: %s, 2: %s, 3: %s”
% (moves[0], moves[1], moves[2]))) – 1]) + 1
else:
return randint(1, 3)
def calculate_score(p1, p2):
movescore = p1 -p2
if movescore == 0:
print(“Tie!”)
elif movescore in (1, -2):
print(“Win!”)
else:
print(“You lose!”)
if __name__ == “__main__”:
print(“Welcome to the Rock, Paper, Scissors game!”)
while True:
print(“Player 1:\n”)
one = ask_move(True)
two = ask_move()
calculate_score(one, two)
try:
break_ = raw_input(“Would you like to play again?\nEnter [1] if you would like to, else press enter.”)
if 1 == int(break_):
print(“Thank you for playing!”)
break
except ValueError:
print(“Ok, here we go again\n”)
You guys will need to indent most of these. Python has a sort of rule where if the indentention isn’t proper, your code will not work. Experiment. Research. Have fun!
Yours truly,
L.O.A.S.H
you are prolific! but im glad i subscribed. if you post the rest of your code i can work on the rest of this translation. here is a taste:
LikeLike
Thank you so much!
LikeLiked by 1 person
Reblogged this on touslesjourscarpediem.
LikeLike