-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode_numworks.py
65 lines (50 loc) · 8.73 KB
/
code_numworks.py
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from turtle import *
# Color letters mapping from the provided dictionary
color_letters_mapping = {
'a': [38, 31, 29],
'b': [142, 34, 14],
'c': [114, 89, 28],
'd': [92, 83, 72],
'e': [158, 138, 113],
'f': [231, 112, 68],
'g': [230, 66, 55],
'h': [230, 177, 89],
'i': [238, 202, 147],
'j': [187, 22, 23]
}
width, height = 320, 220
speed(0)
penup()
hideturtle()
x, y = -width/2, height/2
goto(x, y)
color_string = '320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a320a195a6c119a189a2cd11bdc115a186a2c6bd5e2d4bc113a184acd3b5e8h2ed3bc111a182ac3b2e17hed2bc110a89a4cd4c82ac3be21h2e2bc109a86acd11bdc77acd2be25he2b109a84acd3bd2cdbd3cd3bc74ac2be28hebd108a83ad2bdc5abdc3a2c3bc71ad2be30h2b108a81ac2bdc7ac11bd59ac8ac2be32hebc107a80ac2bc9ad12bd57acbd6ac2be33hebc107a79ac2bc9ac2b8fb2dbd55ac3b5ac2be34hebd107a78ac3bc9adb9f2b2cbd54adbfbc3ac2be35hebd107a77ac2bdbd9a2b7f2cf2bacbd52acbfg2b2ac2be13h7e16hebc107a77adb2cdbc7adb6f2c2acfbdadbc51a2b2gfbdc2be13h10e14hebc107a76acbd2ca2b3d4c2b4f5c3f2b2dbd50adbca2gf3be14h12e11he2b108a76a2b3cad9b4f6c4f5bc48acbd2ac2g2be15h14e8he2bc108a75acbd3ca2b7f2bfcaca2c5f2bc2a2b48a2be3a2gfbe15h23e2bd108a75adb3cacb9fb2fcac7fbc3acbc46adbehc3a2gfbe15h21e4bc107a74acbd3cadb9f2b2fc7fbd4acbd43abda2be2h3a3g2be15h18e3b2e2b107a74acb5cb8facf2b8f2bc5a2b42ac2b2cbe2he3a2gf2be16he2b12e3be2hebd106a74adb4cdb6fcacacfb7f2bc6adb42ad3bcdbe2hc3a2gf2b9h3e4h2e7be6be4he2b106a74a2b4c2b5f2a3c2f10bc6acbc41abfg2bd2be2h4a2gfbe4h2e7b2e3h2e8b2e4he4bc105a74a7b4f2acac4fbd7cbd6acbc40acbf2g5b3h3ac2ge3he4b4e5be6h2e8he6bc104a74a7b2fc3a2c4f2b8acbd5acbc40acbf3g4be2he3acf2he3b2e7h2e2be14he2be2he2bc103a74abd4c2bfcafc6fbd9adbc4acbc40adba4gf3be2he3a2he2be12he3be12h2be4he2bc102a74a2b4cdb2fc7f2b11a2b4acbc40abd2a4gf3be2hca2he3b4e11he2be10hebe5he2bd102a74adb5c2b9fbc11acbdc3dbc39acbc3a4gf3be4he10b2e8he2b10hebe3h2e4bc101a74adb5cdb8f2b13a7b40adbec3ac4g3be2he2bc3a2c2d5b2e5hebe9h2b3he6bd101a74acb6c5b4fbc12acb4f2b40a2b2hc4a4gf2b2hebc7ac2gf5be4h2be7he2b2he2bf5bc100a74acbd5c2bd7bc12adb4fbd39acbe3he4a4gfehebd7ac5gf5b2ehe2b7hebehebfgf5bc100a75a2b5cbd5a2cbd11acb5fbc39ac2be4hc4a3gehebc7a5gf8b2e2be6hebe2bd2gf5bd100a75acbd3cdbc7adbc9ac2b4f2b41ac2be4he5ag2h2b7ac4gf13be6he3bda2gf6b100a76a2b3c2b2c7adbc8adb5fbc42ac3be4he4ahebd7a5g15b6he2bd2a3gd5b100a76acbdcdbd3c6acbd7acb5f2b43ac5be4he2chebc7a4gf12bf2b6hebd3a2g2a5b100a77a2bcdb5c6ad10b4f2bc43adb2e4be6hebc7a4gf12bg2b6hebd3a2g2ad4b100a77ac3bd6c5ad10b4fbd43acb6e3b3e2hebc7a4gcd11bgfb7h2b4a2gad4b100a78ac2b9c3a2b8f2b2fbd43ac2b8e4behebc7a3g3ad9bfg2b7h2bc3a3gf4b100a79adbd11cb10f4bc43adb12ebehebc7a3g3ad9bfg2b7hebc3ac5g2b100a80ad2b9c2b10f3bc43adb15ehebd7a3g3a10b2gbe7hebd4a5gbd100a81ac2bd6cdb10f2bd44acbe6h9e2h2b8a5g9bfgfbe8h2b5a3gfbc100a82acd2bd4c2b7f5b44ac2b18hebc7a5gf7bf2g2be8hebc7adbc100a83ad4b3d2b3f9bc42ac2be18he2b8a6g2fb2f3gfbeh2e7h2bc5acbd101a83adb2e13b4ebc41ac2be20hebc7ac13g2b2e2b7hebd5adbc101a83adb7e3b9e2b40ac2be21he2bc8a11gfbehebe8hebdcacd2bc101a83adb20ebc38ac2be23he2bc8a8g2c2bhe2be9he7bc101a83adb18ehebd37ad2be25he2bc15ac2b2e5b3e6h5e2b102a83adb16e4h2bc34acd2be27he2bd12acd2behebehe6be8h2b102a83adb14e6hebd33ac2be30he3bdc7acd2be9h5e8hebd102a83a2b12e9hdbc30acd2be33he4b5d4be23hebd102a83a2b7e14he2b29ad2be37h2e7b2e25hebc102a83a2b22hebd26ac2b2e42h2e30h2b103a83a2b23hebd23acd2be75hebd103a83adb24h2bd20acd2be77hebc103a83adb25h2bd17acd2b2e78h2b104a83adb26he2bc13acd2b2e79hebd104a83adb27he3bdc7a2c3b2e81hebd104a83adb29he4b5d4b2e83hebc104a83adbe30h2e7b2e86hebc104a83acbe127hebc104a83acbe127hebc104a83acbe127hebd104a83acbe127hebd104a84abe28h2e97hebd104a84a2be26h3e61he8c27hebd104a84a2be26h2e59hc14ac24h2b104a84adbe25h2e57he19ac22h2b104a84adb2e23h3e55he23ac20h2b104a84acb2e23h2e55hc26ae18h2b104a84acb2e22h2e54he29ac17h2b104a85a2b2e20h3e53he31ac16h2b104a85a2b2e20h2e53hc18a4c11ac15hdb104a85adb3e18h3e52he16a10c9ac14hebc103a85acb3e18h2e52he16a8c2a2c9ac13hebc103a85acb3e17h3e52h16a8c3a4c8ae12hebc103a86a2b3e16h2e52hc15a7c4a5c9a12hebc103a86adb3e16h2e51he16a7c5a5c8ac11hebc103a86acb4e14h2e52hc15a7c6a6c8a11hebc103a86acb4e14h2e51he16a6c7a6c8ac10hebc103a87a2b4e13h2e51hc16a4cac8a5c9a10hebc103a87adb5e11h2e52h16a4c2ac8a6c8ae9hebc103a87acb5e11h2e51hc16a3c3ac9a5c8ac9hdb104a88a2b5e10h2e51hc16a3c13a5c9a9h2b104a88adb5e10h2e51h18a2c13a5c9a9h2b104a88acb6e8h2e51he18a2c13a4c10ae8h2b104a89a2b6e7h2e51he18a2c13a4c10ac8h2b104a89adb6e7h2e51hc19ac12a5c10ac7hebd104a89acb7e59hc19ac11a5c11ac7hebd104a90adb7e58hc7a2c15ac7a3c12ac7hebc104a90acb8e57hc7a2c2ac13ac6a2c13ac7hebc104a91a2b7e57hc10acac18a2c14ac7hdbc104a91acb8e56hc10a2c2a2c13a2c16ac7h2b105a92a2b8e55hc11aca3c2ac28ac6hebd105a92adb9e54he13acacac2a2c25ae6hebc105a93a2b9e54h17ac2a2c25a7hebc105a93acb10e53h19acac3a2c20a7h2b106a94a2b4eb5e52hc19ac5ac2ac16ac6hebd106a94acb4e2b5e51he12a2c9a2c2acac15a7hebc106a95adb3e3b6e50h14ac8a2cac2aca2c12a7h2bc106a95ac2b3e3b6e49hc9ac4ac11a2c2a2cac9ae6hebd107a96adb4e3b6e49h9ac4a2c2a2c10ac2a2c8a7hebc107a97a2b4e3b7e47hc9ac2a3c3ac13a2c7ae6he2b108a97ac2b3e5b7e46h10ac7acac2ac16ac7hebc108a98adb4e5b8e44he13aca4c20a7he2b109a99adb4e5b9e43hc13a3ca2c18a8hebd109a99ac2b4e6b9e42hc12ac3a2c2ac14ae7he3b109a100ac2b4e2b2f3b11e39hc12ac3a2c15ac7he4b109a101ac2b4e2b2f4b16e33hc31ae7h2e2bebc108a102ad2b4e2b3f4b21e27hc29ae7h2e2b2ebd108a103ad2b4e2b4f5b24e22he26ac8h2e2be2h2b108a104ad2b4e2b3f2b2f5b26e18hc23ae8h2e2be3hebc107a105ad2b4e5b6f7b25e16hc19ae8h4e2b4hebd107a106ad2b4e3b6f3b2f10b22e14hec13ac10h4e2be5h2bc106a107ac2b2e3b6f3b9f11b18e15h8ce11h5e2be6hebd106a108ac4b7f2b19f8b16e31h5e2be8h2b106a109ac2b7f2b26f7b13e27h6e2be9hebd105a108ac2bf4g2f3b30f6b12e22h8e2be11h2bc104a107adbf6gf2be3b32f5b11e17h9e3be12hebd104a106adbf6g3b4e3b30f2bf4b13e9h12e2be15h2bc103a104ac2bf5gf2bd2b4e3b29f2b4f3b31e2be16hebd103a103ac2bf5gf2bcac3b4e3b27fb5f5b27e3b2e17hdbc102a102ad2b6gf2bc4ad2b5e3b25fb5f2b2f2b25e2b4e17he2b102a101adbf6gfbd7acd2b5e4b22fb5f2b3f3b21e3b5e18hebd101a99acdbf6g2bd10ac3b5e4b19f2b5fb5f2b19e3b7e19h2bc100a98ac2bf5gf2bc13ac3b6e4b16f2b5fb6f2b18eb10e18hebd100a97ac2bf5gf2bc16ac3b6e5b13fbfg3f2b7fb29e19hebc99a96adbf6gfbdc19ac4b6e5b10fbf3gf2b7fb29e19he2b99a95adbf6g2bd23acd3b8e5b5f2b4gfb7f2b30e19hebd98a91ac2d2bf5gf2bd26a2c4b8e8bf4gfb5f3b31e20h2bc97a89ac6bf4gf2bc30acd5b9e3b5g9b33e19he2b97a88ac2b2c2ac2b2gf2bc34a2cd5b5e2bf4gf4b39e19hebd96a87acbd3ac2acb2fbd40acd8bf5g2b42e20h2bc95a86acbd2a4c2a3bd45a2cd3b5gf2b43e19hebd95a83acd3bd7ca2bc48ac2b5gf27b20e19hebc94a80acd3bdcdbd5c2abd47acdbf6g2bca6c5d9c2d5b17e19hebd94a76a3c3bdc2agcdbd4cacbc45acd2bf6g2bc26acd4b15e19hebc93a73acd7b3ca2gcdbd2cac2b43acd3bf7g2bd30acd3b14e18hebd93a69acdbd2bd4cd2behec2gcdbcac2bc36a5cd3b2f8g2bd34ac3b13e18h2bc92a68ad4bdc6acdbehe3gcb2d2bc30a3c3d7b2f9gf2bc37ac3b12e17hebc92a67adbdfbd10adbehc2gcd2bd29acd8b2d2bf10gf3bc40ac3b11e16hebd92a66acbdafbc11adbeh3cbd29acd3b2d2bd2b2c2b9g2f2bd44ac3b10e16h2b92a66acbeagbd12a2bhca2bc27ac3bd3cdbdc2b2cdb7gf3bdc47ad2b10e15hebc91a66acbeag2b12acbdadbc27ad3bd4c2b2cdb2cdbf3g2f3bdc50acd2b9e14hebc91a66acbe2cfbc11acbdcbd27adbdg2b3cdbd2cdb3c2bf4bdc55ac3b8e13hebc91a67ab2eagbd12a4b28a2bcg2b2ac2b3cdb2d8bc58ad2b9e11hebc91a67adbeagfbc11a3bc28adb2c2bac2b5c4bd4cd2bc58acd2b9e9h2b92a67acbecag2b11a2bd29adb2cfbd2b5cdbdc7acbd60acd3b8e6hebd92a68adbeacfbd10a2b30adbecf3b5cd2b9cdbc62acd4b11e2b93a68ac2beagfbd8acbc30adbecfbd5c9b2d3bc65a2c6b4e3bdc93a69adbecag2bd7adbc30acbeafb6c2b4c2d3bdc70a2cd7bdc95a70adbecag2bd5acbd31acbeafbd5cbd7adb77a4c98a70ac2becagf2bc2acbd32acbeagbd5cbd2a5gdb179a71ac2becagf5bd33acbeagbd5c2b2a5gfbc178a72ac2becacgf3bc33acbeagbd5c2b7acbc178a73ac2b2ecacgfbc33acbecg2b5c2b2a3c2acbc178a74ac3b2ecdbd35abecg2b5c2b2a5hebc178a76ad5bd36a2b2cfb5c2b3a3c2ebd178a78ac2dc37a2b2cfb5c2b8abd178a119adbeafbd4c2b2d2b3dc2b178a119adbeafbd4cd11b178a119acbeagbd13cd2b178a119acbeag2b14cdbc177a119acbecgfb6c5d3cdbc177a120a2b2cfb2d11b2dbc177a120adbeag4bd8cd3bc177a120adbeag2bc11ac2b178a120acbecgfbc12adb178a121ab2eagbd11acbd178a121adbeagfbc10adbc178a121acbecag2bc8adbc179a122a2beagf2bdc3acd2bd180a122acb2ea2g9bd181a123adb2e2ag5f3b182a124ad2be6cd2bc182a125ac9bd184a127acd3b2dc185a320a320a320a320a320a320a107a10c203a98a29c193a93a38c189a90a44c186a88a48c184a87a51c182a87a51c182a87a51c182a87a51c182a88a48c184a90a44c186a93a38c189a98a29c193a108a8c204a320a320a320a320a320a320a320a320a320a320a320a320a320b'
# Draw based on color string
i = 0
while i < len(color_string):
char = color_string[i]
count = 0
# Accumulate digits to determine the length of line
while char.isdigit():
count = count * 10 + int(char)
i += 1
char = color_string[i]
if count == 0:
count = 1
# Get color RGB values
colort = color_letters_mapping[char]
i += 1
# Set turtle color
color(colort[0]/255, colort[1]/255, colort[2]/255)
# Move turtle and draw line
pendown()
goto(x + count, y)
penup()
# Update x position for the next segment
x += count
# Check if x exceeds half of the width
if x >= width/2:
# Move to the next row
y -= 1
x = -width/2
goto(x, y)