mclangc/examples/rule110.mcl
2023-03-20 13:39:04 +02:00

40 lines
619 B
Plaintext
Executable File

macro puts 1 1 syscall3 drop end
macro BOARD_SIZE 100 end
mem BOARD_SIZE 2 - + 1 @8
0 while dup BOARD_SIZE 2 - < do
0 while dup BOARD_SIZE < do
dup mem + !8 if
dup mem + BOARD_SIZE + 42 @8
else
dup mem + BOARD_SIZE + 32 @8
end
1 +
end
mem + BOARD_SIZE + 10 @8
BOARD_SIZE 1 + mem BOARD_SIZE + puts
// pattern
mem !8 1 shl
mem 1 + !8
bor
1 while dup BOARD_SIZE 2 - < do
swap 1 shl 7 band
over mem + 1 + !8 bor
2dup 110 swap shr 1 band
swap mem + swap @8
swap
1 +
end
drop drop
1 +
end
drop