It's a dice game The horse needs to move both at once, but it doesn't work, so I'll ask you a question

Asked 2 weeks ago, Updated 2 weeks ago, 1 views

import random
pl_pos = 1
com_pos = 1
def board():
    print("•" * (pl_pos - 1) + "P" + "•" * (30 - pl_pos) + "Goal")
    print("•" * (com_pos - 1) + "C" + "•" * (30 - com_pos) + "Goal")

board()
print ("Dice Game, Start!")
while True:
    input ("Press Enter to move your horse")
    pl_pos = pl_pos + random.randint(1, 6)
    if pl_pos > 30:
        pl_pos = 30
    board()
    if pl_pos == 30:
        print ("You're the winner.")!")
        break
    input ("Press Enter to move the computer's horse")
    com_pos = com_pos + random.randint(1, 6)
    if com_pos > 30:
        com_pos = 30
    board()
    if com_pos == 30:
        print ("Computer Wins!")
        break

If you do it, p and c, which makes sense, move I want you to move both at once

python3

2022-09-20 08:42

1 Answers

You only need to use the board() once at the end


2022-09-20 08:42

If you have any answers or tips


© 2022 pinfo. All rights reserved.