Python ile Taş Kağıt Makas Oyunu

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Onaylı Üye
Katılım
28 May 2020
Mesajlar
52
Çözümler
1
Tepki puanı
2
Ödüller
3
Yaş
24
6 HİZMET YILI
Merhaba arkadaşlar öncelikle bu benim ilk yazım olacak. Birkaç gün önce yaptığım bir taş kağıt makas oyunu var. İsteyen kodu kullanabilir herhangi bir sorun yok. Kendi editörünüzde kodu deneyebilirsiniz. İsterseniz geliştirip benimle paylaşabilirsiniz. Bu arada kodun ingilizce olma sebebi yabancı kaynaklarda da paylaşırım diye. Bol bol if, elif var. Çalışmak isteyenler inceleyebilirler.


Kod:
@author[/USER]: ElSlayeRR
"""

#Rock - Paper - Scissors
import random

pc =  ["rock", "paper", "scissors"]
print("Welcome. Please indicate your choice.")

choiceuser = str(input("Rock, Paper or Scissors?: ")).lower()
choicepc = random.choice(pc)

"""
Conditions That Going to Happen:
rock - rock
rock - paper
rock - scissors

paper - rock
paper - paper
paper - scissors

scissors - rock
scissors - paper
scissors - scissors
if (choiceuser = "x"), (choicepc = "x")
"""

if choiceuser == "rock" and choicepc == "rock":
   print("Rock and rock it's a tie!")

elif choiceuser == "rock" and choicepc == "paper":
   print("Paper wraps rock, Computer wins :(")
   
elif choiceuser == "rock" and choicepc == "scissors":
   print("Rock breaks scissors, you win!")
   
#First rock end. First paper starts.

elif choiceuser == "paper" and choicepc == "rock":
   print("Paper wraps rock, you win!")
   
elif choiceuser == "paper" and choicepc == "paper":
   print("Paper and paper, it's a tie!")
   
elif choiceuser == "paper" and choicepc == "scissors":
   print("Scissors cut paper, you lose :(")

#First paper end. First scissors starts.

elif choiceuser == "scissors" and choicepc == "rock":
   print("Rock breaks scissors, you lose :(")

elif choiceuser == "scissors" and choicepc == "paper":
   print("Scissors cut paper, you win!")

elif choiceuser == "scissors" and choicepc == "scissors":
   print("Scissors and scissors, it's a tie!")
   
# Conditions end. v
elina sağlık
 
Süper Üye
Katılım
26 Mar 2016
Mesajlar
776
Çözümler
6
Tepki puanı
274
Ödüller
11
10 HİZMET YILI
güzel yapmışsın eline sağlık
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst