solutions5/bf.scala
changeset 292 a52987bf44e1
parent 290 2186e204a26c
child 329 8a34b2ebc8cc
--- a/solutions5/bf.scala	Wed Oct 30 14:27:54 2019 +0000
+++ b/solutions5/bf.scala	Wed Oct 30 21:56:46 2019 +0000
@@ -116,57 +116,57 @@
 // first some contrived (small) programs
 
 // clears the 0-cell
-run("[-]", Map(0 -> 100))    // Map will be 0 -> 0
+//run("[-]", Map(0 -> 100))    // Map will be 0 -> 0
 
 // copies content of the 0-cell to 1-cell
-run("[->+<]", Map(0 -> 10))  // Map will be 0 -> 0, 1 -> 10
+//run("[->+<]", Map(0 -> 10))  // Map will be 0 -> 0, 1 -> 10
 
 
 // copies content of the 0-cell to 2-cell and 4-cell
-run("[>>+>>+<<<<-]", Map(0 -> 42))
+//run("[>>+>>+<<<<-]", Map(0 -> 42))
 
 
 // prints out numbers 0 to 9
-run("""+++++[->++++++++++<]>--<+++[->>++++++++++<<]>>++<<----------[+>.>.<+<]""")
+//run("""+++++[->++++++++++<]>--<+++[->>++++++++++<<]>>++<<----------[+>.>.<+<]""")
 
 
 // some more "useful" programs
 
 // hello world program 1
-run("""++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++
-       ..+++.>>.<-.<.+++.------.--------.>>+.>++.""")
+//run("""++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++
+//       ..+++.>>.<-.<.+++.------.--------.>>+.>++.""")
 
 // hello world program 2
-run("""++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>+
-       +.<<+++++++++++++++.>.+++.------.--------.>+.>.""")
+//run("""++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>+
+//       +.<<+++++++++++++++.>.+++.------.--------.>+.>.""")
 
 // hello world program 3
-run("""+++++++++[>++++++++>+++++++++++>+++++<<<-]>.>++.+++++++..
-       +++.>-.------------.<++++++++.--------.+++.------.--------.>+.""")
+//run("""+++++++++[>++++++++>+++++++++++>+++++<<<-]>.>++.+++++++..
+//       +++.>-.------------.<++++++++.--------.+++.------.--------.>+.""")
 
  
 // draws the Sierpinski triangle
-run("""++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[
-      ->[+[-]+>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<
-      ]>.>+[>>]>+]""")
+//run("""++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[
+//      ->[+[-]+>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<
+//      ]>.>+[>>]>+]""")
 
-run(load_bff("sierpinski.bf"))
+//run(load_bff("sierpinski.bf"))
 
 
 //fibonacci numbers below 100
-run("""+++++++++++
-      >+>>>>++++++++++++++++++++++++++++++++++++++++++++
-      >++++++++++++++++++++++++++++++++<<<<<<[>[>>>>>>+>
-      +<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>>>-]<[>++++++++++[-
-      <-[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]>[<<[>>>+<<<
-      -]>>[-]]<<]>>>[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]
-      >[<<+>>[-]]<<<<<<<]>>>>>[+++++++++++++++++++++++++
-      +++++++++++++++++++++++.[-]]++++++++++<[->-<]>++++
-      ++++++++++++++++++++++++++++++++++++++++++++.[-]<<
-      <<<<<<<<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<-[>>.>.<<<
-      [-]]<<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+>-]>[<+>-]<<<-]""")
+//run("""+++++++++++
+//      >+>>>>++++++++++++++++++++++++++++++++++++++++++++
+//      >++++++++++++++++++++++++++++++++<<<<<<[>[>>>>>>+>
+//      +<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>>>-]<[>++++++++++[-
+//      <-[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]>[<<[>>>+<<<
+//      -]>>[-]]<<]>>>[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]
+//      >[<<+>>[-]]<<<<<<<]>>>>>[+++++++++++++++++++++++++
+//      +++++++++++++++++++++++.[-]]++++++++++<[->-<]>++++
+//      ++++++++++++++++++++++++++++++++++++++++++++.[-]<<
+//      <<<<<<<<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<-[>>.>.<<<
+//      [-]]<<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+>-]>[<+>-]<<<-]""")
 
-
+/*
 //outputs the square numbers up to 10000
 run("""++++[>+++++<-]>[<+++++>-]+<+[
     >[>+>+<<-]++>>[<<+>>-]>>>[-]++>[-]+
@@ -241,6 +241,6 @@
 }
 
 time_needed(1, run(b1))
-
+*/
 
 }