updated
authorChristian Urban <urbanc@in.tum.de>
Tue, 22 Jan 2019 12:53:05 +0000
changeset 258 ebe71908b13e
parent 257 ba4d976ca88d
child 259 43995ea34fe7
updated
TAs
cws/cw03.pdf
marking3/knight1.scala
marking3/knight2.scala
marking3/knight3.scala
marking3/knight3_test.sh
marking3/knight_test6.scala
marking3/knight_test7.scala
marking3/knight_test8.scala
marking3/knight_test9.scala
marking3/mk-advanced
marking3/output
marking4/postfix_test.sh
--- a/TAs	Mon Jan 21 16:04:30 2019 +0000
+++ b/TAs	Tue Jan 22 12:53:05 2019 +0000
@@ -66,6 +66,17 @@
 231 submissions
 
 
+CW9, Part2
+
+156  => 4 
+1    => 3
+17   => 2
+9    => 1
+59   => 0
+--------
+247 submissions
+
+
 CW10, Part 1
                late (231)
 194  => 6       195
Binary file cws/cw03.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/marking3/knight1.scala	Tue Jan 22 12:53:05 2019 +0000
@@ -0,0 +1,170 @@
+// Part 1 about finding and counting Knight's tours
+//==================================================
+
+//object CW8a {   // for preparing the jar
+
+type Pos = (Int, Int)    // a position on a chessboard 
+type Path = List[Pos]    // a path...a list of positions
+
+
+// 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
+}
+
+// for printing a board
+def print_board(dim: Int, path: Path): Unit = {
+  println
+  for (i <- 0 until dim) {
+    for (j <- 0 until dim) {
+      print(f"${path.reverse.indexOf((j, dim - i - 1))}%3.0f ")
+    }
+    println
+  } 
+}
+
+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)
+
+// testcases
+//assert(is_legal(8, Nil, (3, 4)) == true)
+//assert(is_legal(8, List((4, 1), (1, 0)), (4, 1)) == false)
+//assert(is_legal(2, Nil, (0, 0)) == true)
+
+
+def add_pair(x: Pos, y: Pos): Pos = 
+  (x._1 + y._1, x._2 + y._2)
+
+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, _))
+
+// 1 mark
+
+def legal_moves(dim: Int, path: Path, x: Pos): List[Pos] = 
+  moves(x).filter(is_legal(dim, path, _))
+
+// testcases
+//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)))
+//assert(legal_moves(1, Nil, (0,0)) == List())
+//assert(legal_moves(2, Nil, (0,0)) == List())
+//assert(legal_moves(3, Nil, (0,0)) == List((1,2), (2,1)))
+
+// 2 marks
+
+def tcount_tours(dim: Int, path: Path): Int = {
+  if (path.length == dim * dim) 1
+  else 
+    (for (x <- legal_moves(dim, path, path.head)) yield tcount_tours(dim, x::path)).sum
+}
+
+def count_tours(dim: Int, path: Path) =
+  time_needed(tcount_tours(dim: Int, path: Path))
+
+
+def tenum_tours(dim: Int, path: Path): List[Path] = {
+  if (path.length == dim * dim) List(path)
+  else 
+    (for (x <- legal_moves(dim, path, path.head)) yield tenum_tours(dim, x::path)).flatten
+}
+
+def enum_tours(dim: Int, path: Path) =
+  time_needed(tenum_tours(dim: Int, path: Path))
+
+// test cases
+
+/*
+def count_all_tours(dim: Int) = {
+  for (i <- (0 until dim).toList; 
+       j <- (0 until dim).toList) yield count_tours(dim, List((i, j)))
+}
+
+def enum_all_tours(dim: Int): List[Path] = {
+  (for (i <- (0 until dim).toList; 
+        j <- (0 until dim).toList) yield enum_tours(dim, List((i, j)))).flatten
+}
+
+
+println("Number of tours starting from (0, 0)")
+
+for (dim <- 1 to 5) {
+  println(s"${dim} x ${dim} " + time_needed(0, count_tours(dim, List((0, 0)))))
+}
+
+println("Number of tours starting from all fields")
+
+for (dim <- 1 to 5) {
+  println(s"${dim} x ${dim} " + time_needed(0, count_all_tours(dim)))
+}
+
+for (dim <- 1 to 5) {
+  val ts = enum_tours(dim, List((0, 0)))
+  println(s"${dim} x ${dim} ")   
+  if (ts != Nil) {
+    print_board(dim, ts.head)
+    println(ts.head)
+  }
+}
+*/
+
+// 1 mark
+
+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)
+  }
+}
+
+// test cases
+//def foo(x: (Int, Int)) = if (x._1 > 3) Some(List(x)) else None
+//
+//first(List((1, 0),(2, 0),(3, 0),(4, 0)), foo)
+//first(List((1, 0),(2, 0),(3, 0)), foo)
+
+
+// 1 mark
+
+def tfirst_tour(dim: Int, path: Path): Option[Path] = {
+  if (path.length == dim * dim) Some(path)
+  else
+    first(legal_moves(dim, path, path.head), (x:Pos) => tfirst_tour(dim, x::path))
+}
+
+def first_tour(dim: Int, path: Path) = 
+  time_needed(tfirst_tour(dim: Int, path: Path))
+
+
+/*
+for (dim <- 1 to 8) {
+  val t = first_tour(dim, List((0, 0)))
+  println(s"${dim} x ${dim} " + (if (t == None) "" else { print_board(dim, t.get) ; "" }))
+}
+*/
+
+// 15 secs for 8 x 8
+//val ts1 = time_needed(0,first_tour(8, List((0, 0))).get)
+
+// no result for 4 x 4
+//val ts2 = time_needed(0, first_tour(4, List((0, 0))))
+
+// 0.3 secs for 6 x 6
+//val ts3 = time_needed(0, first_tour(6, List((0, 0))))
+
+// 15 secs for 8 x 8
+//time_needed(0, print_board(8, first_tour(8, List((0, 0))).get))
+
+
+//}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/marking3/knight2.scala	Tue Jan 22 12:53:05 2019 +0000
@@ -0,0 +1,94 @@
+// Part 3 about finding a single tour using the Warnsdorf Rule
+//=============================================================
+
+//object CW8b { // 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 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)
+  }
+}
+
+
+def tfirst_closed_tour_heuristics(dim: Int, path: Path): Option[Path] = {
+  if (path.length == dim * dim && moves(path.head).contains(path.last)) Some(path)
+  else
+    first(ordered_moves(dim, path, path.head), (x: Pos) => tfirst_closed_tour_heuristics(dim, x::path))
+}
+
+def first_closed_tour_heuristics(dim: Int, path: Path) =
+ time_needed(tfirst_closed_tour_heuristics(dim: Int, path: Path))
+
+def first_closed_tour_heuristic(dim: Int, path: Path) =
+ time_needed(tfirst_closed_tour_heuristics(dim: Int, path: Path))
+
+
+// heuristic cannot be used to search for closed tours on 7 x 7 an beyond
+//for (dim <- 1 to 6) {
+//  val t = time_needed(0, first_closed_tour_heuristics(dim, List((dim / 2, dim / 2))))
+//  println(s"${dim} x ${dim} closed: " + (if (t == None) "" else { print_board(dim, t.get) ; "" }))
+//}
+
+
+def tfirst_tour_heuristics(dim: Int, path: Path): Option[Path] = {
+  if (path.length == dim * dim) Some(path)
+  else
+    first(ordered_moves(dim, path, path.head), (x: Pos) => tfirst_tour_heuristics(dim, x::path))
+}
+
+
+def first_tour_heuristics(dim: Int, path: Path) = 
+  time_needed(tfirst_tour_heuristics(dim: Int, path: Path))
+
+def first_tour_heuristic(dim: Int, path: Path) = 
+  time_needed(tfirst_tour_heuristics(dim: Int, path: Path))
+
+// will be called with boards up to 30 x 30
+
+
+//}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/marking3/knight3.scala	Tue Jan 22 12:53:05 2019 +0000
@@ -0,0 +1,63 @@
+// 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/marking3/knight3_test.sh	Mon Jan 21 16:04:30 2019 +0000
+++ b/marking3/knight3_test.sh	Tue Jan 22 12:53:05 2019 +0000
@@ -9,26 +9,33 @@
 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 "for assignment 8 Advanced 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 for CW8 part 2
 marks=$(( 0 ))
 
 # compilation tests
 
 function scala_compile {
-    (ulimit -t 360; JAVA_OPTS="-Xmx1g" scala "$1" 2> /dev/null 1> /dev/null)
+    (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc "$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)
+    (ulimit -t 30; JAVA_OPTS="-Xmx4g -Xss200m" scala -nc -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
 }
 
+function scala_assert_long {
+  (ulimit -t 60; JAVA_OPTS="-Xmx1g" scala -nc -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
+}
+
+function scala_assert_elong {
+  (ulimit -t 90; JAVA_OPTS="-Xmx1g" scala -nc -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null)
+}
 
 # purity test
 
@@ -37,12 +44,12 @@
 }
 
 
-# knights3: purity test
+# knights2: purity test
 #
-echo "knight3.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
+echo "knight2.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
 
 
-if (scala_vars knight3.scala)
+if (scala_vars knight2.scala)
 then
   echo "  --> test failed" | tee -a $out
   tsts0=$(( 1 ))
@@ -55,14 +62,14 @@
 # compilation test
 if  [ $tsts0 -eq 0 ]
 then    
-  echo "knight3.scala runs?" | tee -a $out
+  echo "knight2.scala runs?" | tee -a $out
 
-  if (scala_compile knight3.scala)
+  if (scala_compile knight2.scala)
   then
     echo "  --> success" | tee -a $out
     tsts1=$(( 0 ))
   else
-    echo "  --> scala knight3.scala did not run successfully" | tee -a $out
+    echo "  --> scala knight2.scala did not run successfully" | tee -a $out
     tsts1=$(( 1 )) 
   fi
 else
@@ -77,7 +84,7 @@
   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")
+  if (scala_assert "knight2.scala" "knight_test6.scala")
   then
       echo "  --> success" | tee -a $out
       marks=$(( marks + 1 ))
@@ -93,7 +100,7 @@
 then
   echo " first_closed_tour_heuristic(6, List((3,3))) found and correct?" | tee -a $out
   
-  if (scala_assert "knight3.scala" "knight3b_test.scala")
+  if (scala_assert "knight2.scala" "knight_test7.scala")
   then
       echo "  --> success" | tee -a $out
       marks=$(( marks + 1 ))
@@ -109,7 +116,7 @@
   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")
+  if (scala_assert "knight2.scala" "knight_test8.scala")
   then
       echo "  --> success" | tee -a $out
       marks=$(( marks + 1 ))
@@ -119,6 +126,53 @@
 fi
 
 
+
+# knights3: purity test
+#
+echo -e "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=$(( 0 ))
+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 -e "  --> test failed" | tee -a $out  
+    tsts1=$(( 1 )) 
+  fi
+else
+  tsts1=$(( 1 ))     
+fi
+
+
+if [ $tsts1 -eq 0 ]
+then
+  echo -e " tour_on_mega_board(70, List((0,0))) found and correct?" | tee -a $out
+  
+  if (scala_assert_long "knight3.scala" "knight_test9.scala")
+  then
+      echo -e "  --> success" | tee -a $out
+      marks=$(( marks + 1 ))
+  else
+      echo -e "  --> test  failed" | tee -a $out 
+  fi
+fi
+
+
 ## final marks
-echo "Overall mark for CW 7, Part 2" | tee -a $out
+echo "Overall mark for CW 8, Part 2" | tee -a $out
 echo "$marks" | tee -a $out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/marking3/knight_test6.scala	Tue Jan 22 12:53:05 2019 +0000
@@ -0,0 +1,19 @@
+
+
+assert(ordered_moves(8, List((3,4), (3,2)), (1, 3)) == List((0,1), (0,5), (2,1), (2,5)))
+assert(ordered_moves(8, List((4,0)), (0,0)) == List((2,1), (1,2)))
+assert(ordered_moves(8, List((0,4)), (0,0)) == List((1,2), (2,1)))
+
+
+
+/*
+import scala.concurrent._
+import scala.concurrent.duration._
+import ExecutionContext.Implicits.global
+import scala.language.postfixOps 
+
+lazy val f = Future {
+}
+
+Await.result(f, 120 second)
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/marking3/knight_test7.scala	Tue Jan 22 12:53:05 2019 +0000
@@ -0,0 +1,31 @@
+
+//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)
+
+
+val tsc = first_closed_tour_heuristic(6, List((3, 3))).get
+assert(correct_closed_urban(6)(tsc) == true)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/marking3/knight_test8.scala	Tue Jan 22 12:53:05 2019 +0000
@@ -0,0 +1,31 @@
+
+//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
+}
+
+
+val ts8 = first_tour_heuristic(8, List((0,0))).get
+assert(correct_urban(8)(ts8) == true)
+
+val ts30 = first_tour_heuristic(30, List((0,0))).get
+assert(correct_urban(30)(ts30) == true)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/marking3/knight_test9.scala	Tue Jan 22 12:53:05 2019 +0000
@@ -0,0 +1,28 @@
+
+//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
+}
+
+
+val ts70 = tour_on_mega_board(70, List((0,0))).get
+assert(correct_urban(70)(ts70) == true)
+
--- a/marking3/mk-advanced	Mon Jan 21 16:04:30 2019 +0000
+++ b/marking3/mk-advanced	Tue Jan 22 12:53:05 2019 +0000
@@ -3,21 +3,23 @@
 
 trap "exit" INT
 
-files=${1:-assignment20177-*}
+files=${1:-assignment20188-*}
 
 for sd in $files; do
   cd $sd
   echo $sd
   touch .
-  cp ../../../marking2/knight3_test.sh .
-  cp ../../../marking2/knight3a_test.scala .
-  cp ../../../marking2/knight3b_test.scala .
-  cp ../../../marking2/knight3c_test.scala .
+  cp ../../../marking3/knight3_test.sh .
+  cp ../../../marking3/knight_test6.scala .
+  cp ../../../marking3/knight_test7.scala .
+  cp ../../../marking3/knight_test8.scala .
+  cp ../../../marking3/knight_test9.scala .
   ./knight3_test.sh output
   rm knight3_test.sh
-  rm knight3a_test.scala
-  rm knight3b_test.scala
-  rm knight3c_test.scala
+  rm knight_test6.scala
+  rm knight_test7.scala
+  rm knight_test8.scala
+  rm knight_test9.scala
   cd ..
 done
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/marking3/output	Tue Jan 22 12:53:05 2019 +0000
@@ -0,0 +1,27 @@
+
+Below is the feedback and provisional marks for your submission
+for assignment 8 Advanced Part 2.  Please note all marks are provisional until
+ratified by the assessment board -- this is not an official
+results transcript.
+
+knight2.scala does not contain vars, returns, Arrays, ListBuffers etc?
+  --> success
+knight2.scala runs?
+  --> success
+ ordered_moves(8, List((3,4), (3,2)), (1,3)) == List((0,1), (0,5), (2,1), (2,5))
+ ordered_moves(8, List((4,0)), (0,0)) == List((2,1), (1,2))
+ ordered_moves(8, List((0,4)), (0,0)) == List((1,2), (2,1))
+  --> success
+ first_closed_tour_heuristic(6, List((3,3))) found and correct?
+  --> success
+ first_tour_heuristic(8, List((0,0))) found and correct?
+ first_tour_heuristic(40, List((0,0))) found and correct?
+  --> success
+knight3.scala does not contain vars, returns, Arrays, ListBuffers etc?
+  --> success
+knight3.scala runs?
+  --> success
+ tour_on_mega_board(70, List((0,0))) found and correct?
+  --> success
+Overall mark for CW 8, Part 2
+4
--- a/marking4/postfix_test.sh	Mon Jan 21 16:04:30 2019 +0000
+++ b/marking4/postfix_test.sh	Tue Jan 22 12:53:05 2019 +0000
@@ -54,7 +54,7 @@
 then    
   echo "postfix.scala runs?" | tee -a $out
 
-  if (scala_compile re.scala)
+  if (scala_compile postfix.scala)
   then
     echo "  --> success" | tee -a $out
     tsts1=$(( 0 ))
@@ -111,8 +111,6 @@
 
 # var, return, ListBuffer test
 #
-# var, return, ListBuffer test
-#
 echo -e "postfix2.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
 
 if (scala_vars postfix2.scala)
@@ -132,7 +130,7 @@
 then    
   echo "postfix2.scala runs?" | tee -a $out
 
-  if (scala_compile re.scala)
+  if (scala_compile postfix2.scala)
   then
     echo "  --> success" | tee -a $out
     tsts1=$(( 0 ))