Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
2
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

@Ringa_hyj

pythonでスゴロクゲームと足し算ゲーム

同じ変数への代入等あり

テキストにあった内容を使ってpythonの挙動確認と備忘録

30までの交互スゴロクゲーム

pl_pos = 1
com_pos = 1

while True:

    input("enter-playerが動く")
    pl_pos = pl_pos + random.randint(1,6)

    if pl_pos>30:
        pl_pos = 30

    banmen()

    if pl_pos ==30:
        print("plのかち")
        break

    input("enter-comが動く")
    com_pos = com_pos + random.randint(1,6)

    if com_pos>30:
        com_pos = 30

    banmen()

    if com_pos ==30:
        print("comのかち")
        break

足し算ゲーム

A = random.randint(1,100)
B = random.randint(1,100)

correct = A + B

ans = input("A = "+ str(A) + " B = "+str(B) +" A+Bの合計は?")
if ans == str(correct):
    print("正解")
else:
    print("違います" + str(correct) +"です")

以上

Pythonでつくる ゲーム開発 入門講座より

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
2
Help us understand the problem. What are the problem?