author | Christian Urban <christian.urban@kcl.ac.uk> |
Fri, 02 Dec 2022 12:55:59 +0000 | |
changeset 451 | b183e0dfb7ec |
parent 404 | bf20a9fa5c29 |
child 475 | 59e005dcf163 |
permissions | -rw-r--r-- |
404 | 1 |
import M5a._ |
235 | 2 |
|
236 | 3 |
assert(run("[-]", Map(0 -> 100)) == Map(0 -> 0)) |
4 |
assert(run("[->+<]", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10)) |
|
5 |
assert(run("[>>+>>+<<<<-]", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42)) |
|
404 | 6 |
|
340 | 7 |
|
8 |
||
235 | 9 |
|
340 | 10 |
val hw_urban = """+++++[->++++++++++<]>--<+++[->>++++++++++ |
11 |
<<]>>++<<----------[+>.>.<+<]""" |
|
12 |
assert(run(hw_urban) == Map(0 -> 0, 1 -> 58, 2 -> 32)) |
|
13 |