First version: generates 50000 "words" of glyphs

This commit is contained in:
Mike Lynch 2025-11-29 14:55:30 +11:00
commit 56cb386bb7
62 changed files with 179 additions and 0 deletions

11
config.yml Normal file
View File

@ -0,0 +1,11 @@
access_token: NJC3OWRJNJGTNZJKYI0ZNZQ5LTHKZGQTODC0NTLJM2I5ZMQ4
base_url: https://llull.club
emojos: ./emojos.txt
# make sure all of these are 5 or larger
groups:
- glyph
- texture
- colour
- mono

56
emojos.txt Normal file
View File

@ -0,0 +1,56 @@
:grawlix_null: mono blank
:grawlix_angle: colour yellow
:grawlix_ball1: colour green
:grawlix_ball2: colour blue
:grawlix_brick: colour green
:grawlix_bullseye: colour
:grawlix_bun: colour yellow
:grawlix_claw: colour red
:grawlix_cloud: mono
:grawlix_crosses: mono texture
:grawlix_crumple: mono texture
:grawlix_drop: colour purple
:grawlix_dust1: mono texture
:grawlix_dust2: mono texture
:grawlix_feather: colour green
:grawlix_flower: colour blue
:grawlix_fruit: colour green
:grawlix_fungus: colour yellow
:grawlix_fur: mono texture
:grawlix_gadget: colour red
:grawlix_globule: colour pink
:grawlix_glyph1: mono glyph
:grawlix_glyph10: mono glyph
:grawlix_glyph2: mono glyph
:grawlix_glyph3: mono glyph
:grawlix_glyph4: mono glyph
:grawlix_glyph5: mono glyph
:grawlix_glyph6: mono glyph
:grawlix_glyph7: mono glyph
:grawlix_glyph8: mono glyph
:grawlix_glyph9: mono glyph
:grawlix_growth: mono
:grawlix_hatch: mono texture
:grawlix_helm: colour red
:grawlix_horizon: colour pink
:grawlix_joint: mono texture
:grawlix_knothole: mono texture
:grawlix_link: colour trans
:grawlix_lump: colour yellow
:grawlix_mountain: colour blue
:grawlix_orbit: mono
:grawlix_popup: colour yellow
:grawlix_rects: colour trans
:grawlix_rough: colour texture pink
:grawlix_scales: colour texture red
:grawlix_scrawl: mono texture
:grawlix_scribble: colour texture green
:grawlix_shatter: colour texture
:grawlix_signal: colour
:grawlix_slump: colour texture green
:grawlix_spark1: mono
:grawlix_spark2: mono
:grawlix_sprout: mono
:grawlix_strata: mono texture
:grawlix_vertical: mono texture
:grawlix_wreck: texture colour blue

60
grawlix.py Normal file
View File

@ -0,0 +1,60 @@
from collections import defaultdict
import random
import yaml
class GrawlixCodex():
def __init__(self, width=100, height=10, wordcount=50000):
self.width = width
self.height = height
self.smallest = 1
self.longest = 8
self.wordcount = wordcount
def config(self, cffile):
with open(cffile) as cf:
try:
self.cf = yaml.load(cf, Loader=yaml.Loader)
except yaml.YAMLError as exc:
print("%s parse error: %s" % ( self.args.config, exc ))
if hasattr(exc, 'problem_mark'):
mark = exc.problem_mark
print("Error position: (%s:%s)" % (mark.line + 1, mark.column + 1))
def load_emojos(self):
self.emojos = []
self.groups = defaultdict(set)
with open(self.cf["emojos"], "r") as efh:
for line in efh:
parts = line.split()
glyph = parts[0][1:-1]
self.emojos.append(glyph)
for tag in parts[1:]:
self.groups[tag].add(glyph)
self.tags = [ t for t in self.groups.keys() if not t == "blank" ]
self.blank = list(self.groups["blank"])[0]
def text(self):
for w in range(self.wordcount):
l = random.randint(self.smallest, self.longest)
for g in range(l):
yield random.choice(list(self.groups["glyph"]))
yield(self.blank)
def write(self):
row = []
for g in self.text():
row.append(g)
if len(row) == self.width:
glyphs = [ f'<img height="20" width="20" src="img/{g}.png" />&nbsp;' for g in row ]
print(''.join(glyphs))
print('<br />')
row = []
gc = GrawlixCodex()
gc.config("./config.yml")
gc.load_emojos()
gc.write()

BIN
img/grawlix_angle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/grawlix_ball1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
img/grawlix_ball2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
img/grawlix_brick.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
img/grawlix_bullseye.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
img/grawlix_bun.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
img/grawlix_claw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
img/grawlix_cloud.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
img/grawlix_crosses.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
img/grawlix_crumple.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
img/grawlix_drop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/grawlix_dust1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/grawlix_dust2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
img/grawlix_feather.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
img/grawlix_flower.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
img/grawlix_fruit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
img/grawlix_fungus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
img/grawlix_fur.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
img/grawlix_gadget.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
img/grawlix_globule.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
img/grawlix_glyph1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/grawlix_glyph10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/grawlix_glyph2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
img/grawlix_glyph3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/grawlix_glyph4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/grawlix_glyph5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
img/grawlix_glyph6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
img/grawlix_glyph7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
img/grawlix_glyph8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
img/grawlix_glyph9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
img/grawlix_growth.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
img/grawlix_hatch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
img/grawlix_helm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
img/grawlix_horizon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
img/grawlix_joint.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
img/grawlix_knothole.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
img/grawlix_link.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
img/grawlix_lump.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
img/grawlix_mountain.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
img/grawlix_null.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
img/grawlix_null.png.kra Normal file

Binary file not shown.

BIN
img/grawlix_orbit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
img/grawlix_popup.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
img/grawlix_rects.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
img/grawlix_rough.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
img/grawlix_scales.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
img/grawlix_scrawl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
img/grawlix_scribble.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

BIN
img/grawlix_shatter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
img/grawlix_signal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
img/grawlix_slump.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

BIN
img/grawlix_spark1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
img/grawlix_spark2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/grawlix_sprout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
img/grawlix_strata.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
img/grawlix_vertical.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
img/grawlix_wreck.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

40
img/header.html Normal file

File diff suppressed because one or more lines are too long

12
pyproject.toml Normal file
View File

@ -0,0 +1,12 @@
[project]
name = "nanogenmo-grawlix"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.9"
dependencies = [
"grawlix>=0.1.0",
]
[tool.uv.sources]
grawlix = { git = "https://git.tilde.town/bombinans/grawlix.git" }