summaryrefslogtreecommitdiff
path: root/fp2/week3/mart/GetallenRaden.icl
diff options
context:
space:
mode:
Diffstat (limited to 'fp2/week3/mart/GetallenRaden.icl')
-rw-r--r--fp2/week3/mart/GetallenRaden.icl52
1 files changed, 0 insertions, 52 deletions
diff --git a/fp2/week3/mart/GetallenRaden.icl b/fp2/week3/mart/GetallenRaden.icl
deleted file mode 100644
index c1b2bb0..0000000
--- a/fp2/week3/mart/GetallenRaden.icl
+++ /dev/null
@@ -1,52 +0,0 @@
-// Mart Lubbers s4109503, Camil Staps s4498062
-
-module GetallenRaden
-
-import StdEnv
-import StdDynamic, StdDynamicFileIO
-import StdFileSelect
-
-// Example generation program
-//fib :: [Int]
-//fib = [fib` i \\ i <- [0..]]
-// where
-// fib` 0 = 0
-// fib` 1 = 1
-// fib` n = fib` (n-1) + fib` (n-2)
-//
-//Start :: *World -> (Bool, *World)
-//Start world = writeDynamic "fib" (dynamic fib) world
-
-makeSeq :: Dynamic -> [Int]
-makeSeq (x :: [Int]) = x
-makeSeq _ = abort "You selected a file not containing a sequence"
-
-basename :: String Int -> String
-basename s 0 = toString s.[0]
-basename s n = let c = toString s.[n] in if (c == "\\") "" ((basename s (n-1)) +++ c)
-
-loadSeq :: String *World -> *([Int], String, *World)
-loadSeq s world
-# s = let l = size s in s % (0, l-5)
-# (ok, dyn, world) = readDynamic s world
-| not ok = abort "You didn't select a dynamic file"
-| otherwise = (makeSeq dyn, basename s ((size s)-1), world)
-
-play :: *File String [Int] Int Int -> *File
-play io _ _ _ 5 = io <<< "Congratulations, you had 5 correct answers\n"
-play io seqname [nextnum:sequence] currentnum correct
-# io = io <<< (seqname +++ "[" +++ toString currentnum +++ "] = " +++ toString nextnum +++ "\n")
-# (ok, guessednumber, io) = freadi io
-| not ok = play (snd (freadline io)) seqname sequence (currentnum + 1) correct
-# (io, correct) = if (guessednumber == hd sequence) (io, correct+1) (io <<< "Incorrect...\n", correct)
-= play (snd (freadline io)) seqname sequence (currentnum + 1) correct
-
-Start :: *World -> *World
-Start world
-# (inputfilepath, world) = selectInputFile world
-| isNothing inputfilepath = abort "Please select a file"
-# (sequence, sequencename, world) = loadSeq (fromJust inputfilepath) world
-# (io, world) = stdio world
-# io = (play io sequencename sequence 0 0) <<< "Press any key to close"
-# (_, world) = fclose io world
-= world