Wrote the functions draw_letter(unit) for letters "N", "R", and "Z".

This commit is contained in:
kated
2026-02-26 11:00:55 -05:00
parent c2f983a1bc
commit 0102a768a6
3 changed files with 88 additions and 3 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
source .venv/bin/activate

18
poetry.lock generated Normal file
View File

@@ -0,0 +1,18 @@
# This file is automatically @generated by Poetry 2.3.1 and should not be changed by hand.
[[package]]
name = "superturtle"
version = "0.2.0"
description = "Extensions to Python's turtle"
optional = false
python-versions = "<4.0,>=3.9"
groups = ["main"]
files = [
{file = "superturtle-0.2.0-py3-none-any.whl", hash = "sha256:ca3a31be3259387b4490846adbf64502acc9d23472912cc43497ab170e89f506"},
{file = "superturtle-0.2.0.tar.gz", hash = "sha256:807fb419c1dba9cb809a22a68e72c0193bdeed4a9326eb36ad940b2a7ff6ac04"},
]
[metadata]
lock-version = "2.1"
python-versions = ">=3.10,<4.0"
content-hash = "6aad436bbbf760fa856344262eab22d62a167cac4e5dfefbf4be77d5a37428c9"

View File

@@ -52,7 +52,21 @@ def draw_letter_m(unit):
pass
def draw_letter_n(unit):
pass
left(90)
for i in range(2):
forward(unit * 8)
right(90)
forward(unit * 2)
right(45)
forward((unit * sqrt(2)) * 4)
left(135)
forward(unit * 4)
right(90)
forward(unit * 2)
right(90)
right(90)
def draw_letter_o(unit):
pass
@@ -64,7 +78,49 @@ def draw_letter_q(unit):
pass
def draw_letter_r(unit):
pass
left(90)
forward(unit * 8)
right(90)
forward(unit * 8)
right(90)
forward(unit * 5)
right(90)
forward(unit * 3)
left(135)
forward((unit * sqrt(2)) * 3)
right(135)
forward(unit * 3)
right(45)
forward((unit * sqrt(2)) * 2)
left(135)
forward(unit * 2)
right(90)
forward(unit * 3)
# draws the hole
penup()
right(90)
forward(unit * 6)
right(90)
forward(unit * 3)
pendown()
forward(unit * 3)
right(90)
forward(unit)
right(90)
forward(unit * 3)
right(90)
forward(unit)
penup()
left(90)
forward(unit * 3)
left(90)
forward(unit * 6)
left(90)
pendown()
def draw_letter_s(unit):
pass
@@ -88,4 +144,14 @@ def draw_letter_y(unit):
pass
def draw_letter_z(unit):
pass
for i in range(2):
forward(unit * 8)
left(90)
forward(unit * 2)
left(90)
forward(unit * 4)
right(135)
forward((unit * sqrt(2)) * 4)
left(45)
forward(unit * 2)
left(90)