找传奇、传世资源到传世资源站!

Python三子棋游戏

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

由python编写的三子棋游戏
Python三子棋游戏 Python-第1张
#main program begins here
while True:
    i=0
    while (i<3):
        print(mark[board[i * 3]],mark[board[i * 3 1]], mark[board[i * 3 2]])
        i =1

    if checkcircle():
        print("Player1 wins!")
        break
    elif checkcross():
        print("Player2 wins!")
        break
    elif checkfull():
        print("It's a draw.")
        break

    while True:
        while True:
            y =int(input("line:"))
            if 1 <= y <= 3:
                break
            else:
                print("The inputshould between 1 and 3")
        while True:
            x =int(input("column:"))
            if 1 <= x <= 3:
                break
            else:
                print("The inputshould between 1 and 3")
        if board[y*3-4 x] == 1 orboard[y*3-4 x] == 2:
            print("No place at thisposition.")
        else:
            break
    if j > 1:
        j = 0
    if j == 0:
        circlebd(y, x)
    elif j == 1:
        crossbd(y, x)
    j =1

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复