equal
deleted
inserted
replaced
30 automated feedback. In the end we take a snapshot of the submitted files and |
30 automated feedback. In the end we take a snapshot of the submitted files and |
31 apply an automated marking script to them.\medskip |
31 apply an automated marking script to them.\medskip |
32 |
32 |
33 \noindent |
33 \noindent |
34 In addition, the Scala coursework comes with a reference implementation |
34 In addition, the Scala coursework comes with a reference implementation |
35 in form of \texttt{jar}-files. This allows you to run any test cases on |
35 in form of a \texttt{jar}-file. This allows you to run any test cases on |
36 your own computer. For example you can call scala-cli on the command line |
36 your own computer. For example you can call \texttt{scala-cli} on the command line |
37 with the option \texttt{--extra-jars collatz.jar} and then query any function |
37 with the option \texttt{--extra-jars collatz.jar} and then query any function |
38 from the template file. Say you want to find out what the functions |
38 from the template file. Say you want to find out what the functions |
39 \texttt{collatz} and \texttt{collatz\_max} produce: for this you just |
39 \texttt{collatz} and \texttt{collatz\_max} produce: for this you just |
40 need to prefix them with the object name \texttt{C1}. If you want to |
40 need to prefix them with the object name \texttt{C1}. If you want to |
41 find out what these functions produce for the argument \texttt{6}, you |
41 find out what these functions produce for the argument \texttt{6}, you |
65 \subsection*{Core Part 1 (3 Marks, file collatz.scala)} |
65 \subsection*{Core Part 1 (3 Marks, file collatz.scala)} |
66 |
66 |
67 This part is about function definitions and recursion. You are asked |
67 This part is about function definitions and recursion. You are asked |
68 to implement a Scala program that tests examples of the |
68 to implement a Scala program that tests examples of the |
69 \emph{$3n + 1$-conjecture}, also called \emph{Collatz |
69 \emph{$3n + 1$-conjecture}, also called \emph{Collatz |
70 conjecture}.\video{https://www.youtube.com./watch?v=LqKpkdRRLZw} |
70 conjecture}.\video{https://www.youtube.com/watch?v=LqKpkdRRLZw} |
71 This conjecture can be described as follows: Start with any positive |
71 This conjecture can be described as follows: Start with any positive |
72 number $n$ greater than $0$: |
72 number $n$ greater than $0$: |
73 |
73 |
74 \begin{itemize} |
74 \begin{itemize} |
75 \item If $n$ is even, divide it by $2$ to obtain $n / 2$. |
75 \item If $n$ is even, divide it by $2$ to obtain $n / 2$. |