# HG changeset patch # User Christian Urban # Date 1572472606 0 # Node ID a52987bf44e125ac149c962f1921148cb99a3256 # Parent 5372c5a538d707eb6379c31fabe3a0bee8c3714a updated diff -r 5372c5a538d7 -r a52987bf44e1 cws/cw04.pdf Binary file cws/cw04.pdf has changed diff -r 5372c5a538d7 -r a52987bf44e1 cws/cw04.tex --- 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}%$ diff -r 5372c5a538d7 -r a52987bf44e1 cws/cw05.pdf Binary file cws/cw05.pdf has changed diff -r 5372c5a538d7 -r a52987bf44e1 cws/cw05.tex --- 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")) ; () * * * * * diff -r 5372c5a538d7 -r a52987bf44e1 solutions1/collatz.jar Binary file solutions1/collatz.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 solutions1/drumb.jar Binary file solutions1/drumb.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 solutions2/danube.jar Binary file solutions2/danube.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 solutions2/docdiff.jar Binary file solutions2/docdiff.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 solutions4/postfix.jar Binary file solutions4/postfix.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 solutions4/postfix2.jar Binary file solutions4/postfix2.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 solutions4/re.jar Binary file solutions4/re.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 solutions5/bf.jar Binary file solutions5/bf.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 solutions5/bf.scala --- 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)) - +*/ } diff -r 5372c5a538d7 -r a52987bf44e1 solutions5/bfc.jar Binary file solutions5/bfc.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 templates1/collatz.jar Binary file templates1/collatz.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 templates1/drumb.jar Binary file templates1/drumb.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 templates2/danube.jar Binary file templates2/danube.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 templates2/docdiff.jar Binary file templates2/docdiff.jar has changed diff -r 5372c5a538d7 -r a52987bf44e1 testing3/knight1_test.sh --- 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