example fixes

This commit is contained in:
2025-07-29 18:53:38 +02:00
parent ddfa538a5c
commit 2c09d7bc21
9 changed files with 49 additions and 38 deletions

View File

@@ -15,14 +15,13 @@ func rule110_step[state: Array] : Array
return new_state
func to_str[state: Array]: String
let out: String = malloc(array.size(state))
func print_state[state: Array]: Void
for i in 0..array.size(state)
if state[i]
str.set(out, i, '#')
c.putchar('#')
else
str.set(out, i, ' ')
return out
c.putchar(' ')
io.print("")
func main[] : I64
let SIZE: I64 = 60
@@ -32,7 +31,9 @@ func main[] : I64
array.push(state, false)
array.push(state, true)
io.print(to_str(state))
print_state(state)
for i in 0..SIZE
state = rule110_step(state)
io.print(to_str(state))
print_state(state)
array.free(state)