-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuestMain.hs
37 lines (34 loc) · 908 Bytes
/
QuestMain.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module Main where
import Types
import Objects
import Locations
import GameAction
run :: Location -> IO ()
run curLoc =
let
locObjects = locationObjects curLoc
locDescr = describeLocation curLoc
objectsDescr = enumerateObjects locObjects
fullDescr = locDescr ++ objectsDescr
in do
putStrLn fullDescr
putStr "Enter command: "
x <- getLine
case (convertStringToAction x) of
Quit -> putStrLn "Be seen you..."
Investigate obj -> do
putStrLn (investigate obj locObjects)
run curLoc
Look -> do
putStrLn fullDescr
run curLoc
Go dir -> do
putStrLn ("\nYou're going to " ++ show dir ++ ".\n")
run (walk curLoc dir)
conversionResult -> do
putStrLn (evalAction conversionResult)
putStrLn "End of turn.\n"
run curLoc
main = do
putStrLn "Quest adventure on Haskell.\n"
run Home