updated
authorChristian Urban <urbanc@in.tum.de>
Wed, 30 Oct 2019 21:56:46 +0000
changeset 292 a52987bf44e1
parent 291 5372c5a538d7
child 293 f4f2227ac957
updated
cws/cw04.pdf
cws/cw04.tex
cws/cw05.pdf
cws/cw05.tex
solutions1/collatz.jar
solutions1/drumb.jar
solutions2/danube.jar
solutions2/docdiff.jar
solutions4/postfix.jar
solutions4/postfix2.jar
solutions4/re.jar
solutions5/bf.jar
solutions5/bf.scala
solutions5/bfc.jar
templates1/collatz.jar
templates1/drumb.jar
templates2/danube.jar
templates2/docdiff.jar
testing3/knight1_test.sh
Binary file cws/cw04.pdf has changed
--- a/cws/cw04.tex	Wed Oct 30 14:27:54 2019 +0000
+++ b/cws/cw04.tex	Wed Oct 30 21:56:46 2019 +0000
@@ -144,19 +144,19 @@
 $ scala -cp re.jar
 scala> import CW9c._  
 scala> for (i <- 0 to 5000000 by 500000) {
-  | println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL, "a" * i))) + "secs.")
+  | println(f"$i: ${time_needed(2, matcher(EVIL, "a" * i))}%.5f secs.")
   | }
-0 0.00002 secs.
-500000 0.10608 secs.
-1000000 0.22286 secs.
-1500000 0.35982 secs.
-2000000 0.45828 secs.
-2500000 0.59558 secs.
-3000000 0.73191 secs.
-3500000 0.83499 secs.
-4000000 0.99149 secs.
-4500000 1.15395 secs.
-5000000 1.29659 secs.
+0: 0.00002 secs.
+500000: 0.10608 secs.
+1000000: 0.22286 secs.
+1500000: 0.35982 secs.
+2000000: 0.45828 secs.
+2500000: 0.59558 secs.
+3000000: 0.73191 secs.
+3500000: 0.83499 secs.
+4000000: 0.99149 secs.
+4500000: 1.15395 secs.
+5000000: 1.29659 secs.
 \end{lstlisting}%$
 
 
Binary file cws/cw05.pdf has changed
--- a/cws/cw05.tex	Wed Oct 30 14:27:54 2019 +0000
+++ b/cws/cw05.tex	Wed Oct 30 21:56:46 2019 +0000
@@ -48,7 +48,7 @@
 \begin{lstlisting}[language={},xleftmargin=1mm,numbers=none,basicstyle=\ttfamily\small]
 $ scala -cp bf.jar
 scala> import CW10a._  
-scala> run(load_bff("sierpinski.bf"))
+scala> run(load_bff("sierpinski.bf")) ; ()
                                *
                               * *
                              *   *
Binary file solutions1/collatz.jar has changed
Binary file solutions1/drumb.jar has changed
Binary file solutions2/danube.jar has changed
Binary file solutions2/docdiff.jar has changed
Binary file solutions4/postfix.jar has changed
Binary file solutions4/postfix2.jar has changed
Binary file solutions4/re.jar has changed
Binary file solutions5/bf.jar has changed
--- 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))
-
+*/
 
 }
Binary file solutions5/bfc.jar has changed
Binary file templates1/collatz.jar has changed
Binary file templates1/drumb.jar has changed
Binary file templates2/danube.jar has changed
Binary file templates2/docdiff.jar has changed
--- a/testing3/knight1_test.sh	Wed Oct 30 14:27:54 2019 +0000
+++ b/testing3/knight1_test.sh	Wed Oct 30 21:56:46 2019 +0000
@@ -5,7 +5,7 @@
 
 echo -e "" > $out
 
-echo -e "Below is the feedback for your submission of CW 8, Part 1 and 2." >> $out
+echo -e "Below is the feedback for your submission of CW 8, Preliminary Part" >> $out
 echo -e "" >> $out
 
 
@@ -42,7 +42,7 @@
 
 if (scala_vars knight1.scala)
 then
-  echo -e "  --> fail (make triple-sure your program conforms to the required format)" >> $out  
+  echo -e "  --> FAIL (make triple-sure your program conforms to the required format)" >> $out  
   tsts0=$(( 0 ))
 else
   echo -e "  --> success" >> $out