mclangc/examples/rule110.mcl

40 lines
619 B
Plaintext
Raw Normal View History

2023-03-20 11:39:04 +00:00
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
2023-03-20 11:39:04 +00:00
dup mem + BOARD_SIZE + 42 @8
else
2023-03-20 11:39:04 +00:00
dup mem + BOARD_SIZE + 32 @8
end
1 +
end
2023-03-20 11:39:04 +00:00
mem + BOARD_SIZE + 10 @8
2023-03-20 11:39:04 +00:00
BOARD_SIZE 1 + mem BOARD_SIZE + puts
// pattern
mem !8 1 shl
mem 1 + !8
bor
2023-03-20 11:39:04 +00:00
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