0
나는 프로그래밍에 대한 사전 경험이 없으며 이번 학기에 처음으로 프로그래밍 수업을 듣고 있으며, 내가 잘못하고있는 부분에 대해 도움을 필요로합니다. 여전히 컴퓨터 상대에 추가해야하지만 한 가지 문제는 보류 부분이 때로는 작동합니다. 다시 굴러 보거나 붙잡 으려고 할 때 H를 누르고 있으면 가끔씩 움직이게되고 R은 다시 굴러 가듯이 움직입니다. 어떤 도움이라도 대단히 감사하겠습니다.PIG 주사위 게임에 대한 도움이나 조언이 필요합니다.
이것은 내가 지금까지 무엇을 가지고 :
import random
p1 = 0
p2 = 0
print ("Score" "\tYou :", p1, "\tAI :", p2)
still_playing = True
hold_pass_input = False
while still_playing:
while True:
p1_turn = input ("Your turn. Hit enter to continue.")
p1_score = p1
p2_score = p2
break
while (p1_score >= 0 and p1_score <= 50):
die_roll = random.randint (1,6)
if die_roll > 1:
p1_score = die_roll + p1_score
print("Die :", die_roll, "Pot :", p1_score,)
hold_pass = input("(R)oll again or (H)old?:").upper()
while hold_pass_input == False:
if hold_pass in ["r", "R"]==["r", "R"]:
hold_pass_input = True
break
elif hold_pass in["h","H"]==["h","H"]:
hold_pass_input = False
print ("Score" "\tYou :", p1_score, "\tAI :", p2_score)
print("It's the computers turn. Hit enter to continue.")
break
else:
hold_pass_input = False
print("Use only R, r, H, h")
hold_pass = input("(R)oll again or (H)old?:").upper()
elif die_roll <= 1:
p1_score = p1_score - p1_score
print("Die :", die_roll, "Pot :", p1_score, "Bust")
p2_turn = input("It's the computers turn. Hit enter to continue.")