/tp-1/informe_tp1/ej8.tex
LaTeX | 20 lines | 17 code | 3 blank | 0 comment | 0 complexity | c15541443921fea4f30c45afa9cdc923 MD5 | raw file
1\section{Ejercicio 8: \textit{ganador}} 2\subsection{Enunciado} 3Definir la funci\'on 4\texttt{ 5\\ganador :: Juego $\to$ Maybe Color 6} 7\\que devuelva Just c si el color c es el ganador del partido y Nothing si todav\'ia no se defini\'o un 8ganador. Recordar que, si le toca el turno a un jugador que no puede mover ninguna ficha, 9ese jugador pierde. 10\subsection{Codigo} 11 12\scriptsize\begin{verbatim} 13 14ganador :: Juego -> Maybe Color 15ganador (J c t) | (length (movimientosPosibles (J c t)) == 0) = Just (invertirColor c) 16 | (length (fichas t (invertirColor c)) == 0) = Just c 17 | otherwise = Nothing 18 19\end{verbatim} 20\normalsize