国际象棋盘
Posted youngtw
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了国际象棋盘相关的知识,希望对你有一定的参考价值。
import turtle turtle.speed(30) turtle.penup() off = True for y in range(-40, 30 + 1, 10): for x in range(-40, 30 + 1, 10): if off: turtle.goto(x, y) turtle.pendown() turtle.begin_fill() turtle.color("black") turtle.forward(10) turtle.left(90) turtle.forward(10) turtle.left(90) turtle.forward(10) turtle.left(90) turtle.forward(10) turtle.left(90) turtle.end_fill() turtle.penup() else: turtle.goto(x, y) turtle.pendown() turtle.forward(10) turtle.left(90) turtle.forward(10) turtle.left(90) turtle.forward(10) turtle.left(90) turtle.forward(10) turtle.left(90) turtle.penup() off = bool(int(off) - 1) off = bool(int(off) - 1) turtle.hideturtle() turtle.done()
以上是关于国际象棋盘的主要内容,如果未能解决你的问题,请参考以下文章