diff -r 85f2f75abeeb -r 2d57b0d43a0f cws/cw02.tex --- a/cws/cw02.tex Wed Nov 30 10:07:05 2016 +0000 +++ b/cws/cw02.tex Thu Dec 01 17:08:02 2016 +0000 @@ -20,9 +20,10 @@ backtracking. The first part is due on 23 November at 11pm; the second, more advanced part, is due on 30 November at 11pm. You are asked to implement Scala programs that solve various versions of the -\textit{Knight's Tour Problem} on a chessboard. Make sure the files -you submit can be processed by just calling \texttt{scala - <>}.\bigskip +\textit{Knight's Tour Problem} on a chessboard. Note the second part +might include material you have not yet seen in the first two +lectures. Make sure the files you submit can be processed by just +calling \texttt{scala <>}.\bigskip \noindent \textbf{Important:} Do not use any mutable data structures in your @@ -260,12 +261,17 @@ \] \noindent That is, we want to find the first position where the - result of $f$ is not \texttt{None}, if there is one.\mbox{}\hfill[1 Mark] + result of $f$ is not \texttt{None}, if there is one. Note that you + do not (need to) know anything about the function $f$ except its + type, namely \texttt{Pos => Option[Path]}. There is one additional + point however you should take into account when implementing + \textit{first}: you will need to calculate what the result of $f(x)$ + is; your code should do this only \textbf{once}!\\\mbox{}\hfill[1 Mark] \item[(2b)] Implement a first-tour function that uses the first-function from (2a), and searches recursively for an open tour. As there might not be such a tour at all, the first-tour function - needs to return an \texttt{Option[Path]}.\hfill[2 Marks] + needs to return an \texttt{Option[Path]}.\\\mbox{}\hfill[2 Marks] \end{itemize} \noindent