generated from mwc/problemset_typeface
I defined all letters.
I was very frustrated witht he positioning of the proofs but once I got it, i felt relieved and accomplished.
This commit is contained in:
720
typeface.py
720
typeface.py
@@ -10,82 +10,750 @@
|
||||
# the turtle should move a distance of sqrt(x)
|
||||
|
||||
from turtle import *
|
||||
from turtle import goto
|
||||
from math import sqrt
|
||||
def draw_square(unit):
|
||||
for i in range(4):
|
||||
forward(unit)
|
||||
left(90)
|
||||
def start(unit):
|
||||
penup()
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit)
|
||||
pendown()
|
||||
forward(unit*6)
|
||||
right(90)
|
||||
|
||||
|
||||
|
||||
def draw_letter_a(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit*6)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
for i in range(2):
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit)
|
||||
penup()
|
||||
right(90)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit)
|
||||
pendown()
|
||||
draw_square(unit*2)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
def draw_letter_b(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
right(135)
|
||||
penup()
|
||||
forward(unit*sqrt(2))
|
||||
right(45)
|
||||
pendown()
|
||||
draw_square(unit*2)
|
||||
penup()
|
||||
left(90)
|
||||
forward(unit*3)
|
||||
pendown()
|
||||
right(90)
|
||||
draw_square(unit)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
def draw_letter_c(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*4)
|
||||
left(90)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
def draw_letter_d(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit*6)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
penup()
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit)
|
||||
pendown()
|
||||
forward(unit)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
def draw_letter_e(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*3)
|
||||
left(90)
|
||||
forward(unit*1.5)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*1.5)
|
||||
left(90)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
def draw_letter_f(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*3)
|
||||
left(90)
|
||||
forward(unit*1.5)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*2.5)
|
||||
right(90)
|
||||
forward(unit)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
def draw_letter_g(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*4)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
|
||||
def draw_letter_h(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*2.5)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*2.5)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*6)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*2.5)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*2.5)
|
||||
right(90)
|
||||
forward(unit)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
def draw_letter_i(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
penup()
|
||||
forward(unit)
|
||||
start(unit)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*6)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
def draw_letter_j(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
penup()
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit)
|
||||
pendown()
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit*1.5)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*1.5)
|
||||
left(90)
|
||||
forward(unit*4)
|
||||
left(90)
|
||||
forward(unit)
|
||||
left(90)
|
||||
forward(unit*.5)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*1.5)
|
||||
right(90)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit*6)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
def draw_letter_k(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*1.5)
|
||||
right(90)
|
||||
forward(unit*2.5)
|
||||
left(150)
|
||||
forward(unit*2.9)
|
||||
right(60)
|
||||
forward(unit*1)
|
||||
right(120)
|
||||
forward(unit*3.5)
|
||||
left(60)
|
||||
forward(unit*3.5)
|
||||
right(120)
|
||||
forward(unit*1)
|
||||
right(60)
|
||||
forward(unit*2.9)
|
||||
left(150)
|
||||
forward(unit*2.5)
|
||||
right(90)
|
||||
forward(unit*1.5)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def draw_letter_l(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*5)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
def draw_letter_m(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit)
|
||||
right(65)
|
||||
forward(unit*2.4)
|
||||
left(130)
|
||||
forward(unit*2.4)
|
||||
right(65)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*6)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*3)
|
||||
left(135)
|
||||
forward(unit*1.4)
|
||||
right(90)
|
||||
forward(unit*1.4)
|
||||
left(135)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def draw_letter_n(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit)
|
||||
right(57)
|
||||
forward(sqrt((unit*3)**2+(unit*2)**2))
|
||||
left(147)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*6)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(57)
|
||||
forward(sqrt((unit*3)**2+(unit*2)**2))
|
||||
left(147)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
|
||||
def draw_letter_o(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit*6)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
penup()
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit)
|
||||
pendown()
|
||||
draw_square(unit*2)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
def draw_letter_p(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
penup()
|
||||
right(108)
|
||||
forward(sqrt((unit*3)**2+(unit*1)**2))
|
||||
right(72)
|
||||
forward(unit)
|
||||
pendown()
|
||||
forward(unit)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
def draw_letter_q(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
penup()
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
pendown()
|
||||
forward(unit*5)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit*5)
|
||||
right(90)
|
||||
forward(unit)
|
||||
left(135)
|
||||
forward(unit*1.5)
|
||||
right(135)
|
||||
forward(unit)
|
||||
right(45)
|
||||
forward(unit*1.5)
|
||||
left(45)
|
||||
forward(unit*2)
|
||||
penup()
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit)
|
||||
pendown()
|
||||
for i in range(2):
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit)
|
||||
left(90)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
|
||||
def draw_letter_r(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit)
|
||||
left(116.5)
|
||||
forward(unit*sqrt(5))
|
||||
right(116.5)
|
||||
forward(unit)
|
||||
right(63.5)
|
||||
forward(unit*sqrt(5))
|
||||
left(153.5)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
penup()
|
||||
right(90)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
pendown()
|
||||
forward(unit)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
def draw_letter_s(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
penup()
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit)
|
||||
pendown()
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*1.5)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*3.5)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*1.5)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*3.5)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
def draw_letter_t(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
penup()
|
||||
forward(unit*3)
|
||||
left(90)
|
||||
forward(unit)
|
||||
pendown()
|
||||
forward(unit*5)
|
||||
left(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit)
|
||||
right(90)
|
||||
forward(unit)
|
||||
left(90)
|
||||
forward(unit*5)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
def draw_letter_u(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*1.5)
|
||||
right(90)
|
||||
forward(unit*5)
|
||||
left(90)
|
||||
forward(unit*1)
|
||||
left(90)
|
||||
forward(unit*5)
|
||||
right(90)
|
||||
forward(unit*1.5)
|
||||
right(90)
|
||||
forward(unit*6)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
def draw_letter_v(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
penup()
|
||||
forward(unit*3)
|
||||
left(90)
|
||||
forward(unit)
|
||||
pendown()
|
||||
left(10)
|
||||
forward(unit*sqrt(37))
|
||||
right(100)
|
||||
forward(unit*1.5)
|
||||
right(80)
|
||||
forward(unit*3.2)
|
||||
left(160)
|
||||
forward(unit*3.2)
|
||||
right(80)
|
||||
forward(unit*1.5)
|
||||
right(100)
|
||||
forward(unit*sqrt(37))
|
||||
right(80)
|
||||
forward(unit*2)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
def draw_letter_w(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
start(unit)
|
||||
forward(unit*1.5)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
left(153)
|
||||
forward(unit*sqrt(1.25))
|
||||
right(126)
|
||||
forward(unit*sqrt(1.25))
|
||||
left(153)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit*1.5)
|
||||
right(90)
|
||||
forward(unit*6)
|
||||
right(90)
|
||||
forward(unit*1.5)
|
||||
right(63)
|
||||
forward(unit*sqrt(1.25))
|
||||
left(126)
|
||||
forward(unit*sqrt(1.25))
|
||||
right(63)
|
||||
forward(unit*1.5)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
def draw_letter_x(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
penup()
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit)
|
||||
pendown()
|
||||
forward(unit*2)
|
||||
right(56)
|
||||
forward(unit*sqrt((1.5)**2+1))
|
||||
left(112)
|
||||
forward(unit*sqrt((1.5)**2+1))
|
||||
right(56)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*1.5)
|
||||
right(63)
|
||||
forward(unit*sqrt((0.5)**2+1))
|
||||
left(126)
|
||||
forward(unit*sqrt((0.5)**2+1))
|
||||
right(63)
|
||||
forward(unit*1.5)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
right(56)
|
||||
forward(unit*sqrt((1.5)**2+1))
|
||||
left(112)
|
||||
forward(unit*sqrt((1.5)**2+1))
|
||||
right(56)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*1.5)
|
||||
right(63)
|
||||
forward(unit*sqrt((0.5)**2+1))
|
||||
left(126)
|
||||
forward(unit*sqrt((0.5)**2+1))
|
||||
right(63)
|
||||
forward(unit*1.5)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
|
||||
def draw_letter_y(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
penup()
|
||||
forward(unit*2.5)
|
||||
left(90)
|
||||
forward(unit)
|
||||
pendown()
|
||||
forward(unit*.5)
|
||||
right(90)
|
||||
forward(unit*1.5)
|
||||
left(90)
|
||||
forward(unit*2.5)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*3)
|
||||
right(90)
|
||||
forward(unit*1.5)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit*.5)
|
||||
left(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*6)
|
||||
right(90)
|
||||
forward(unit*3.5)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
|
||||
|
||||
def draw_letter_z(unit):
|
||||
pass
|
||||
x_pos, y_pos= pos()
|
||||
penup()
|
||||
forward(unit*2)
|
||||
left(90)
|
||||
forward(unit)
|
||||
pendown()
|
||||
forward(unit*2)
|
||||
right(45)
|
||||
forward(unit*sqrt(8))
|
||||
left(135)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
right(45)
|
||||
forward(unit*sqrt(8))
|
||||
left(135)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*2)
|
||||
right(90)
|
||||
forward(unit*4)
|
||||
teleport(x_pos, y_pos)
|
||||
setheading(0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user