286
|
1 |
import CW10a._
|
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))
|
340
|
6 |
assert(run("++++++++++#>+***#") == Map(0 -> 10, 1 -> 1000))
|
|
7 |
assert(run("+++>+@+@+@+@+@") == Map(0 -> 3, 1 -> 7, 4 -> 3, 5 -> 3, 6 -> 3, 7 -> 3))
|
|
8 |
|
|
9 |
|
235
|
10 |
|
340
|
11 |
val hw_urban = """+++++[->++++++++++<]>--<+++[->>++++++++++
|
|
12 |
<<]>>++<<----------[+>.>.<+<]"""
|
|
13 |
assert(run(hw_urban) == Map(0 -> 0, 1 -> 58, 2 -> 32))
|
|
14 |
|