updated testing files
authorChristian Urban <urbanc@in.tum.de>
Thu, 31 Oct 2019 12:01:56 +0000
changeset 300 72688efdf17c
parent 299 940b6c68102a
child 301 c3b33c709696
updated testing files
marking4/output
testing1/mark
testing1/mark2
testing2/mark
testing2/mark2
testing3/mark
testing3/mark2
testing3/testing3-bak/knight1.scala
testing3/testing3-bak/knight1_test.sh
testing3/testing3-bak/knight1a_test.scala
testing3/testing3-bak/knight1b_test.scala
testing3/testing3-bak/knight1c_test.scala
testing3/testing3-bak/knight2.scala
testing3/testing3-bak/knight2a_test.scala
testing3/testing3-bak/knight2b_test.scala
testing3/testing3-bak/knight3.scala
testing3/testing3-bak/knight3_test.sh
testing3/testing3-bak/knight3a_test.scala
testing3/testing3-bak/knight3b_test.scala
testing3/testing3-bak/knight3c_test.scala
testing3/testing3-bak/mark
testing4/mark
testing4/mark2
testing4/postfix.scala
testing4/postfix2.scala
testing4/postfix_test.sh
testing4/postfix_test7.scala
testing4/postfix_test8.scala
testing4/postfix_test9.scala
testing4/re.scala
testing4/re_test.sh
testing4/re_test1.scala
testing4/re_test2.scala
testing4/re_test3.scala
testing4/re_test4.scala
testing4/re_test5.scala
testing4/re_test6.scala
testing5/bf_test5.scala
testing5/mark
testing5/mark2
--- a/marking4/output	Thu Oct 31 11:33:02 2019 +0000
+++ b/marking4/output	Thu Oct 31 12:01:56 2019 +0000
@@ -1,95 +1,41 @@
 
-Below is the feedback and provisional marks for your submission
-for the core part of assignment 9.  Please note all marks are provisional until
-ratified by the assessment board -- this is not an official
-results transcript.
-
-re.scala does not contain vars, returns, Arrays, ListBuffers etc?
+postfix.scala does not contain vars, returns, Arrays, ListBuffers etc?
+  --> success
+postfix.scala runs?
   --> success
-re.scala runs?
-  --> success
- nullable(ZERO) == false
- nullable(ONE) == true
- nullable(CHAR('a')) == false
- nullable(ZERO | ONE) == true
- nullable(ZERO | CHAR('a')) == false
- nullable(ONE ~  ONE) == true
- nullable(ONE ~ CHAR('a')) == false
- nullable(STAR(ZERO)) == true
+ syard(split("3 + 4 * ( 2 - 1 )")) == List("3", "4", "2", "1", "-", "*", "+")
+ syard(split("( ( ( 3 ) ) + ( ( 4 + ( 5 ) ) ) )")) == List("3", "4", "5", "+", "+")
+ syard(split("5 + 7 / 2")) == List("5", "7", "2", "/", "+")
+ syard(split("5 * 7 / 2")) == List("5", "7", "*", "2", "/")
   --> success
- der('a', ZERO | ONE) == (ZERO | ZERO)
- der('a', (CHAR('a') | ONE) ~ CHAR('a')) == ALT((ONE | ZERO) ~ CHAR('a'), ONE)
- der('a', (CHAR('a') | CHAR('a')) ~ CHAR('a')) == (ONE | ONE) ~ CHAR('a')
- der('a', STAR(CHAR('a'))) == (ONE ~ STAR(CHAR('a')))
- der('b', STAR(CHAR('a'))) == (ZERO ~ STAR(CHAR('a')))
-
- val r0 = "a" ~ "b" ~ "c"
- assert(der('a', r0) == (ONE ~ "b") ~ "c")
- assert(der('b', r0) == (ZERO ~ "b") ~ "c")
- assert(der('c', r0) == (ZERO ~ "b") ~ "c")
-
- val r1 = (ONE ~ "b") ~ "c"
- assert(der('a', r1) == ((ZERO ~ "b") | ZERO) ~ "c")
- assert(der('b', r1) == ((ZERO ~ "b") | ONE) ~ "c")
- assert(der('c', r1) == ((ZERO ~ "b") | ZERO) ~ "c")
-
- val r2 = ((ZERO ~ "b") | ONE) ~ "c"
- assert(der('a', r2) == ((((ZERO ~ "b") | ZERO) ~ "c") | ZERO))
- assert(der('b', r2) == ((((ZERO ~ "b") | ZERO) ~ "c") | ZERO))
- assert(der('c', r2) == ((((ZERO ~ "b") | ZERO) ~ "c") | ONE))
+ compute(syard(split("3 + 4 * ( 2 - 1 )"))) == 7
+ compute(syard(split("10 + 12 * 33"))) == 406
+ compute(syard(split("( 5 + 7 ) * 2"))) == 24
+ compute(syard(split("5 + 7 / 2"))) == 8
+ compute(syard(split("5 * 7 / 2"))) == 17
+ compute(syard(split("9 + 24 / ( 7 - 3 )"))) == 15
+  --> success
+postfix2.scala does not contain vars, returns, Arrays, ListBuffers etc?
+  --> success
+postfix2.scala runs?
   --> success
