0
私は現在、ロック、ペーパー、はさみをプログラムしようとしています! Pythonでのゲーム。私が直面している問題は、勝つとスコアは変わっていないように見えます。勝利したら、コンピュータはまだ私が亡くなったと言います。これは方法によって、すべて私自身のプログラミングで、私はここで年6にいる私のコードです:ロック、ペーパー、ハサミ! Pythonでのゲーム。スコアと勝者の出力が変化しない
print("Welcome to my Rock, Paper, Scissors! game. Its quite simple. 'R' = Rock, 'P' = Paper and 'S' = Scissors. All of your inputs must begin with a capital letter. Good luck! Here we go!")
import random
Computer_RPS = ["Rock", "Paper", "Scissors"]
def RPS():
Cpoints = 0
Upoints = 0
one = 1
User_choice1 = input("Rock, Paper, Scissors!...")
Computer_choice1 = (random.choice(Computer_RPS))
"""
while (User_choice1 != "Rock" or "Paper" or "Scissors" or "R" or "P" or "S"):
User_choice1 = input("That value is not valid. Lets try again; Rock, Paper, Scissors!...")
"""
if User_choice1 == Computer_choice1:
print("Draw. Getting tense!...")
print("I chose:" + (Computer_choice1))
print("The score stands at: " + str(Cpoints) + " to me and " + str(Upoints) + " to you.")
elif Computer_choice1 == "Rock" and User_choice1 == "S" or "Scissors":
(Cpoints) + (one)
print("Good try. Better luck next time!")
print("I chose:" + (Computer_choice1))
print("The score stands at: " + str(Cpoints) + " to me and " + str(Upoints) + " to you.")
elif Computer_choice1 == "Paper" and User_choice1 == "R" or "Rock":
(Cpoints) + (one)
print("Unlucky. But that means 1 point to me!")
print("I chose:" + (Computer_choice1))
print("The score stands at: " + str(Cpoints) + " to me and " + str(Upoints) + " to you.")
elif Computer_choice1 == "Scissors" and User_choice1 == "P" or "Paper":
(Cpoints) + (one)
print("Unlucky. But that means 1 point to me!")
print("I chose:" + (Computer_choice1))
print("The score stands at: " + str(Cpoints) + " to me and " + str(Upoints) + " to you.")
else:
print("Well Done! You beat me. :'-( Never mind. One point to you.")
Upoints += 1
RPS()
RPS()
RPS()
、ここでは私のコードとそれの出力のスクリーンショットです: My code and its output.
ご協力いただければ幸いです。私の質問を読んでいただきありがとうございました。