猫史档案馆


【Python作品分享】国际象棋【作品秀】

用户:xuanxuan520xuanxuan520查看:1 回复:4 评论:1 创建时间:2023-01-04T11:15:16


【作品展示】

center_image

 

【作品介绍】

三生三世

 

【作品源代码】

import turtle as t
t.colormode(255)
t.penup()
t.speed(0)
colors = [(255,206,158),(209,139,71),(255,206,158)]
for u in range(8):
    for l in range(8):
        t.fillcolor(colors[u % 2 + l % 2])
        t.begin_fill()
        for o in range(5):
            t.forward(50)
            t.left(90)
        t.end_fill()
        t.right(90)
    t.goto(0,-50 *(u + 1))
t.goto(0,0)
black = '♜♞♝♛♚♟'
white = '♖♘♗♕♔♙'
for q in black[0:5]:
    t.write(q, font=('arial', 40))
    t.forward(50)
w = [2, 1, 0]
for i in w:
    t.write(black[i], font=('arial', 40))
    t.forward(50)
t.goto(0, -50)
for e in range(8):
    t.write(black[-1], font=('arial', 40))
    t.forward(50)
t.goto(0, -300)
for e in range(8):
    t.write(white[-1], font=('arial', 40))
    t.forward(50)
t.goto(0, -350)
for q in white[0:5]:
    t.write(q, font=('arial', 40))
    t.forward(50)
w = [2, 1, 0]
for i in w:
    t.write(white[i], font=('arial', 40))
    t.forward(50)
t.done()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
宽容的功夫熊b9LJ宽容的功夫熊b9LJ

如果是一张图的话,我在新版的海龟编辑器打开了qwq

点赞0


评论


Python爱好者Python爱好者

以后遇到代码 forword(), right(), left() 时一定注意可以写成 fd(), rt(), lt() 以后遇到大程序可以省去很多字节

import turtle as t
t.colormode(255)
t.penup()
t.speed(0)
colors = [(255, 206, 158), (209, 139, 71), (255, 206, 158)]
for u in range(8):
    for l in range(8):
        t.fillcolor(colors[u % 2 + l % 2])
        t.begin_fill()
        for o in range(5):
            t.fd(50)
            t.lt(90)
        t.end_fill()
        t.rt(90)
    t.goto(0, -50 * (u + 1))
t.goto(0, 0)
black = '♜♞♝♛♚♟'
white = '♖♘♗♕♔♙'
for q in black[0:5]:
    t.write(q, font=('arial', 40))
    t.fd(50)
w = [2, 1, 0]
for i in w:
    t.write(black[i], font=('arial', 40))
    t.fd(50)
t.goto(0, -50)
for e in range(8):
    t.write(black[-1], font=('arial', 40))
    t.fd(50)
t.goto(0, -300)
for e in range(8):
    t.write(white[-1], font=('arial', 40))
    t.fd(50)
t.goto(0, -350)
for q in white[0:5]:
    t.write(q, font=('arial', 40))
    t.fd(50)
w = [2, 1, 0]
for i in w:
    t.write(white[i], font=('arial', 40))
    t.fd(50)
t.done()

点赞0


评论


技术喵的真传子弟技术喵的真传子弟

所以这是一个标题作品吗(不能操作游玩)

点赞0


评论


summerlili(环境音乐)summerlili(环境音乐)

绘制时间有点长,可以加个t.tracer(False)

点赞0


评论