rename std functions
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
func rule110_step[state: Array] : Array
|
||||
let new_state: Array = []
|
||||
let state_len: I64 = Array.size(state)
|
||||
let state_len: I64 = array.size(state)
|
||||
|
||||
for i in 0..state_len
|
||||
let left: Bool = false
|
||||
@@ -11,17 +11,17 @@ func rule110_step[state: Array] : Array
|
||||
if i + 1 < state_len
|
||||
right = state[i+1]
|
||||
|
||||
Array.push(new_state, !((!left && !center && !right) || (left && !center && !right) || (left && center && right)))
|
||||
array.push(new_state, !((!left && !center && !right) || (left && !center && !right) || (left && center && right)))
|
||||
|
||||
return new_state
|
||||
|
||||
func to_str[state: Array]: String
|
||||
let out: String = malloc(Array.size(state))
|
||||
for i in 0..Array.size(state)
|
||||
let out: String = malloc(array.size(state))
|
||||
for i in 0..array.size(state)
|
||||
if state[i]
|
||||
String.set(out, i, '#')
|
||||
str.set(out, i, '#')
|
||||
else
|
||||
String.set(out, i, ' ')
|
||||
str.set(out, i, ' ')
|
||||
return out
|
||||
|
||||
func main[] : I64
|
||||
@@ -29,10 +29,10 @@ func main[] : I64
|
||||
|
||||
let state: Array = []
|
||||
for i in 0..SIZE
|
||||
Array.push(state, false)
|
||||
Array.push(state, true)
|
||||
array.push(state, false)
|
||||
array.push(state, true)
|
||||
|
||||
print(to_str(state))
|
||||
io.print(to_str(state))
|
||||
for i in 0..SIZE
|
||||
state = rule110_step(state)
|
||||
print(to_str(state))
|
||||
io.print(to_str(state))
|
||||
Reference in New Issue
Block a user