module Main where import Data.Char import Board import Data.List import Pieces import Rules main :: IO () main = do print "hoe heet uw .chb bestand?(dus zonder.chb)" a <- getLine -- lees het bestand uit en parse het. e <- readFile (a ++ ".chb") gameloop (parse e ::Situation) gameloop :: Situation -> IO() gameloop situation@(Sit board color) = do -- Laat de huidige status van het bord zien. putStr( show situation) -- dit kijkt welke kleur aan zet is. if color== White then print "Voer uw zet in Wit!" else print " Zwart u bent aan zet wat is uw keuze? " --haalt de invoer op x<- getLine --hier word de move allowed functie aangeroepen deze kijkt dan of je een zet mag doen. if (moveAllowed situation (parseInput x)) then print "zet word verwerkt!" -- mag je de zet niet doen roep dan de gameloop aan zonder veranderingen. else do print "Move invalling try agian!" gameloop situation -- Kijk of de speler verloren heeft. if hasLost(preformMove situation (parseInput x )) then do print ("het spel is afgelopen. " ++ if color== White then " Wit!" else " Zwart" ++ "heeft gewonnnen. De cyclus word opnieuw gestart! ") main -- heeft er niemand verloren voer dan de zet uit else do gameloop (preformMove situation (parseInput x ))