豆包 VS Kimi VS DeepSeek:三种AI的绘图对决
最近AI话题引爆全网,豆包、Kimi和DeepSeek活跃在人们视野中,在各个领域大显神通。那么仅绘图方面而言,哪种AI模型会更胜一筹呢?请拭目以待!
指定任务:下“用Python绘制五星红旗”的相同指令以控制变量,生成的代码将在Python123上统一运行代码测试。
1.豆包
代码如下:
豆包版五星红旗
import turtle
# 设置画布和画笔
screen = turtle.Screen()
screen.bgcolor("red")
pen = turtle.Turtle()
pen.speed(10)
pen.hideturtle()
# 定义一些常量
width = 600
height = 400
big_star_radius = 60
small_star_radius = 20
# 计算五角星的顶点角度
angle = 144
# 定义绘制五角星的函数
def draw_star(t, radius, x, y):
t.penup()
t.goto(x, y)
t.setheading(0)
t.forward(radius)
t.left(162)
t.pendown()
t.begin_fill()
t.fillcolor("yellow")
for _ in range(5):
t.forward(2 * radius * 0.382)
t.left(angle)
t.end_fill()
# 绘制大五角星
big_star_x = -width / 2 + 100
big_star_y = height / 2 - 100
draw_star(pen, big_star_radius, big_star_x, big_star_y)
# 定义小五角星的位置和角度
small_stars_info = [
# (x, y, angle)
(-width / 2 + 250, height / 2 - 60, 30),
(-width / 2 + 270, height / 2 - 120, 0),
(-width / 2 + 270, height / 2 - 180, 350),
(-width / 2 + 250, height / 2 - 240, 340)
]
# 绘制小五角星
for x, y, a in small_stars_info:
pen.penup()
pen.goto(x, y)
pen.setheading(a)
draw_star(pen, small_star_radius, x, y)
# 保持窗口打开
turtle.done()
豆包的表现有些差强人意,星星的边框颜色不对,其在红旗中的位置也偏零散,而且四颗小星星的角没有对准大星星。
向豆包反馈并再测试一次:
豆包版2.0
import turtle
# 设置画布和画笔
screen = turtle.Screen()
screen.bgcolor("red")
pen = turtle.Turtle()
pen.speed(10)
pen.hideturtle()
# 定义国旗尺寸
width = 600
height = 400
# 定义五角星的绘制函数
def draw_star(t, radius, center_x, center_y):
t.pencolor("yellow")
t.fillcolor("yellow")
t.penup()
t.goto(center_x, center_y)
t.setheading(0)
t.forward(radius)
t.left(162)
t.pendown()
t.begin_fill()
for _ in range(5):
t.forward(2 * radius * 0.382)
t.left(144)
t.end_fill()
# 绘制大五角星
big_star_radius = 0.15 * height
big_star_center_x = -0.3 * width
big_star_center_y = 0.3 * height
draw_star(pen, big_star_radius, big_star_center_x, big_star_center_y)
# 定义小五角星的位置、角度和半径
small_star_radius = 0.05 * height
small_star_positions = [
(-0.1 * width, 0.45 * height, 30),
(-0.05 * width, 0.35 * height, 0),
(-0.05 * width, 0.2 * height, 350),
(-0.1 * width, 0.1 * height, 340)
]
# 绘制小五角星
for x, y, angle in small_star_positions:
pen.penup()
pen.goto(x, y)
pen.setheading(angle)
draw_star(pen, small_star_radius, x, y)
# 保持窗口打开
turtle.done()
2.Kimi
代码如下:
Kimi版
import turtle
# 初始化画布
screen = turtle.Screen()
screen.setup(width=600, height=400) # 国旗宽高比为 3:2
# 设置画笔
star = turtle.Turtle()
star.speed(0) # 设置画笔速度
star.hideturtle() # 隐藏画笔箭头
# 绘制红色背景
def draw_background():
star.penup()
star.goto(-300, 200) # 左上角
star.pendown()
star.color("#DC143C", "#DC143C") # 使用深红色
star.begin_fill()
for _ in range(2):
star.forward(600) # 宽度
star.right(90)
star.forward(400) # 高度
star.right(90)
star.end_fill()
# 绘制五角星
def draw_star(center_x, center_y, size, angle=0):
star.penup()
star.goto(center_x, center_y)
star.setheading(angle) # 设置五角星的方向
star.forward(size) # 移动到五角星的起始点
star.left(162) # 调整角度
star.pendown()
star.color("yellow", "yellow") # 五角星颜色
star.begin_fill()
for _ in range(5):
star.forward(size * 3) # 五角星边长
star.right(144) # 内角
star.end_fill()
# 绘制大五角星
def draw_big_star():
draw_star(-220, 150, 30, angle=0) # 大五角星位置和大小
# 绘制小五角星
def draw_small_stars():
# 小五角星的位置和旋转角度
small_stars = [
(-150, 180, 10, 30), # 第一颗小五角星
(-130, 140, 10, 15), # 第二颗
(-130, 100, 10, -15), # 第三颗
(-150, 60, 10, -30) # 第四颗
]
for x, y, size, angle in small_stars:
draw_star(x, y, size, angle)
# 主程序
if __name__ == "__main__":
draw_background() # 绘制红色背景
draw_big_star() # 绘制大五角星
draw_small_stars() # 绘制四颗小五角星
screen.mainloop() # 保持窗口打开
Kimi的表现更是“天外有天,人外有人”,星星位置严重偏移先不提,本该是背底的红色只呈现了一条线,与标准形象大相径庭。
经过多次反复调试,得到代码如下:
Kimi版2.0
import turtle
def draw_star(center, size, angle=0):
turtle.penup()
turtle.goto(center)
turtle.setheading(angle)
turtle.forward(size / 2)
turtle.left(162)
turtle.pendown()
turtle.begin_fill()
for _ in range(5):
turtle.forward(size)
turtle.right(144)
turtle.end_fill()
turtle.penup()
def draw_flag():
# 设置画布
turtle.setup(600, 400)
turtle.bgcolor("red")
turtle.speed(0)
turtle.color("yellow") # 设置星星颜色为黄色
# 绘制大星星
draw_star((-200, 100), 50)
# 绘制小星星
small_stars = [
{"pos": (-150, 180), "angle": -15},
{"pos": (-120, 140), "angle": -40},
{"pos": (-120, 80), "angle": -70},
{"pos": (-150, 20), "angle": -100}
]
for star in small_stars:
draw_star(star["pos"], 20, star["angle"])
# 隐藏海龟
turtle.hideturtle()
turtle.done()
draw_flag()
3.DeepSeek
代码如下:
DeepSeek版
from turtle import *
"""绘制五角星,大小可变"""
def wujiaoxing(size):
for i in range(6):
forward(size)
right(144)
"""绘制红色矩形"""
color("red","red")
begin_fill()
forward(192)
left(90)
forward(128)
left(90)
forward(192)
left(90)
forward(128)
end_fill()
"""绘制第一个大五角星"""
up()
goto(30,115)
down()
color("yellow","yellow")
begin_fill()
left(20)
wujiaoxing(30)
end_fill()
"""绘制第一个小五角星"""
up()
goto(55,110)
down()
color("yellow","yellow")
begin_fill()
right(10)
wujiaoxing(10)
end_fill()
"""绘制第二个小五角星"""
up()
goto(60,100)
down()
color("yellow","yellow")
begin_fill()
left(40)
wujiaoxing(10)
end_fill()
"""绘制第三个小五角星"""
up()
goto(70,87)
down()
color("yellow","yellow")
begin_fill()
right(30)
wujiaoxing(10)
end_fill()
"""绘制第四个小五角星"""
up()
goto(50,70)
down()
color("yellow","yellow")
begin_fill()
right(20)
wujiaoxing(10)
end_fill()
"""绘制文字"""
up()
goto(65,-50)
down()
color("black")
write("五星红旗",font=("微软雅黑",10))
hideturtle()
done()
DeepSeek给出的绘图完成度最佳,没有特别明显的技术破绽,但在细节方面还是有一些小瑕疵,比如四小星离大星稍近,这点有待改进。
总结
对比以上三种模型,在绘图方面,DeepSeek最为简洁省事,仅一次便能达到较高的完成度;豆包次之,需几次调试才初具成形;Kimi绘图水平最低,反馈调节次数较多,期间伴随多次编译失败。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架