-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path8_Chessboard.py
More file actions
50 lines (38 loc) · 1.07 KB
/
8_Chessboard.py
File metadata and controls
50 lines (38 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Faisal Al- taie
# Computing Science 10
# Henry Wise Wood School
# 2021-2022 semester 1
# October 14th, 2021
# import turtle library
import turtle
# set vansh as our variable
vansh = turtle.Turtle()
# set values
x = 0
y = 0
b = "black"
# creation of rows
for c in range(8):
vansh.penup()
vansh.goto(x, y)
vansh.pendown()
vansh.speed(0)
for r in range(8):
# filling in colour.
# if the colum is divisible by 0 and the colum is divisible by 0 square is white
if c % 2 == 0 and r % 2 == 0:
vansh.fillcolor(b)
vansh.begin_fill()
# if the colum is not divisible by 0 and the row is not divisible by 0 then the square is black
elif c % 2 == 1 and r % 2 == 1:
vansh.fillcolor(b)
vansh.begin_fill()
# drawing square
for s in range(5):
vansh.forward(50)
if s != 4:
vansh.right(90)
# end the filling of colour
vansh.end_fill()
# moving downwards
y -= 50