make index operator just read 1 byte

This commit is contained in:
2025-11-13 20:17:12 +01:00
parent c1bd84464c
commit 852c463532
9 changed files with 59 additions and 56 deletions

View File

@@ -5,11 +5,11 @@ func rule110_step[state: Array] : Array
for i in 0..state_len
let left: Bool = false
if i - 1 >= 0
left = state[i-1]
let center: Bool = state[i]
left = array.nth(state, i-1)
let center: Bool = array.nth(state, i)
let right: Bool = false
if i + 1 < state_len
right = state[i+1]
right = array.nth(state, i+1)
array.push(new_state, !((!left & !center & !right) | (left & !center & !right) | (left & center & right)))
@@ -17,7 +17,7 @@ func rule110_step[state: Array] : Array
func print_state[state: Array]: Void
for i in 0..array.size(state)
if state[i]
if array.nth(state, i)
c.putchar('#')
else
c.putchar(' ')