Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,18 @@
def step(state, rule) {
var result := state(0, 1) # fixed left cell
for i in 1..(state.size() - 2) {
# Rule function receives the substring which is the neighborhood
result += E.toString(rule(state(i-1, i+2)))
}
result += state(state.size() - 1) # fixed right cell
return result
}
def play(var state, rule, count, out) {
out.print(`0 | $state$\n`)
for i in 1..count {
state := step(state, rosettaRule)
out.print(`$i | $state$\n`)
}
return state
}

View file

@ -0,0 +1,23 @@
def rosettaRule := [
" " => " ",
" #" => " ",
" # " => " ",
" ##" => "#",
"# " => " ",
"# #" => "#",
"## " => "#",
"###" => " ",
].get
? play(" ### ## # # # # # ", rosettaRule, 9, stdout)
0 | ### ## # # # # #
1 | # ##### # # #
2 | ## ## # #
3 | ## ### #
4 | ## # ##
5 | ## ###
6 | ## # #
7 | ## #
8 | ##
9 | ##
# value: " ## "