<div>Hi getting there with nimprogram well have it working in different areas.</div>
<div> </div>
<div>The last part is where the most trouble is</div>
<div>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">import Control.Monad </font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">import System.Random </font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"> </font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">initNim :: IO [Int]</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">initNim = replicateM 3 $ randomRIO (1,10)--- This get the random numbers</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"> </font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"> </font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">data PileName = A | B | C deriving (Show, Eq, Read)</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"> </font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">typeOfMove :: (PileName, Int) -> [Int] -> [Int]</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">typeOfMove (A, x) xs = zipWith (-) xs [x,0,0]</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">typeOfMove (B, x) xs = zipWith (-) xs [0,x,0]</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">typeOfMove (C, x) xs = zipWith (-) xs [0,0,x]</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"> </font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">main :: IO ()</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">main = do</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>putStrLn "Which pile A, B, or C ?"</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>x <- readLn</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>putStrLn "How many stones?"</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>y <- readLn</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span><span style="mso-spacerun: yes"> </span>let z = typeOfMove (x,y) [9,9,9]-- cannot get the random numbers here</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>putStrLn . show $ z</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"> </font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"> </font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"> <u><font style="BACKGROUND-COLOR: #ffff00">This is where the main problem is I 'm trying to run the game?</font></u></font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">play nim = do</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>z <- getLine</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>newAnswer <- return (diff z)</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">if newAnswer == [0,0,1]||[0,1,0]||[1,0,0]</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>then putStrn "You win"</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"><span style="mso-spacerun: yes"> </span>else play nim newAnswer</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"> </font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">diff z ws hs =[ if z==w then w else h]-- trying to return different list here</font></span></p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"></font></span> </p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman"></font></span> </p>
<p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span style="FONT-SIZE: 14pt"><font face="Times New Roman">John</font></span></p></div>