author | Christian Urban <christian.urban@kcl.ac.uk> |
Fri, 26 Apr 2024 17:35:36 +0100 | |
changeset 486 | 9c03b5e89a2a |
parent 475 | 59e005dcf163 |
permissions | -rw-r--r-- |
475 | 1 |
|
2 |
def urbanmain() = { |
|
235 | 3 |
|
475 | 4 |
import M5a._ |
5 |
||
6 |
assert(run("[-]", Map(0 -> 100)) == Map(0 -> 0)) |
|
7 |
assert(run("[->+<]", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10)) |
|
8 |
assert(run("[>>+>>+<<<<-]", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42)) |
|
404 | 9 |
|
340 | 10 |
|
11 |
||
235 | 12 |
|
475 | 13 |
val hw_urban = """+++++[->++++++++++<]>--<+++[->>++++++++++ |
14 |
<<]>>++<<----------[+>.>.<+<]""" |
|
15 |
assert(run(hw_urban) == Map(0 -> 0, 1 -> 58, 2 -> 32)) |
|
16 |
} |