Python ile Taş Kağıt Makas Oyunu

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Uzman Üye
Katılım
8 May 2020
Mesajlar
154
Tepki puanı
5
Ödüller
5
Yaş
30
6 HİZMET YILI
eline sağlık. phytonun sınırı yok gerçekten.
 
Uzman Üye
Katılım
5 May 2020
Mesajlar
296
Çözümler
2
Tepki puanı
16
Yaş
26
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
nice try eline sağlık
 
Onaylı Üye
Katılım
3 Nis 2019
Mesajlar
54
Tepki puanı
0
Yaş
31
7 HİZMET YILI
eline sağlık inşallah daha iyi yerlere gelirsin yazılım konusunda
 
Mad Pennywise
Uzman Üye
Katılım
9 Ara 2017
Mesajlar
244
Tepki puanı
69
Ödüller
4
Sosyal
8 HİZMET YILI
python programını yeni öğrenmeye başladım, editör olarak notepad ++ var, visual studio code uygulamasını indirip eklentiye pythonuda kurdum, bu kodu nasıl deneyebilirim? nereye ekleyip nasıl çalıştıracağım ?
 
Banlı Üye
Katılım
12 Eki 2017
Mesajlar
477
Çözümler
6
Tepki puanı
45
Yaş
26
8 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
başlangıç için yapanlar için fena değil
 
ϟ 塔哈
Seçkin Üye
Katılım
8 Haz 2019
Mesajlar
307
Çözümler
1
Tepki puanı
13
Ödüller
4
Yaş
30
6 HİZMET YILI
kod da her sacimde bir tanimlama yapmak yerine 3 durumu bir kes tanimlayip secimlerer gore de oraya yonlendirseydin hem spagetti kod olmamis olurdu hem de daha verimli calisirdi.
 
Onaylı Üye
Katılım
27 May 2019
Mesajlar
53
Çözümler
2
Tepki puanı
1
Yaş
36
7 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
baya uğraşmışsın belli
 
Onaylı Üye
Katılım
26 Haz 2020
Mesajlar
50
Tepki puanı
0
Ödüller
2
Yaş
44
5 HİZMET YILI
Euif I knew hwo to solve it, i woudl help you sorry
 
Seçkin Üye
Katılım
20 Haz 2020
Mesajlar
298
Çözümler
2
Tepki puanı
3
Ödüller
3
Sosyal
5 HİZMET YILI
Bugün Python dilinde taş, kağıt, makas oyunu yapacağız. Kodumuza başlarken random kütüphanesini import ediyoruz
 
Onaylı Üye
Katılım
29 Haz 2020
Mesajlar
83
Tepki puanı
8
Ödüller
4
Yaş
27
5 HİZMET YILI
if elifleri azaltman iyi olabilir ama bunu yeni başlayanlar için hazırladıysam eline sağlık bende bi ara amiral battı yapmayı denemiştim 5 sayfa oldu en son ve çalışması sınıf arkadaşlarımla 1 hafta vermiştik :D
 
Üye
Katılım
30 Haz 2020
Mesajlar
8
Tepki puanı
0
Yaş
25
5 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
eyw
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst