I tried. (and sort of failed)
The idea was that size lines (made from -/|\) would be drawn and then more lines would propagate off the initial lines (and then perhaps continue doing that recursively). I decided to use integers to represent which way a line is going at any specific character in the grid, which appears to work quite well but perhaps it was my downfall. I didn’t get time to finish this so this is the best I got.
from random import Random
def renderchar(i: int) -> str:
chars = '|/-\\'
return chars[i%len(chars)]
def renderchargrid(grid: list[list[str]]):
print('\033[107;30m')
for y, row in enumerate(grid):
for x, char in enumerate(row):
if isinstance(char, int):
print(renderchar(char), end='')
else: print(char, end='')
print()
print('\033[0m')
def propogate_spikes(x,y, chargrid, p, l):
xside = x > len(chargrid[0])//2
yside = y < len(chargrid)//2
initial_direction = chargrid[y][x]
if not isinstance(initial_direction, int): return
#chargrid[y][x] = 'X'
for i in range(l):
if not yside: chargrid[y-l][x] = initial_direction-1
if yside: chargrid[y+l][x] = initial_direction-1
if not xside: chargrid[y][x-l] = initial_direction+1
if xside: chargrid[y][x+l] = initial_direction+1
size = 23 # works best with odd numbers for whatever reason...
seed = 42
rng = Random(seed)
chargrid = [[' ' for _ in range(size)] for _ in range(size)]
#chargrid[size//2][size//2] = '*'
# uncomment for 8-sided snowflake
#for x in range(size):
# chargrid[size//2][x] = 2
# vertical spike
for y in range(size):
chargrid[y][size//2] = 0
n = 1
# diagonal spike(s)
for i in range(size):
chargrid[i][i] = -1
#i += 1
chargrid[i][size-i-1] = 1
n = rng.randint(n, size-2)
n1= rng.randint(1, 6)
try:
propogate_spikes(i, i, chargrid, n, n1)
propogate_spikes(i, size-i-1, chargrid, n, n1)
except IndexError: pass
chargrid[size//2][size//2] = '*'
# display snowflake
renderchargrid(chargrid)
Resulting “snowflakes”
-\ | | /-
| \ | /|
| \ | /-
- \ | /| |
| - \ | /| -
|\ | / -
- |\ |- / -
|-\ | - || \
| \ | /-
|- - \|/| | -
- *
/|\- - |
/ | \|
/- | / -- |
/ || \ |
/ -| \ |
/ | \- - -
/ | \-
/ | \|
/ | \-
/ | \|
I did not use any AI or even autocomplete.