testing3/bf.scala
author Christian Urban <urbanc@in.tum.de>
Sun, 03 Dec 2017 21:11:49 +0000
changeset 161 6ea450e999e2
parent 160 863feeb5c760
child 167 349d706586ef
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
// Part 2 about an Interpreter for the Brainf*** language
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
//========================================================
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
object CW8b {
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
type Mem = Map[Int, Int]
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
// (2a) Complete the functions for safely reading  
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
// and writing brainf*** memory. Safely read should
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
// Return the value stored in the Map for a given memory
154
39c6b93718f0 updated
Christian Urban <urbanc@in.tum.de>
parents: 153
diff changeset
    11
// pointer, if it exists; otherwise it Returns 0. The
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
// writing function generates a new Map with the
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
// same data, except at the given memory pointer the
154
39c6b93718f0 updated
Christian Urban <urbanc@in.tum.de>
parents: 153
diff changeset
    14
// value v is stored.
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
def sread(mem: Mem, mp: Int) : Int = 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
  mem.getOrElse(mp, 0)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
def write(mem: Mem, mp: Int, v: Int) : Mem =
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
  mem.updated(mp, v)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
// (2b) Implement the two jumping instructions in the 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
// brainf*** language. In jumpRight, given a program and 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
// a program counter move the program counter to the right 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
// until after the *matching* ]-command. Similarly, 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
// jumpLeft implements the move to the left to just after
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
// the *matching* [--command.
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
def jumpRight(prog: String, pc: Int, level: Int) : Int = {
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
  if (prog.length <= pc) pc 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
  else (prog(pc), level) match {
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
    case (']', 0) => pc + 1
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
    case (']', l) => jumpRight(prog, pc + 1, l - 1)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
    case ('[', l) => jumpRight(prog, pc + 1, l + 1)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
    case (_, l) => jumpRight(prog, pc + 1, l)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
  }
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
}
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
def jumpLeft(prog: String, p: Int, level: Int) : Int = {
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
  if (p < 0) p 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
  else (prog(p), level) match {
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
    case ('[', 0) => p + 1
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
    case ('[', l) => jumpLeft(prog, p - 1, l - 1)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
    case (']', l) => jumpLeft(prog, p - 1, l + 1)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
    case (_, l) => jumpLeft(prog, p - 1, l)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
  }
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
}
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
161
6ea450e999e2 updated
Christian Urban <urbanc@in.tum.de>
parents: 160
diff changeset
    52
153
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
// (2c) Complete the run function that interpretes (runs) a brainf***
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
// program: the arguments are a program, a program counter,
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
// a memory counter and a brainf*** memory. It Returns the
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
// memory at the stage when the excution of the brainf*** program
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
// finishes. The interpretation finishes once the program counter
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
// pc is pointing to something outside the program string.
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
// If the pc points to a character inside the program, the pc, 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
// memory pointer and memory need to be updated according to 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
// rules of the brainf*** language. Then, recursively, run 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
// function continues with the command at the new program
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
// counter. 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
// Implement the start function that calls run with the program
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
// counter and memory counter set to 0.
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
def run(prog: String, pc: Int, mp: Int, mem: Mem) : Mem = {
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
  if (0 <= pc && pc < prog.length) { 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
    val (new_pc, new_mp, new_mem) = prog(pc) match {
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
      case '>' => (pc + 1, mp + 1, mem)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
      case '<' => (pc + 1, mp - 1, mem)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
      case '+' => (pc + 1, mp, write(mem, mp, sread(mem, mp) + 1))
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
      case '-' => (pc + 1, mp, write(mem, mp, sread(mem, mp) - 1))
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
      case '.' => { print(sread(mem, mp).toChar); (pc + 1, mp, mem) }
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
      case ',' => (pc + 1, mp, write(mem, mp, Console.in.read().toByte))
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
      case '['  => 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
	if (sread(mem, mp) == 0) (jumpRight(prog, pc + 1, 0), mp, mem) else (pc + 1, mp, mem) 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
      case ']'  => 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
	if (sread(mem, mp) != 0) (jumpLeft(prog, pc - 1, 0), mp, mem) else (pc + 1, mp, mem) 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
      case _ => (pc + 1, mp, mem)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
    }		     
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
    run(prog, new_pc, new_mp, new_mem)	
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
  }
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
  else mem
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
}
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
def start(prog: String, m: Mem) = run(prog, 0, 0, m)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
// some sample programs collected from the Internet
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
//==================================================
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
/*
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
// first some contrived (small) programs
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
// clears the 0-cell
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
start("[-]", Map(0 -> 100)) 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
// copies content of the 0-cell to 1-cell
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
start("[->+<]", Map(0 -> 10))
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
// copies content of the 0-cell to 2-cell and 4-cell
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
start("[>>+>>+<<<<-]", Map(0 -> 42))
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
// prints out numbers 0 to 9
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
start("""+++++[->++++++++++<]>--<+++[->>++++++++++<<]>>++<<----------[+>.>.<+<]""", Map())
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
// some more "useful" programs
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
// hello world program 1
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
start("""++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
       ..+++.>>.<-.<.+++.------.--------.>>+.>++.""", Map())
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
// hello world program 2
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
start("""++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>+
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
      +.<<+++++++++++++++.>.+++.------.--------.>+.>.""", Map())
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
// draws the Sierpinski triangle
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
start("""++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
      ->[+[-]+>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
      ]>.>+[>>]>+]""", Map())
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
//fibonacci numbers below 100
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
start("""+++++++++++
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
      >+>>>>++++++++++++++++++++++++++++++++++++++++++++
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
      >++++++++++++++++++++++++++++++++<<<<<<[>[>>>>>>+>
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
      +<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>>>-]<[>++++++++++[-
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
      <-[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]>[<<[>>>+<<<
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
      -]>>[-]]<<]>>>[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
      >[<<+>>[-]]<<<<<<<]>>>>>[+++++++++++++++++++++++++
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
      +++++++++++++++++++++++.[-]]++++++++++<[->-<]>++++
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
      ++++++++++++++++++++++++++++++++++++++++++++.[-]<<
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
      <<<<<<<<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<-[>>.>.<<<
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
      [-]]<<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+>-]>[<+>-]<<<-]""", Map())
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
//outputs the square numbers up to 10000
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
start("""++++[>+++++<-]>[<+++++>-]+<+[
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
    >[>+>+<<-]++>>[<<+>>-]>>>[-]++>[-]+
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
    >>>+[[-]++++++>>>]<<<[[<++++++++<++>>-]+<.<[>----<-]<]
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
    <<[>>>>>[>>>[-]+++++++++<[>-<-]+++++++++>[-[<->-]+[<<<]]<[>+<-]>]<<-]<<-]""", Map())
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
//collatz numbers (need to be typed in)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
start(""">,[[----------[
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
      >>>[>>>>]+[[-]+<[->>>>++>>>>+[>>>>]++[->+<<<<<]]<<<]
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
      ++++++[>------<-]>--[>>[->>>>]+>+[<<<<]>-],<]>]>>>++>+>>[
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
      <<[>>>>[-]+++++++++<[>-<-]+++++++++>[-[<->-]+[<<<<]]<[>+<-]>]
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
      >[>[>>>>]+[[-]<[+[->>>>]>+<]>[<+>[<<<<]]+<<<<]>>>[->>>>]+>+[<<<<]]
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
      >[[>+>>[<<<<+>>>>-]>]<<<<[-]>[-<<<<]]>>>>>>>
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
      ]>>+[[-]++++++>>>>]<<<<[[<++++++++>-]<.[-]<[-]<[-]<]<,]""", Map())
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
// infinite collatz (never stops)
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
start(""">>+>+<[[->>[>>]>>>[>>]+[<<]<<<[<<]>[>[>>]>>+>[>>]<+<[<<]<<<[<
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
      <]>-]>[>>]>>[<<<<[<<]>+>[>>]>>-]<<<<[<<]+>>]<<[+++++[>+++++++
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
      +<-]>.<++++++[>--------<-]+<<]>>[>>]+[>>>>[<<+>+>-]<-[>+<-]+<
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
      [<<->>-[<<+>>[-]]]>>>[<<<+<<+>>>>>-]<<<[>>>+<<<-]<<[[-]>+>>->
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
      [<+<[<<+>>-]<[>+<-]<[>+<-]>>>>-]<[>+<-]+<[->[>>]<<[->[<+++>-[
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
      <+++>-[<+++>-[<[-]++>>[-]+>+<<-[<+++>-[<+++>-[<[-]+>>>+<<-[<+
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
      ++>-[<+++>-]]]]]]]]]<[>+<-]+<<]>>>+<[->[<+>-[<+>-[<+>-[<+>-[<
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
      +>-[<+>-[<+>-[<+>-[<+>-[<[-]>>[-]+>+<<-[<+>-]]]]]]]]]]]<[>+<-
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
      ]+>>]<<[<<]>]<[->>[->+>]<[-[<+>-[<->>+<-[<+>-[<->>+<-[<+>-[<-
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
      >>+<-[<+>-[<->>+<-[<+>-[<->>+<-[<+>-[<->>+<-[<+>-[<->>+<-[<+>
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
      -[<->>+<-[<+>-[<->>+<-[<+>-]]]]]]]]]]]]]]]]]]]>[<+>-]<+<[<+++
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
      +++++++>-]<]>>[<+>->>]<<[>+>+<<-]>[<+>-]+>[<->[-]]<[-<<-]<<[<
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
      <]]++++++[>+++++++<-]>++.------------.[-]>[>>]<<[+++++[>+++++
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
      +++<-]>.<++++++[>--------<-]+<<]+<]>[<+>-]<]>>>[>>]<<[>[-]<-<
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
      <]++++++++++.[-]<<<[<<]>>>+<[->[<+>-[<+>-[<+>-[<+>-[<+>-[<+>-
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
      [<+>-[<+>-[<+>-[<[-]>>[-]+>+<<-]]]]]]]]]]<[>+<-]+>>]<<[<<]>>]""", Map())
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
*/ 
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
4383809c176a updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
}