- simp(ZERO | ONE) == ONE
- simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE)
- simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a')
- simp(((ONE ~ ONE) ~ ONE) ~ CHAR('a')) == CHAR('a')
- simp(((ONE | ONE) ~ ONE) ~ CHAR('a')) == CHAR('a')
- simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO
- simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a')
- simp(CHAR('a') | CHAR('a')) == CHAR('a')
- simp(CHAR('a') ~ CHAR('a')) == CHAR('a') ~ CHAR('a')
- simp(ONE | CHAR('a')) == (ONE | CHAR('a'))
- simp(ALT((CHAR('a') | ZERO) ~ ONE,
-          ((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a')
- simp((ZERO | ((ZERO | ZERO) | (ZERO | ZERO))) ~ ((ONE | ZERO) | ONE ) ~ (CHAR('a'))) == ZERO
- simp(ALT(ONE | ONE, ONE | ONE)) == ONE
- simp(ALT(ZERO | CHAR('a'), CHAR('a') | ZERO)) == CHAR('a')
+ syard(split("3 + 4 * ( 2 - 1 )")) == List("3", "4", "2", "1", "-", "*", "+")
+ syard(split("( ( ( 3 ) ) + ( ( 4 + ( 5 ) ) ) )")) == List("3", "4", "5", "+", "+")
+ syard(split("5 + 7 / 2")) == List("5", "7", "2", "/", "+")
+ syard(split("5 * 7 / 2")) == List("5", "7", "*", "2", "/")
+ syard(split("3 + 4 * 8 / ( 5 - 1 ) ^ 2 ^ 3")) == 
+         List("3", "4", "8", "*", "5", "1", "-", "2", "3", "^", "^", "/", "+")
+ 
+ compute(syard(split("3 + 4 * ( 2 - 1 )"))) == 7
+ compute(syard(split("10 + 12 * 33"))) == 406
+ compute(syard(split("( 5 + 7 ) * 2"))) == 24
+ compute(syard(split("5 + 7 / 2"))) == 8
+ compute(syard(split("5 * 7 / 2"))) == 17
+ compute(syard(split("9 + 24 / ( 7 - 3 )"))) == 15
+ compute(syard(split("4 ^ 3 ^ 2"))) == 262144
+ compute(syard(split("4 ^ ( 3 ^ 2 )"))) == 262144
+ compute(syard(split("( 4 ^ 3 ) ^ 2"))) == 4096
+ compute(syard(split("( 3 + 1 ) ^ 2 ^ 3"))) == 65536
   --> success
- val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
- ders(("a" * 5).toList,EVIL) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b'))
- ders(List('b'),EVIL) == ONE
- ders(List('b','b'),EVIL) == ZERO
- matcher(EVIL, "a" * 5 ++ "b") == true
- matcher(EVIL, "a" * 50 ++ "b") == true
- matcher(EVIL, "a" * 50) == false
- matcher(EVIL, "b") == true
- matcher(EVIL, "bb") == false
- matcher("abc", "abc") == true
- matcher("abc", "ab") == true
- matcher(("ab" | "a") ~ (ONE | "bc"), "abc") == true
- matcher(ONE, "") == true
- matcher(ZERO, "") == false
- matcher(ONE | CHAR('a'), "") == true
- matcher(ONE | CHAR('a'), "a") == true
-  --> success
- val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
- size(der('a', der('a', EVIL))) == 28
- size(der('a', der('a', der('a', EVIL)))) == 58
- size(ders("aaaaaa".toList, EVIL)) == 8
- size(ders(("a" * 50).toList, EVIL)) == 8
-  --> success
- simp(Iterator.iterate(ONE:Rexp)(r => SEQ(r, ONE | ONE)).drop(50).next) == ONE
-    ...the Iterator produces the rexp
-
-      SEQ(SEQ(SEQ(..., ONE | ONE) , ONE | ONE), ONE | ONE)
-
-    where SEQ is nested 50 times.
-
- simp(Iterator.iterate(ONE:Rexp)(r => ALT(r, r)).drop(20).next) == ONE
-    ... the Iterator produces a rexp of size 2097151
-
- val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
- matcher(EVIL, "a" * 1000000 ++ "b") == true
- matcher(EVIL, "a" * 1000000) == false
-  --> success
-Overall mark for CW 9, Core Part
-6
+Overall mark for CW 9, Preliminary Part
+4
--- a/testing1/mark	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing1/mark	Thu Oct 31 12:01:56 2019 +0000
@@ -7,8 +7,9 @@
 
 cp $DIR/* .
 
+./collatz_test.sh tmp_output1
 
 echo -e "Here is an automated test report for your work so far on assignment 6.  Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Please ensure you test your code on your own machine in order to make sure it is bug free!! Passing these tests does not guarantee your code is free from bugs!! Also after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
 
-./collatz_test.sh >> $1
+cat tmp_output1 >> $1
 
--- a/testing1/mark2	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing1/mark2	Thu Oct 31 12:01:56 2019 +0000
@@ -7,7 +7,8 @@
 
 cp $DIR/* .
 
+./drumb_test.sh tmp_output2
 
 echo -e "Here is an automated test report for your work so far on assignment 6.  Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Please ensure you test your code on your own machine in order to make sure it is bug free!! Passing these tests does not guarantee your code is free from bugs!! Also after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
 
-./drumb_test.sh >> $1 
+cat tmp_output2 >> $1 
--- a/testing2/mark	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing2/mark	Thu Oct 31 12:01:56 2019 +0000
@@ -7,9 +7,9 @@
 
 cp $DIR/* .
 
-./docdiff_test.sh tmp_output
+./docdiff_test.sh tmp_output1
 
 echo -e "Here is an automated test report for your work so far on assignment 7. Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Please ensure you test your code on your own machine in order to make sure it is bug free!! Passing these tests does not guarantee your code is free from bugs!! Also after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
 
-cat tmp_output >> $1 
+cat tmp_output1 >> $1 
 
--- a/testing2/mark2	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing2/mark2	Thu Oct 31 12:01:56 2019 +0000
@@ -7,9 +7,9 @@
 
 cp $DIR/* .
 
-./danube_test.sh tmp_output
+./danube_test.sh tmp_output2
 
 echo -e "Here is an automated test report for your work on the advanced part of assignment 7. Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Please ensure you test your code on your own machine in order to make sure it is bug free!! Passing these tests does not guarantee your code is free from bugs!! Also after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
 
-cat tmp_output >> $1 
+cat tmp_output2 >> $1 
 
--- a/testing3/mark	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing3/mark	Thu Oct 31 12:01:56 2019 +0000
@@ -7,12 +7,11 @@
 
 cp $DIR/* .
 
-./knight1_test.sh output1
-#./knight2_test.sh output2
+./knight_test.sh tmp_output
 
-echo "Here is an automated test report for your work so far on assignment 8.  Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Passing these tests does not guarantee your code is free from bugs: after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
+echo -e "Here is an automated test report for your work so far on assignment 8. Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Please ensure you test your code on your own machine in order to make sure it is bug free!! Passing these tests does not guarantee your code is free from bugs!! Also after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
 
 
-cat output1 >> $1
+cat tmp_output >> $1
 
 
--- a/testing3/mark2	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#!/bin/bash
-###set -e
-
-trap "exit" INT
-
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-cp $DIR/* .
-
-./knight2_test.sh output1
-
-
-echo -e "Here is an automated test report for your work so far on assignment 8.  Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Passing these tests does not guarantee your code is free from bugs: after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
-
-
-cat output1 >> $1
-
-
--- a/testing3/testing3-bak/knight1.scala	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-
-// Part 1 about finding and counting Knight's tours
-//==================================================
-
-object CW7a extends App{
-
-type Pos = (Int, Int)    // a position on a chessboard 
-type Path = List[Pos]    // a path...a list of positions
-
-//(1a) Complete the function that tests whether the position 
-//     is inside the board and not yet element in the path.
-
-//def is_legal(dim: Int, path: Path)(x: Pos) : Boolean = ...
-
-def is_legal(dim: Int, path: Path)(x: Pos) : Boolean = {
-  
-// if ((x._1<dim && x._2<dim) && (x._1>0 || x._2>0)) false else !path.contains(x)
- 
-  if (x._1 < 0 || x._2 < 0) false 
-  else if (x._1 < dim && x._2 < dim && !path.contains(x)) true 
-  else false
- 
-  
-}
-
-
-
-def legal_moves(dim: Int, path: Path, x: Pos) : List[Pos] = {
-  
-  val allPossibleMoves = List((x._1+1, x._2+2), (x._1+2, x._2+1), (x._1+2, x._2-1), (x._1+1, x._2-2), (x._1-1, x._2-2), (x._1-2, x._2-1), (x._1-2, x._2+1), (x._1-1, x._2+2));
- 
-  //val finalList = allPossibleMoves.filter((a=>a._1<dim && a._2<dim && x._1 >= 0 && a._2 >= 0));
-  
-  val finalList = for(pos<-allPossibleMoves if(is_legal(dim,path)(pos))) yield pos;
-  
-  // println("Space in board: " + dim*dim + " for dim: " + dim)
-   
-  
-  finalList.toList;
-    
-  
-}
-
-println(legal_moves(8, Nil, (2,2)))
-println(legal_moves(8, Nil, (7,7)))
-println(legal_moves(8, List((4,1), (1,0)), (2,2)))
-println(legal_moves(8, List((6,6)), (7,7)))
-println(legal_moves(1, Nil, (0,0)))
-println(legal_moves(2, Nil, (0,0)))
-println(legal_moves(3, Nil, (0,0)))
-
-println("=================================================================================")
-println("================================Comparision output===============================")
-println("=================================================================================")
-
-println(legal_moves(8, Nil, (2,2)) == List((3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4)))
-println(legal_moves(8, Nil, (7,7)) == List((6,5), (5,6)))
-println(legal_moves(8, List((4,1), (1,0)), (2,2)) == List((3,4), (4,3), (3,0), (0,1), (0,3), (1,4)))
-println(legal_moves(8, List((6,6)), (7,7)) == List((6,5), (5,6)))
-println(legal_moves(1, Nil, (0,0)) == Nil)
-println(legal_moves(2, Nil, (0,0)) == Nil)
-println(legal_moves(3, Nil, (0,0)) == List((1,2), (2,1)))
-
-
-def count_tours(dim: Int, path: Path) : Int = {
-     
-  val allMovesFromCurrentPosition = legal_moves(dim, path, path.head);
-  
-  if (path.length == dim*dim) 1 else  {
-    
-    if (allMovesFromCurrentPosition.size == 0 ) 0  else {
-      
-      allMovesFromCurrentPosition.map( element => count_tours(dim, element::path)).sum
-      
-      
-    }
-    
-  }
-  
-}
-    
-  
-
-println ( count_tours(5, List((0,0))) )
-
-def enum_tours(dim: Int, path: Path) : List[Path] = {
-  
-     val allMovesFromCurrentPosition = legal_moves(dim, path, path.head);
-  
-  if (path.length == dim*dim) List(path) else  {
-    
-  allMovesFromCurrentPosition.map( element => enum_tours(dim, element::path)).flatten ;
-      
-      
-      }
-    }
-  println ( enum_tours(6, List((0,2))).size)
-}
-
-
-
-
-
- 
- 
-//(1b) Complete the function that calculates for a position 
-//     all legal onward moves that are not already in the path. 
-//     The moves should be ordered in a "clockwise" manner.
- 
-//def legal_moves(dim: Int, path: Path, x: Pos) : List[Pos] = ...
-
-
-
-
-//some test cases
-//
-//assert(legal_moves(8, Nil, (2,2)) == 
-//  List((3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4)))
-//assert(legal_moves(8, Nil, (7,7)) == List((6,5), (5,6)))
-//assert(legal_moves(8, List((4,1), (1,0)), (2,2)) == 
-//  List((3,4), (4,3), (3,0), (0,1), (0,3), (1,4)))
-//assert(legal_moves(8, List((6,6)), (7,7)) == List((6,5), (5,6)))
-
-
-//(1c) Complete the two recursive functions below. 
-//     They exhaustively search for knight's tours starting from the 
-//     given path. The first function counts all possible tours, 
-//     and the second collects all tours in a list of paths.
-
-//def count_tours(dim: Int, path: Path) : Int = ...
-
-
-//def enum_tours(dim: Int, path: Path) : List[Path] = ...
--- a/testing3/testing3-bak/knight1_test.sh	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,206 +0,0 @@
-#!/bin/bash
-
-# to make the script fail safely
-set -euo pipefail
-
-out=${1:-output}
-
-echo "" > $out
-
-echo "Below is the feedback and provisional marks for your submission" >> $out
-echo "for assignment 7 Part 1.  Please note all marks are provisional until" >> $out
-echo "ratified by the assessment board -- this is not an official" >> $out
-echo "results transcript." >> $out
-echo "" >> $out
-
-echo "Below is the feedback for your submission of CW 7, Part 1." >> $out
-echo "" >> $out
-
-
-# marks for CW7 part 1
-marks=$(( 0 ))
-
-
-# compilation tests (used to be 30 secs)
-
-function scala_compile {
-  (ulimit -t 360; JAVA_OPTS="-Xmx1g" scala "$1" 2> /dev/null 1> /dev/null) 
-}
-
-# functional tests
-
-function scala_assert {
-  (ulimit -t 360; JAVA_OPTS="-Xmx1g" scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
-}
-
-# purity test
-
-function scala_vars {
-   (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
-}
-
-
-# knights1: purity test
-
-echo "knight1.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
-
-if (scala_vars knight1.scala)
-then
-  echo "  --> fail" | tee -a $out
-  tsts0=$(( 1 ))
-else
-  echo "  --> success" | tee -a $out
-  tsts0=$(( 0 )) 
-fi
-
-
-# compilation test
-
-if [ $tsts0 -eq 0 ]
-then    
-  echo "knight1.scala runs?" | tee -a $out
-
-  if (scala_compile knight1.scala)
-  then
-    echo "  --> success " | tee -a $out
-    tsts1=$(( 0 ))
-  else
-    echo "  --> scala did not run knight1.scala" | tee -a $out
-    tsts1=$(( 1 )) 
-  fi
-else
-  tsts1=$(( 1 ))   
-fi
-
-### knight1a test
-
-if [ $tsts1 -eq 0 ]
-then
-    echo " is_legal(8, Nil)(3, 4) == true " | tee -a $out
-    echo " is_legal(8, List((4, 1), (1, 0)))(4, 1) == false " | tee -a $out
-    echo " is_legal(2, Nil)(0, 0) == true" | tee -a $out                          
-
-    if (scala_assert "knight1.scala" "knight1a_test.scala")
-    then
-        echo "  --> success" | tee -a $out
-	marks=$(( marks + 1 ))
-    else
-        echo "  --> test failed" | tee -a $out
-    fi
-fi
-
-### knight1b test
-
-if [ $tsts1 -eq 0 ]
-then
-  echo " legal_moves(8, Nil, (2,2)) == List((3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4))" | tee -a $out
-  echo " legal_moves(8, Nil, (7,7)) == List((6,5), (5,6))" | tee -a $out
-  echo " legal_moves(8, List((4,1), (1,0)), (2,2)) == List((3,4), (4,3), (3,0), (0,1), (0,3), (1,4))" | tee -a $out
-  echo " legal_moves(8, List((6,6)), (7,7)) == List((6,5), (5,6))" | tee -a $out
-  echo " legal_moves(1, Nil, (0,0)) == Nil" | tee -a $out
-  echo " legal_moves(2, Nil, (0,0)) == Nil" | tee -a $out
-  echo " legal_moves(3, Nil, (0,0)) == List((1,2), (2,1))" | tee -a $out
-  
-  if (scala_assert "knight1.scala" "knight1b_test.scala")
-  then
-     echo "  --> success" | tee -a $out
-     marks=$(( marks + 1 ))
-  else
-    echo "  --> test failed" | tee -a $out
-  fi
-fi
-
-
-### knight1c test
-
-if [ $tsts1 -eq 0 ]
-then
-  echo " all_tours from every position on the board" | tee -a $out
-  echo " dim = 1: 1" | tee -a $out
-  echo "       2: 0,0,0,0" >>  $out
-  echo "       3: 0,0,0,0,0,0,0,0,0" >>  $out
-  echo "       4: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" | tee -a $out
-  echo "       5: 304,0,56,0,304,0,56,0,56,0,56,0,64,0,56,0,56,0,56,0,304,0,56,0,304" | tee -a $out
-  echo " enum_tours(5, List((0,2)) ) => 56 tours? and all correct?" | tee -a $out
-  
-  if (scala_assert "knight1.scala" "knight1c_test.scala") 
-  then
-     echo "  --> success" | tee -a $out
-     marks=$(( marks + 2 ))
-  else
-    echo "  --> test failed" | tee -a $out
-  fi
-fi
-
-
-# knights2: var test
-
-echo "knight2.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
-
-if (scala_vars knight2.scala)
-then
-  echo "  --> fail" | tee -a $out
-  tsts0=$(( 1 ))
-else
-  echo "  --> success" | tee -a $out
-  tsts0=$(( 0 )) 
-fi
-
-
-# compilation test
-if  [ $tsts0 -eq 0 ]
-then    
-  echo "knight2.scala runs?" | tee -a $out
-
-  if (scala_compile knight2.scala)
-  then
-    echo "  --> success" | tee -a $out
-    tsts1=$(( 0 ))
-  else
-    echo "  --> scala did not run knight2.scala" | tee -a $out
-    tsts1=$(( 1 )) 
-  fi
-else
-  tsts1=$(( 1 ))     
-fi
-
-### knight2a test
-
-if [ $tsts1 -eq 0 ]
-then
-  echo " val f = (x:(Int, Int)) => if (x._1 > 3) Some(List(x)) else None " | tee -a $out
-  echo "   first(List((1,0),(2,0),(3,0),(4,0)), f) == Some(List((4,0)))" | tee -a $out
-  echo "   first(List((1,0),(2,0),(3,0)), f) == None" | tee -a $out
-
-  if (scala_assert "knight2.scala" "knight2a_test.scala") 
-  then
-    echo "  --> success" | tee -a $out
-    marks=$(( marks + 1 ))
-  else
-    echo "  --> test failed" | tee -a $out
-  fi
-fi
-
-
-### knight2b test
-
-if [ $tsts1 -eq 0 ]
-then
-  echo " is first_tour(8, List((0, 0))) ok? " | tee -a $out
-  echo " is first_tour(4, List((0, 0))) == None " | tee -a $out
-
-  if (scala_assert "knight2.scala" "knight2b_test.scala") 
-  then
-     echo "  --> success" | tee -a $out
-     marks=$(( marks + 2 ))
-  else
-    echo "  --> test failed" | tee -a $out
-  fi
-fi
-
-
-## final marks
-echo "Overall mark for Part 1" | tee -a $out
-echo "$marks" | tee -a $out
-
-
--- a/testing3/testing3-bak/knight1a_test.scala	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-
-assert(CW7a.is_legal(8, Nil)(3, 4) == true)
-assert(CW7a.is_legal(8, List((4, 1), (1, 0)))(4, 1) == false)
-assert(CW7a.is_legal(2, Nil)(0, 0) == true)
-
--- a/testing3/testing3-bak/knight1b_test.scala	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-assert(CW7a.legal_moves(8, Nil, (2,2)) == 
-             List((3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4)))
-assert(CW7a.legal_moves(8, Nil, (7,7)) == List((6,5), (5,6)))
-assert(CW7a.legal_moves(8, List((4,1), (1,0)), (2,2)) == 
-       List((3,4), (4,3), (3,0), (0,1), (0,3), (1,4)))
-assert(CW7a.legal_moves(8, List((6,6)), (7,7)) == List((6,5), (5,6)))
-assert(CW7a.legal_moves(1, Nil, (0,0)) == List())
-assert(CW7a.legal_moves(2, Nil, (0,0)) == List())
-assert(CW7a.legal_moves(3, Nil, (0,0)) == List((1,2), (2,1)))
-
--- a/testing3/testing3-bak/knight1c_test.scala	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-
-import scala.concurrent._
-import scala.concurrent.duration._
-import ExecutionContext.Implicits.global
-import scala.language.postfixOps 
-
-type Pos = (Int, Int)    // a position on a chessboard 
-type Path = List[Pos]    // a path...a list of positions
-
-def count_all_tours_urban(dim: Int) = {
-  for (i <- (0 until dim).toList; 
-       j <- (0 until dim).toList) yield CW7a.count_tours(dim, List((i, j)))
-}
-
-def add_pair_urban(x: Pos)(y: Pos): Pos = 
-  (x._1 + y._1, x._2 + y._2)
-
-def is_legal_urban(dim: Int, path: Path)(x: Pos): Boolean = 
-  0 <= x._1 && 0 <= x._2 && x._1 < dim && x._2 < dim && !path.contains(x)
-
-def moves_urban(x: Pos): List[Pos] = 
-  List(( 1,  2),( 2,  1),( 2, -1),( 1, -2),
-       (-1, -2),(-2, -1),(-2,  1),(-1,  2)).map(add_pair_urban(x))
-
-def legal_moves_urban(dim: Int, path: Path, x: Pos): List[Pos] = 
-  moves_urban(x).filter(is_legal_urban(dim, path))
-
-def correct_urban(dim: Int)(p: Path): Boolean = p match {
-  case Nil => true
-  case x::Nil => true
-  case x::y::p => if (legal_moves_urban(dim, p, y).contains(x)) correct_urban(dim)(y::p) else false
-}
-
-
-lazy val f = Future {
-  assert(count_all_tours_urban(1) == List(1))
-  assert(count_all_tours_urban(2) == List(0, 0, 0, 0))
-  assert(count_all_tours_urban(3) == List(0, 0, 0, 0, 0, 0, 0, 0, 0))
-  assert(count_all_tours_urban(4) == List(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
-  assert(count_all_tours_urban(5) == List(304, 0, 56, 0, 304, 0, 56, 0, 56, 0, 56, 0, 64, 0, 56, 0, 56, 0, 56, 0, 304, 0, 56, 0, 304))
-
-  val ts = CW7a.enum_tours(5, List((0, 2)))
-  assert(ts.map(correct_urban(5)).forall(_ == true) == true)
-  assert(ts.length == 56)  
-}
-
-Await.result(f, 360 second)
--- a/testing3/testing3-bak/knight2.scala	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-// Part 2 about finding a single tour for a board
-//================================================
-
-object CW7b {
-
-type Pos = (Int, Int)    // a position on a chessboard 
-type Path = List[Pos]    // a path...a list of positions
-
-def print_board(dim: Int, path: Path) : Unit = {
-  println
-  for (i <- 0 until dim) {
-    for (j <- 0 until dim) {
-      print(f"${path.reverse.indexOf((i, j))}%3.0f ")
-    }
-    println
-  } 
-}
-
-def add_pair(x: Pos)(y: Pos) : Pos = 
-  (x._1 + y._1, x._2 + y._2)
-
-def is_legal(dim: Int, path: Path)(x: Pos) : Boolean = 
-  0 <= x._1 && 0 <= x._2 && x._1 < dim && x._2 < dim && !path.contains(x)
-
-def moves(x: Pos) : List[Pos] = 
-  List(( 1,  2),( 2,  1),( 2, -1),( 1, -2),
-       (-1, -2),(-2, -1),(-2,  1),(-1,  2)).map(add_pair(x))
-
-def legal_moves(dim: Int, path: Path, x: Pos) : List[Pos] = 
-  moves(x).filter(is_legal(dim, path))
-
-
-def first(xs: List[Pos], f: Pos => Option[Path]) : Option[Path] = xs match {
-  case Nil => None
-  case x::xs => {
-    val result = f(x)
-    if (result.isDefined) result else first(xs, f)
-  }
-}
-
-//first(List((1, 0),(2, 0),(3, 0),(4, 0)), (x => if (x._1 > 3) Some(List(x)) else None))
-//first(List((1, 0),(2, 0),(3, 0)), (x => if (x._1 > 3) Some(List(x)) else None))
-
-def first_tour(dim: Int, path: Path) : Option[Path] = {
-  if (path.length == dim * dim) Some(path)
-  else
-    first(legal_moves(dim, path, path.head), (x: Pos) => first_tour(dim, x::path))
-}
-
-/* 
-val ts1 = first_tour(8, List((0, 0))).get
-  assert(correct_urban(8)(ts1) == true)
-
-val ts2 = first_tour(4, List((0, 0)))
-assert(ts2 == None)  
-
-print_board(8, first_tour(8, List((0, 0))).get)
-*/
-
-}
-
--- a/testing3/testing3-bak/knight2a_test.scala	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-
-val f = (x:(Int, Int)) => if (x._1 > 3) Some(List(x)) else None
-
-assert(CW7b.first(List((1,0),(2,0),(3,0),(4,0)), f) == Some(List((4,0))))
-assert(CW7b.first(List((1,0),(2,0),(3,0)), f) == None)
--- a/testing3/testing3-bak/knight2b_test.scala	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-
-import scala.concurrent._
-import scala.concurrent.duration._
-import ExecutionContext.Implicits.global
-import scala.language.postfixOps 
-
-type Pos = (Int, Int)    // a position on a chessboard 
-type Path = List[Pos]    // a path...a list of positions
-
-def add_pair_urban(x: Pos)(y: Pos): Pos = 
-  (x._1 + y._1, x._2 + y._2)
-
-def is_legal_urban(dim: Int, path: Path)(x: Pos): Boolean = 
-  0 <= x._1 && 0 <= x._2 && x._1 < dim && x._2 < dim && !path.contains(x)
-
-def moves_urban(x: Pos): List[Pos] = 
-  List(( 1,  2),( 2,  1),( 2, -1),( 1, -2),
-       (-1, -2),(-2, -1),(-2,  1),(-1,  2)).map(add_pair_urban(x))
-
-def legal_moves_urban(dim: Int, path: Path, x: Pos): List[Pos] = 
-  moves_urban(x).filter(is_legal_urban(dim, path))
-
-def correct_urban(dim: Int)(p: Path): Boolean = p match {
-  case Nil => true
-  case x::Nil => true
-  case x::y::p => 
-    if (legal_moves_urban(dim, p, y).contains(x)) correct_urban(dim)(y::p) else false
-}
-
-
-lazy val f = Future {
-
-  val ts1 = CW7b.first_tour(8, List((0, 0))).get
-  assert(correct_urban(8)(ts1) == true)
-
-  val ts2 = CW7b.first_tour(4, List((0, 0)))
-  assert(ts2 == None)  
-}
-
-Await.result(f, 300 second)
--- a/testing3/testing3-bak/knight3.scala	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-// Part 3 about finding a single tour using the Warnsdorf Rule
-//=============================================================
-
-//object CW8c { // for preparing the jar
-
-type Pos = (Int, Int)
-type Path = List[Pos]
-
-
-// for measuring time in the JAR
-def time_needed[T](code: => T) : T = {
-  val start = System.nanoTime()
-  val result = code
-  val end = System.nanoTime()
-  println(f"Time needed: ${(end - start) / 1.0e9}%3.3f secs.")
-  result
-}
-
-
-def print_board(dim: Int, path: Path): Unit = {
-  println
-  for (i <- 0 until dim) {
-    for (j <- 0 until dim) {
-      print(f"${path.reverse.indexOf((i, j))}%4.0f ")
-    }
-    println
-  } 
-}
-
-def add_pair(x: Pos, y: Pos): Pos = 
-  (x._1 + y._1, x._2 + y._2)
-
-def is_legal(dim: Int, path: Path, x: Pos): Boolean = 
-  0 <= x._1 && 0 <= x._2 && x._1 < dim && x._2 < dim && !path.contains(x)
-
-def moves(x: Pos): List[Pos] = 
-  List(( 1,  2),( 2,  1),( 2, -1),( 1, -2),
-       (-1, -2),(-2, -1),(-2,  1),(-1,  2)).map(add_pair(x, _))
-
-def legal_moves(dim: Int, path: Path, x: Pos): List[Pos] = 
-  moves(x).filter(is_legal(dim, path, _))
- 
-def ordered_moves(dim: Int, path: Path, x: Pos): List[Pos] = 
-  legal_moves(dim, path, x).sortBy((x) => legal_moves(dim, path, x).length)
-
-import scala.annotation.tailrec
-
-@tailrec
-def tour_on_mega_board_aux(dim: Int, paths: List[Path]): Option[Path] = paths match {
-  case Nil => None
-  case (path::rest) =>
-    if (path.length == dim * dim) Some(path)
-    else tour_on_mega_board_aux(dim, ordered_moves(dim, path, path.head).map(_::path) ::: rest)
-}
-
-def ttour_on_mega_board(dim: Int, path: Path): Option[Path] =
-  tour_on_mega_board_aux(dim, List(path))
-
-
-def tour_on_mega_board(dim: Int, path: Path) =
-  time_needed(ttour_on_mega_board(dim: Int, path: Path))
-
-//}
--- a/testing3/testing3-bak/knight3_test.sh	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-#!/bin/bash
-
-# to make the script fail safely
-set -euo pipefail
-
-
-out=${1:-output}
-
-echo "" > $out
-
-echo "Below is the feedback and provisional marks for your submission" >> $out
-echo "for assignment 7 Part 2.  Please note all marks are provisional until" >> $out
-echo "ratified by the assessment board -- this is not an official" >> $out
-echo "results transcript." >> $out
-echo "" >> $out
-
-# marks for CW7 part 2
-marks=$(( 0 ))
-
-# compilation tests
-
-function scala_compile {
-    (ulimit -t 360; JAVA_OPTS="-Xmx1g" scala "$1" 2> /dev/null 1> /dev/null)
-}
-
-# functional tests
-
-function scala_assert {
-    (ulimit -t 360; JAVA_OPTS="-Xmx4g -Xss200m" scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
-}
-
-
-# purity test
-
-function scala_vars {
-   (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
-}
-
-
-# knights3: purity test
-#
-echo "knight3.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
-
-
-if (scala_vars knight3.scala)
-then
-  echo "  --> test failed" | tee -a $out
-  tsts0=$(( 1 ))
-else
-  echo "  --> success" | tee -a $out
-  tsts0=$(( 0 )) 
-fi
-
-
-# compilation test
-if  [ $tsts0 -eq 0 ]
-then    
-  echo "knight3.scala runs?" | tee -a $out
-
-  if (scala_compile knight3.scala)
-  then
-    echo "  --> success" | tee -a $out
-    tsts1=$(( 0 ))
-  else
-    echo "  --> scala knight3.scala did not run successfully" | tee -a $out
-    tsts1=$(( 1 )) 
-  fi
-else
-  tsts1=$(( 1 ))     
-fi
-
-# ordered move test
-
-if [ $tsts1 -eq 0 ]
-then
-  echo " ordered_moves(8, List((3,4), (3,2)), (1,3)) == List((0,1), (0,5), (2,1), (2,5))" | tee -a $out
-  echo " ordered_moves(8, List((4,0)), (0,0)) == List((2,1), (1,2))" | tee -a $out
-  echo " ordered_moves(8, List((0,4)), (0,0)) == List((1,2), (2,1))" | tee -a $out
-  
-  if (scala_assert "knight3.scala" "knight3a_test.scala")
-  then
-      echo "  --> success" | tee -a $out
-      marks=$(( marks + 1 ))
-  else
-    echo "  --> test failed" | tee -a $out
-  fi
-fi
-
-
-# first-closed-tour test
-
-if [ $tsts1 -eq 0 ]
-then
-  echo " first_closed_tour_heuristic(6, List((3,3))) found and correct?" | tee -a $out
-  
-  if (scala_assert "knight3.scala" "knight3b_test.scala")
-  then
-      echo "  --> success" | tee -a $out
-      marks=$(( marks + 1 ))
-  else
-      echo "  --> test failed" | tee -a $out
-  fi
-fi
-
-
-
-if [ $tsts1 -eq 0 ]
-then
-  echo " first_tour_heuristic(8, List((0,0))) found and correct?" | tee -a $out
-  echo " first_tour_heuristic(40, List((0,0))) found and correct?" | tee -a $out
-  
-  if (scala_assert "knight3.scala" "knight3c_test.scala")
-  then
-      echo "  --> success" | tee -a $out
-      marks=$(( marks + 1 ))
-  else
-    echo "  --> test failed" | tee -a $out
-  fi
-fi
-
-
-## final marks
-echo "Overall mark for CW 7, Part 2" | tee -a $out
-echo "$marks" | tee -a $out
--- a/testing3/testing3-bak/knight3a_test.scala	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-
-import scala.concurrent._
-import scala.concurrent.duration._
-import ExecutionContext.Implicits.global
-import scala.language.postfixOps 
-
-lazy val f = Future {
-
-assert(CW7c.ordered_moves(8, List((3,4), (3,2)), (1, 3)) == List((0,1), (0,5), (2,1), (2,5)))
-assert(CW7c.ordered_moves(8, List((4,0)), (0,0)) == List((2,1), (1,2)))
-assert(CW7c.ordered_moves(8, List((0,4)), (0,0)) == List((1,2), (2,1)))
-
-}
-
-Await.result(f, 120 second)
--- a/testing3/testing3-bak/knight3b_test.scala	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-
-//import scala.concurrent._
-//import scala.concurrent.duration._
-//import ExecutionContext.Implicits.global
-//import scala.language.postfixOps 
-
-type Pos = (Int, Int)
-type Path = List[Pos]
-
-def add_pair_urban(x: Pos)(y: Pos): Pos = 
-  (x._1 + y._1, x._2 + y._2)
-
-def is_legal_urban(dim: Int, path: Path)(x: Pos): Boolean = 
-  0 <= x._1 && 0 <= x._2 && x._1 < dim && x._2 < dim && !path.contains(x)
-
-def moves_urban(x: Pos): List[Pos] = 
-  List(( 1,  2),( 2,  1),( 2, -1),( 1, -2),
-       (-1, -2),(-2, -1),(-2,  1),(-1,  2)).map(add_pair_urban(x))
-
-def legal_moves_urban(dim: Int, path: Path, x: Pos): List[Pos] = 
-  moves_urban(x).filter(is_legal_urban(dim, path))
-
-def correct_urban(dim: Int)(p: Path): Boolean = p match {
-  case Nil => true
-  case x::Nil => true
-  case x::y::p => 
-    if (legal_moves_urban(dim, p, y).contains(x)) correct_urban(dim)(y::p) else false
-}
-
-def correct_closed_urban(dim: Int)(p: Path) =
-  correct_urban(6)(p) &&  moves_urban(p.head).contains(p.last)
-
-//lazy val f = Future {
-
-  val tsc = CW7c.first_closed_tour_heuristic(6, List((3, 3))).get
-  assert(correct_closed_urban(6)(tsc) == true)
-
-//}
-
-//Await.result(f, 300 second)
--- a/testing3/testing3-bak/knight3c_test.scala	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-
-//import scala.concurrent._
-//import scala.concurrent.duration._
-//import ExecutionContext.Implicits.global
-//import scala.language.postfixOps 
-
-type Pos = (Int, Int)
-type Path = List[Pos]
-
-def add_pair_urban(x: Pos)(y: Pos): Pos = 
-  (x._1 + y._1, x._2 + y._2)
-
-def is_legal_urban(dim: Int, path: Path)(x: Pos): Boolean = 
-  0 <= x._1 && 0 <= x._2 && x._1 < dim && x._2 < dim && !path.contains(x)
-
-def moves_urban(x: Pos): List[Pos] = 
-  List(( 1,  2),( 2,  1),( 2, -1),( 1, -2),
-       (-1, -2),(-2, -1),(-2,  1),(-1,  2)).map(add_pair_urban(x))
-
-def legal_moves_urban(dim: Int, path: Path, x: Pos): List[Pos] = 
-  moves_urban(x).filter(is_legal_urban(dim, path))
-
-def correct_urban(dim: Int)(p: Path): Boolean = p match {
-  case Nil => true
-  case x::Nil => true
-  case x::y::p => 
-    if (legal_moves_urban(dim, p, y).contains(x)) correct_urban(dim)(y::p) else false
-}
-
-
-// !!!!!!! the futures need to be removed...otherwise funny results
-//lazy val f1 = Future {
-
-  val ts8 = CW7c.first_tour_heuristic(8, List((0,0))).get
-  assert(correct_urban(8)(ts8) == true)
-
-//}
-
-//Await.result(f1, 360 second)
-
-
-//lazy val f2 = Future {
-
-  val ts40 = CW7c.first_tour_heuristic(40, List((0,0))).get
-  assert(correct_urban(40)(ts40) == true)
-
-//}
-
-//Await.result(f2, 360 second)
--- a/testing3/testing3-bak/mark	Thu Oct 31 11:33:02 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#!/bin/bash
-###set -e
-
-trap "exit" INT
-
-./knight1_test.sh output1
-./knight3_test.sh output3
-
--- a/testing4/mark	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/mark	Thu Oct 31 12:01:56 2019 +0000
@@ -7,11 +7,10 @@
 
 cp $DIR/* .
 
-./re_test.sh output1
-#./bf_test.sh output2
+./postfix_test.sh tmp_output1
 
-echo -e "Here is an automated test report for your work so far on assignment 9.  Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Passing these tests does not guarantee your code is free from bugs: after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
+echo -e "Here is an automated test report for your work so far on assignment 9. Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Please ensure you test your code on your own machine in order to make sure it is bug free!! Passing these tests does not guarantee your code is free from bugs!! Also after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
 
 
-cat output1 >> $1
+cat tmp_output1 >> $1
 
--- a/testing4/mark2	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/mark2	Thu Oct 31 12:01:56 2019 +0000
@@ -7,10 +7,9 @@
 
 cp $DIR/* .
 
-./postfix_test.sh output1
-
-echo -e "Here is an automated test report for your work so far on assignment 9, Part 2.  Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Passing these tests does not guarantee your code is free from bugs: after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
+./re_test.sh tmp_output2
 
+echo -e "Here is an automated test report for your work so far on assignment 9. Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Please ensure you test your code on your own machine in order to make sure it is bug free!! Passing these tests does not guarantee your code is free from bugs!! Also after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
 
-cat output1 >> $1
+cat tmp_output2 >> $1
 
--- a/testing4/postfix.scala	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/postfix.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -2,7 +2,7 @@
 // by Edsger Dijkstra
 // ========================
 
-//object CW9b {
+object CW9a {
 
 type Toks = List[String]
 
@@ -98,6 +98,6 @@
 // compute(syard(split("5 * 7 / 2")))          // 17
 // compute(syard(split("9 + 24 / ( 7 - 3 )"))) // 15
 
-//}
+}
 
 
--- a/testing4/postfix2.scala	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/postfix2.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -2,7 +2,7 @@
 // including Associativity for Operators 
 // =====================================
 
-//object CW9c { // just for generating a jar file
+object CW9b { 
 
 // type of tokens
 type Toks = List[String]
@@ -97,4 +97,4 @@
 
 
 
-//}
+}
--- a/testing4/postfix_test.sh	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/postfix_test.sh	Thu Oct 31 12:01:56 2019 +0000
@@ -6,7 +6,7 @@
 
 echo -e "" > $out
 
-echo -e "Below is the feedback for your submission of CW 9, Part 2." >> $out
+echo -e "Below is the feedback for your submission of CW 9, Preliminary Part." >> $out
 echo -e "" >> $out
 
 
@@ -19,7 +19,7 @@
 # functional tests
 
 function scala_assert {
-  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null) 
+  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null) 
 }
 
 # purity test
@@ -35,7 +35,7 @@
 
 if (scala_vars postfix.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
@@ -97,7 +97,7 @@
   fi
 fi
 
-
+echo -e "" >> $out
 
 ### postfix2 tests
 
@@ -107,7 +107,7 @@
 
 if (scala_vars postfix2.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
--- a/testing4/postfix_test7.scala	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/postfix_test7.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -1,3 +1,5 @@
+import CW9a._
+
 
 assert(syard(split("3 + 4 * ( 2 - 1 )")) == List("3", "4", "2", "1", "-", "*", "+"))
 assert(syard(split("( ( ( 3 ) ) + ( ( 4 + ( 5 ) ) ) )")) == List("3", "4", "5", "+", "+"))
--- a/testing4/postfix_test8.scala	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/postfix_test8.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -1,3 +1,4 @@
+import CW9a._
 
 assert(compute(syard(split("3 + 4 * ( 2 - 1 )"))) == 7)
 assert(compute(syard(split("10 + 12 * 33"))) == 406)
--- a/testing4/postfix_test9.scala	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/postfix_test9.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -1,3 +1,5 @@
+import CW9b._
+
 
 assert(syard(split("3 + 4 * ( 2 - 1 )")) == List("3", "4", "2", "1", "-", "*", "+"))
 assert(syard(split("( ( ( 3 ) ) + ( ( 4 + ( 5 ) ) ) )")) == List("3", "4", "5", "+", "+"))
--- a/testing4/re.scala	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/re.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -1,7 +1,7 @@
-// Part 1 about Regular Expression Matching
-//==========================================
+// Core Part about Regular Expression Matching
+//=============================================
 
-//object CW9a {
+object CW9c {
 
 // Regular Expressions
 abstract class Rexp
@@ -125,23 +125,23 @@
 
 
 // some testing data
-/*
-matcher(("a" ~ "b") ~ "c", "abc")  // => true
-matcher(("a" ~ "b") ~ "c", "ab")   // => false
+
+//matcher(("a" ~ "b") ~ "c", "abc")  // => true
+//matcher(("a" ~ "b") ~ "c", "ab")   // => false
 
 // the supposedly 'evil' regular expression (a*)* b
 val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
 
-matcher(EVIL, "a" * 1000 ++ "b")   // => true
-matcher(EVIL, "a" * 1000)          // => false
+//matcher(EVIL, "a" * 1000 ++ "b")   // => true
+//matcher(EVIL, "a" * 1000)          // => false
 
 // size without simplifications
-size(der('a', der('a', EVIL)))             // => 28
-size(der('a', der('a', der('a', EVIL))))   // => 58
+//size(der('a', der('a', EVIL)))             // => 28
+//size(der('a', der('a', der('a', EVIL))))   // => 58
 
 // size with simplification
-size(simp(der('a', der('a', EVIL))))           // => 8
-size(simp(der('a', der('a', der('a', EVIL))))) // => 8
+//size(simp(der('a', der('a', EVIL))))           // => 8
+//size(simp(der('a', der('a', der('a', EVIL))))) // => 8
 
 // Python needs around 30 seconds for matching 28 a's with EVIL. 
 // Java 9 and later increase this to an "astonishing" 40000 a's in
@@ -158,12 +158,12 @@
   (end - start)/(i * 1.0e9)
 }
 
-for (i <- 0 to 5000000 by 500000) {
-  println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL, "a" * i))))
-}
+//for (i <- 0 to 5000000 by 500000) {
+//  println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL, "a" * i))) + " secs.") 
+//}
 
 // another "power" test case 
-simp(Iterator.iterate(ONE:Rexp)(r => SEQ(r, ONE | ONE)).drop(100).next) == ONE
+//simp(Iterator.iterate(ONE:Rexp)(r => SEQ(r, ONE | ONE)).drop(100).next) == ONE
 
 // the Iterator produces the rexp
 //
@@ -171,6 +171,6 @@
 //
 //    where SEQ is nested 100 times.
  
-*/
+
 
-//}
+}
--- a/testing4/re_test.sh	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/re_test.sh	Thu Oct 31 12:01:56 2019 +0000
@@ -6,7 +6,7 @@
 
 echo -e "" > $out
 
-echo -e "Below is the feedback for your submission of CW 9, Part 1." >> $out
+echo -e "Below is the feedback for your submission of CW 9, Core Part." >> $out
 echo -e "" >> $out
 
 
@@ -19,7 +19,7 @@
 # functional tests
 
 function scala_assert {
-  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null) 
+  (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null) 
 }
 
 # purity test
@@ -35,7 +35,7 @@
 
 if (scala_vars re.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
--- a/testing4/re_test1.scala	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/re_test1.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -1,6 +1,5 @@
-
+import CW9c._
 
- 
 assert(nullable(ZERO) == false)
 assert(nullable(ONE) == true)
 assert(nullable(CHAR('a')) == false)
@@ -10,15 +9,3 @@
 assert(nullable(ONE ~ CHAR('a')) == false)
 assert(nullable(STAR(ZERO)) == true)
 
-
-
-//import scala.concurrent._
-//import scala.concurrent.duration._
-//import ExecutionContext.Implicits.global
-//import scala.language.postfixOps 
-//import scala.language.reflectiveCalls
-
-//lazy val f = Future {
-
-//}
-//Await.result(f,30 second)
--- a/testing4/re_test2.scala	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/re_test2.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -1,6 +1,25 @@
-
+import CW9c._
 
 assert(der('a', ZERO | ONE) == (ZERO | ZERO))
 assert(der('a', (CHAR('a') | ONE) ~ CHAR('a')) == ALT((ONE | ZERO) ~ CHAR('a'), ONE))
+assert(der('a', (CHAR('a') | CHAR('a')) ~ CHAR('a')) == (ONE | ONE) ~ CHAR('a'))
 assert(der('a', STAR(CHAR('a'))) == (ONE ~ STAR(CHAR('a'))))
 assert(der('b', STAR(CHAR('a'))) == (ZERO ~ STAR(CHAR('a'))))
+
+
+val r0_urban = "a" ~ "b" ~ "c"
+assert(der('a', r0_urban) == (ONE ~ "b") ~ "c")
+assert(der('b', r0_urban) == (ZERO ~ "b") ~ "c")
+assert(der('c', r0_urban) == (ZERO ~ "b") ~ "c")
+
+val r1_urban = (ONE ~ "b") ~ "c"
+
+assert(der('a', r1_urban) == ((ZERO ~ "b") | ZERO) ~ "c")
+assert(der('b', r1_urban) == ((ZERO ~ "b") | ONE) ~ "c")
+assert(der('c', r1_urban) == ((ZERO ~ "b") | ZERO) ~ "c")
+
+val r2_urban = ((ZERO ~ "b") | ONE) ~ "c"
+
+assert(der('a', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | ZERO))
+assert(der('b', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | ZERO))
+assert(der('c', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | ONE))
--- a/testing4/re_test3.scala	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/re_test3.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -1,13 +1,21 @@
-
+import CW9c._
 
 
 assert(simp(ZERO | ONE) == ONE)
 assert(simp(STAR(ZERO | ONE)) == STAR(ZERO | ONE))
 assert(simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a'))
+assert(simp(((ONE ~ ONE) ~ ONE) ~ CHAR('a')) == CHAR('a'))
+assert(simp(((ONE | ONE) ~ ONE) ~ CHAR('a')) == CHAR('a'))
 assert(simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO)
 assert(simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a'))
 assert(simp(CHAR('a') | CHAR('a')) == CHAR('a'))
+assert(simp(CHAR('a') ~ CHAR('a')) == CHAR('a') ~ CHAR('a'))
 assert(simp(ONE | CHAR('a')) == (ONE | CHAR('a')))
 assert(simp(ALT((CHAR('a') | ZERO) ~ ONE,
-               ((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a'))
+                  ((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a'))
+assert(simp((ZERO | ((ZERO | ZERO) | (ZERO | ZERO))) ~ ((ONE | ZERO) | ONE ) ~ (CHAR('a'))) == ZERO)
+assert(simp(ALT(ONE | ONE, ONE | ONE)) == ONE)
+assert(simp(ALT(ZERO | CHAR('a'), CHAR('a') | ZERO)) == CHAR('a'))
+assert(simp(ALT(ONE | CHAR('a'), CHAR('a') | ONE)) == ALT(ONE | CHAR('a'), CHAR('a') | ONE))
 
+
--- a/testing4/re_test4.scala	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/re_test4.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -1,27 +1,19 @@
+import CW9c._
 
 val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
 
-//println("1")
-assert(ders("aaaaa".toList, EVIL_urban) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b')))
-//println("2")
+assert(ders(("a" * 5).toList, EVIL_urban) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b')))
 assert(ders(List('b'), EVIL_urban) == ONE)
-//println("3")
-assert(ders("bb".toList, EVIL_urban) == ZERO)
-//println("4")
+assert(ders(List('b','b'), EVIL_urban) == ZERO)
 assert(matcher(EVIL_urban, "a" * 5 ++ "b") == true)
-//println("5")
+assert(matcher(EVIL_urban, "a" * 50 ++ "b") == true)
+assert(matcher(EVIL_urban, "a" * 50) == false)
 assert(matcher(EVIL_urban, "b") == true)
-//println("6") 
 assert(matcher(EVIL_urban, "bb") == false)
-//println("7")
 assert(matcher("abc", "abc") == true)
-//println("8")
+assert(matcher("abc", "ab") == false)
 assert(matcher(("ab" | "a") ~ (ONE | "bc"), "abc") == true)
-//println("9")
 assert(matcher(ONE, "") == true)
-//println("10")
 assert(matcher(ZERO, "") == false)
-//println("11")
 assert(matcher(ONE | CHAR('a'), "") == true)
-//println("12")
 assert(matcher(ONE | CHAR('a'), "a") == true)
--- a/testing4/re_test5.scala	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing4/re_test5.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -1,7 +1,8 @@
-
+import CW9c._ 
 val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
 
 assert(size(der('a', der('a', EVIL_urban))) == 28)
 assert(size(der('a', der('a', der('a', EVIL_urban)))) == 58)
 
 assert(size(ders("aaaaaa".toList, EVIL_urban)) == 8)
+assert(size(ders(("a" * 50).toList, EVIL_urban)) == 8)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testing4/re_test6.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -0,0 +1,9 @@
+import CW9c._
+
+val EVIL_urban = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
+
+
+assert(simp(Iterator.iterate(ONE:Rexp)(r => SEQ(r, ONE | ONE)).drop(50).next) == ONE)
+assert(simp(Iterator.iterate(ONE:Rexp)(r => ALT(r, r)).drop(20).next) == ONE)
+assert(matcher(EVIL_urban, "a" * 1000000) == false)
+assert(matcher(EVIL_urban, "a" * 1000000 ++ "b") == true)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testing5/bf_test5.scala	Thu Oct 31 12:01:56 2019 +0000
@@ -0,0 +1,5 @@
+import CW10b._
+
+assert(jtable("""+++++[->++++++++++<]>--<+++[->>++++++++++<<]>>++<<----------[+>.>.<+<]""") ==
+          Map(69 -> 61, 5 -> 20, 60 -> 70, 27 -> 44, 43 -> 28, 19 -> 6))
+
--- a/testing5/mark	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing5/mark	Thu Oct 31 12:01:56 2019 +0000
@@ -7,10 +7,10 @@
 
 cp $DIR/* .
 
-./bf_test.sh output1
+./bf_test.sh tmp_output1
 
-echo -e "Here is an automated test report for your work so far on assignment 10.  Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Passing these tests does not guarantee your code is free from bugs: after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
+echo -e "Here is an automated test report for your work so far on assignment 10.  Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Please ensure you test your code on your own machine in order to make sure it is bug free!! Passing these tests does not guarantee your code is free from bugs!! Also after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
 
 
-cat output1 >> $1
+cat tmp_output1 >> $1
 
--- a/testing5/mark2	Thu Oct 31 11:33:02 2019 +0000
+++ b/testing5/mark2	Thu Oct 31 12:01:56 2019 +0000
@@ -7,10 +7,10 @@
 
 cp $DIR/* .
 
-./bf_test2.sh output1
+./bfc_test.sh tmp_output2
 
-echo -e "Here is an automated test report for your work so far on the advanced part of assignment 10.  Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Passing these tests does not guarantee your code is free from bugs: after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
+echo -e "Here is an automated test report for your work so far on assignment 10.  Please note that this is not the mark for your work; it is provided only in the hope that it is useful in developing your solution.  Please ensure you test your code on your own machine in order to make sure it is bug free!! Passing these tests does not guarantee your code is free from bugs!! Also after the deadline, your code will be marked against a different, more thorough set of test cases.\n\n" > $1
 
 
-cat output1 >> $1
+cat tmp_output2 >> $1