猫史档案馆


【Python作品分享】新的作品-3-1【作业帖】

用户:极限小白极限小白查看:0 回复:0 评论:0 创建时间:2021-09-25T17:49:31


【作品展示】

center_image

 

【作品介绍】

这哪里错了啊,帮忙找找错呗

 

【作品源代码】

import turtle
import time
import sys as s

__Pen = turtle.Pen()


def huabu():

    __Pen.penup()
    __Pen.goto(150, 150)
    __Pen.pendown()
    __Pen.setheading((-90))
    for __count in range(4):
        __Pen.forward(300)
        __Pen.right(90)
    __Pen.penup()
    __Pen.goto(50, 150)
    __Pen.pendown()
    __Pen.goto(50, (-150))
    __Pen.goto((-50), (-150))
    __Pen.goto((-50), 150)
    __Pen.penup()
    __Pen.goto((-150), 50)
    __Pen.pendown()
    __Pen.goto(150, 50)
    __Pen.goto(150, (-50))
    __Pen.goto((-150), (-50))
    __Pen.penup()
    __Pen.goto((-100), 100)
    __Pen.write(x['1,1'])
    __Pen.goto(0, 100)
    __Pen.write(x['1,2'])
    __Pen.goto(100, 100)
    __Pen.write(x['1,3'])
    __Pen.goto((-100), 0)
    __Pen.write(x['2,1'])
    __Pen.goto(0, 0)
    __Pen.write(x['2,2'])
    __Pen.goto(100, 0)
    __Pen.write(x['2,3'])
    __Pen.goto((-100), (-100))
    __Pen.write(x['3,1'])
    __Pen.goto(0, (-100))
    __Pen.write(x['3,2'])
    __Pen.goto(100, (-100))
    __Pen.write(x['3,3'])

def shu():

    for i in x:
        if (a != i):
            c += 1
    if (c == 9):
        print('不存在此坐标!')
    else:
        ee += 1
    for i in 喵:
        if (a == i):
            c += 1
    if (c == 9):
        print('这里已经下过了')
    else:
        ee += 1
    if (ee == 2):
        b.append(a)
        x[a] = ha
        break
    print('请重新输入!')

while True:
    d = 0
    b = []
    x = {'1,1': '', '2,1': '', '3,1': '', '1,2': '', '2,2': '', '3,2': '', '1,3': '', '2,3': '', '3,3': '', '1,4': '', '2,4': '', '3,4': ''}
    __Pen.speed(1000)
    __Pen.hideturtle()
    ha = '#'
    for __count in range(9):
        __Pen.clear()
        huabu()
        print('现在轮到', ha, '下')
        while True:
            i = 0
            c = 0
            ee = 0
            喵 = []
            a = input('请输入坐标:')
            if (x['1,1'] == x['2,1'] and x['2,1'] == x['3,1'] and x['1,1'] != ''):
                print(ha, '胜利!')
                while True:
                    ww = input('是否继续?(是/否)')
                    if (ww == '是' or ww == '否'):
                        break
                    print('请输入是或否!')
                if (ww == '否'):
                    s.exit()
                else:
                    break
            elif (x['1,2'] == x['2,2'] and x['2,2'] == x['3,2'] and x['1,2'] != ''):
                print(ha, '胜利!')
                while True:
                    ww = input('是否继续?(是/否)')
                    if (ww == '是' or ww == '否'):
                        break
                    print('请输入是或否!')
                if (ww == '否'):
                    s.exit()
                else:
                    break
            elif (x['1,3'] == x['2,3'] and x['2,3'] == x['3,3'] and x['1,3'] != ''):
                print(ha, '胜利!')
                while True:
                    ww = input('是否继续?(是/否)')
                    if (ww == '是' or ww == '否'):
                        break
                    print('请输入是或否!')
                if (ww == '否'):
                    s.exit()
                else:
                    break
            elif (x['1,1'] == x['1,2'] and x['1,2'] == x['1,3'] and x['1,3'] != ''):
                print(ha, '胜利!')
                while True:
                    ww = input('是否继续?(是/否)')
                    if (ww == '是' or ww == '否'):
                        break
                    print('请输入是或否!')
                if (ww == '否'):
                    s.exit()
                else:
                    break
            elif (x['2,1'] == x['2,2'] and x['2,2'] == x['2,3'] and x['2,3'] != ''):
                print(ha, '胜利!')
                while True:
                    ww = input('是否继续?(是/否)')
                    if (ww == '是' or ww == '否'):
                        break
                    print('请输入是或否!')
                if (ww == '否'):
                    s.exit()
                else:
                    break
            elif (x['3,1'] == x['3,2'] and x['3,2'] == x['3,3'] and x['3,3'] != ''):
                print(ha, '胜利!')
                while True:
                    ww = input('是否继续?(是/否)')
                    if (ww == '是' or ww == '否'):
                        break
                    print('请输入是或否!')
                if (ww == '否'):
                    s.exit()
                else:
                    break
            elif (x['1,1'] == x['2,2'] and x['2,2'] == x['3,3'] and x['3,3'] != ''):
                print(ha, '胜利!')
                while True:
                    ww = input('是否继续?(是/否)')
                    if (ww == '是' or ww == '否'):
                        break
                    print('请输入是或否!')
                if (ww == '否'):
                    s.exit()
                else:
                    break
            elif (x['3,1'] == x['2,2'] and x['2,2'] == x['1,3'] and x['1,3'] != ''):
                print(ha, '胜利!')
                while True:
                    ww = input('是否继续?(是/否)')
                    if (ww == '是' or ww == '否'):
                        break
                    print('请输入是或否!')
                if (ww == '否'):
                    s.exit()
                else:
                    break
            else:
                pass
        jian()
        if (ha == '#'):
            ha = '%'
        else:
            ha = '#'
    print('平局!')
    ww()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页