320 is introduced. A \texttt{Move} encodes all simple moves (up, down, left, |
320 is introduced. A \texttt{Move} encodes all simple moves (up, down, left, |
321 right) and L-shape moves (first right, then up and so on). This is defined |
321 right) and L-shape moves (first right, then up and so on). This is defined |
322 as follows: |
322 as follows: |
323 |
323 |
324 {\small\begin{lstlisting} |
324 {\small\begin{lstlisting} |
325 abstract class Move |
325 enum Move { |
326 case object U extends Move // up |
326 case U // up |
327 case object D extends Move // down |
327 case D // down |
328 case object R extends Move // right |
328 case R // right |
329 case object L extends Move // left |
329 case L // left |
330 case object RU extends Move // ... |
330 case RU // ... |
331 case object LU extends Move |
331 case LU |
332 case object RD extends Move |
332 case RD |
333 case object LD extends Move |
333 case LD |
334 case object UR extends Move |
334 case UR |
335 case object UL extends Move |
335 case UL |
336 case object DR extends Move |
336 case DR |
337 case object DL extends Move |
337 case DL |
|
338 } |
338 \end{lstlisting}} |
339 \end{lstlisting}} |
339 |
340 |
340 You need to implement an \texttt{eval} function that takes a piece |
341 You need to implement an \texttt{eval} function that takes a piece |
341 \texttt{pc}, a move \texttt{m}, an energy \texttt{en} and a board |
342 \texttt{pc}, a move \texttt{m}, an energy \texttt{en} and a board |
342 \texttt{b} as arguments. The idea is to recursively calculate all |
343 \texttt{b} as arguments. The idea is to recursively calculate all |