generated from mwc/problemset_typeface
All of my letters work perfectly fine n their own. However, when I check with commit, some of my grids are rotated and I am not sure why. but I submit my work anyway. It did frustrate me that my end-work didn't look how it was supposed to, but individually they look perfectly fine. I spent a good amount of time catching up on this course work so I think being in the same productive flow for a while helped me get this assignment done. I did have to re-do the curves multiple times, but I knew what I wanted my end-product to look like so I did my best.
163 lines
2.6 KiB
Python
163 lines
2.6 KiB
Python
#typeface.py
|
|
# By Chris Proctor and _________
|
|
|
|
# Contains one function for each letter in the English alphabet.
|
|
# Each function should draw its letter at a scale of `unit`, and then
|
|
# return back to the same position and heading where it started.
|
|
|
|
# Note: The `sqrt` function from math may be helpful--if you want to
|
|
# move the turtle along the diagonal of a square with side length x,
|
|
# the turtle should move a distance of sqrt(x)
|
|
|
|
from turtle import circle, left,right,forward,backward, penup, pendown, pencolor,pensize
|
|
from math import sqrt
|
|
|
|
def fly(distance):
|
|
penup()
|
|
forward(distance)
|
|
pendown()
|
|
|
|
def draw_letter_a(size):
|
|
fly(size)
|
|
left(60)
|
|
forward(2*(8*size)/sqrt(3))
|
|
right(150)
|
|
forward(8*size)
|
|
left(180)
|
|
fly(0.70*size)
|
|
circle((3*size), 90)
|
|
circle((0.50*size), 180)
|
|
right(15)
|
|
circle((6*size), 15)
|
|
forward(3*size)
|
|
|
|
|
|
def draw_letter_b(unit):
|
|
pass
|
|
|
|
def draw_letter_c(unit):
|
|
pass
|
|
|
|
def draw_letter_d(size):
|
|
fly(3*size)
|
|
left(90)
|
|
fly(8*size)
|
|
right(180)
|
|
circle(-18*size,25)
|
|
circle(-0.70*size,280)
|
|
forward(size)
|
|
circle(5*size,20)
|
|
left(10)
|
|
circle(6*size,20)
|
|
left(10)
|
|
circle(6*size,20)
|
|
left(10)
|
|
circle(4*size,20)
|
|
left(10)
|
|
circle(10*size,15)
|
|
circle(3*size,50)
|
|
circle(5*size,60)
|
|
circle(0.50*size, 180)
|
|
|
|
|
|
|
|
|
|
def draw_letter_e(unit):
|
|
pass
|
|
|
|
def draw_letter_f(unit):
|
|
pass
|
|
|
|
def draw_letter_g(unit):
|
|
pass
|
|
|
|
def draw_letter_h(unit):
|
|
pass
|
|
|
|
def draw_letter_i(unit):
|
|
pass
|
|
|
|
def draw_letter_j(unit):
|
|
pass
|
|
|
|
def draw_letter_k(size):
|
|
fly(2*size)
|
|
left(88)
|
|
forward(8*size)
|
|
right(88)
|
|
fly(3*size)
|
|
right(100)
|
|
circle(-7*size, 50)
|
|
circle(-1.5*size, 50)
|
|
right(90)
|
|
circle(-2*size, 160)
|
|
circle(3*size,50)
|
|
circle(0.5*size, 90)
|
|
|
|
|
|
|
|
|
|
def draw_letter_l(unit):
|
|
pass
|
|
|
|
def draw_letter_m(unit):
|
|
pass
|
|
|
|
def draw_letter_n(unit):
|
|
pass
|
|
|
|
def draw_letter_o(unit):
|
|
pass
|
|
|
|
def draw_letter_p(unit):
|
|
pass
|
|
|
|
def draw_letter_q(unit):
|
|
pass
|
|
|
|
def draw_letter_r(unit):
|
|
pass
|
|
|
|
def draw_letter_s(unit):
|
|
pass
|
|
|
|
def draw_letter_t(size):
|
|
fly(4*size)
|
|
left(90)
|
|
fly(7*size)
|
|
right(185)
|
|
forward(6*size)
|
|
left(5)
|
|
circle(size,90)
|
|
circle(3*size, 15)
|
|
forward(0.5*size)
|
|
right(190)
|
|
fly(3.75*size)
|
|
right(90)
|
|
fly(6*size)
|
|
circle(-2*size, 25)
|
|
circle(-size, 85)
|
|
forward(2*size)
|
|
left(5)
|
|
circle(3*size, 30)
|
|
circle(size, 60)
|
|
|
|
|
|
def draw_letter_u(unit):
|
|
pass
|
|
|
|
def draw_letter_v(unit):
|
|
pass
|
|
|
|
def draw_letter_w(unit):
|
|
pass
|
|
|
|
def draw_letter_x(unit):
|
|
pass
|
|
|
|
def draw_letter_y(unit):
|
|
pass
|
|
|
|
def draw_letter_z(unit):
|
|
pass
|