Simple Python Turtle Graphic and Code: Chess Board
The playing board of Chess created by 4 sets of 16 squares and appropriate placement of the "fillcolor" command. Upon execution of "fillcolor", alternate squares in the two-column set of 16 are colored green because Python Turtle convention color-fills all shapes partly or fully enclosed by the line that connects the initial and final positions of the turtle.
Feel free to copy the basic Python Turtle code that is given below. Don't hesitate to ask questions about the code if you have any. Enjoy! Please comment, like, or subscribe :)
Incidentally, for more graphics and variations, please visit my author url at https://www.amazon.com/author/basicpythonturtleart.url
import turtle
t = turtle.Turtle() #Definitions and Initializations
screen = turtle.Screen()
t.pensize(4)
t.pencolor("green")
square_side_length = 60 #side length of 1 of the 64 squares; Changeable
x = -3 * square_side_length #x value of point where drawing starts
def squares(): #Procedure for drawing a group of 16 squares in 2 columns
t.fillcolor("green") #Color fill, by Python Turtle convention, applied to shapes enclosed by
t.begin_fill() #line connecting initial and final positions of moving turtle
for j in range(4): #For 4 groups of lines, each of which partially draws 2 rows of squares
t.forward(square_side_length) #Initial movement of turtle for a group of lines; initial position of
t.right(90) #turtle at x = -3 * square_side_length, not at -4 ..., to ensure that
t.forward(square_side_length) #the color-filled squares are alternate or do not share sides
t.right(90) #Turtle direction towards 2nd horizontal line
t.forward(2 * square_side_length) #Movement of turtle over horizontal line measuring 2 * square_side_length
t.left(90) #Turtle direction downward
t.forward(square_side_length) #Movement of turtle over vertical line measuring square_side_length
t.left(90) #Turtle direction towards 3rd horizontal line
t.forward(square_side_length) #Movement of turtle over horizontal line measuring square_side_length
t.end_fill() #Execution of green color-fill on 8 enclosed and alternating squares
def chess_board_outline(): #For outline of the whole chess board
for i in range(4):
t.forward(8 * square_side_length)
t.right(90)
for i in range(4): #Python_graphic start of drawing procedure; for 4 groups of 16 squares -- 8 on
t.penup() #first column and another 8 on the 2nd
t.goto(x, 4 * square_side_length) #Initial position of turtle to draw a group of 16 squares
t.pendown()
squares() #Function call to draw a group of 16 squares
x += 2 * square_side_length #x value change for the starting point of drawing the next group of
t.penup() #16 squares
t.goto(-4 * square_side_length, 4 * square_side_length) #Starting point to draw the outline of the whole chess board
t.pendown()
chess_board_outline()
t.hideturtle()
screen.exitonclick()
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Simple Python Turtle Graphic and Code: Chess Board», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.