aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport.hs
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-12-15 19:31:47 +0530
committerAkshay Nair <phenax5@gmail.com>2024-12-15 19:31:47 +0530
commitbee0febb5d98f0993a7a3bd175046f4fbf9c8eec (patch)
treed40125ac28c8720a332ff585cbd733b3fceab3e3 /src/Chelleport.hs
parent60b4a0fafebfc0351b3d0a6be13474d0f76e284a (diff)
downloadchelleport-bee0febb5d98f0993a7a3bd175046f4fbf9c8eec.tar.gz
chelleport-bee0febb5d98f0993a7a3bd175046f4fbf9c8eec.zip
Generate random key sequences with lcg
Diffstat (limited to '')
-rw-r--r--src/Chelleport.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Chelleport.hs b/src/Chelleport.hs
index 82188b9..cb0ed84 100644
--- a/src/Chelleport.hs
+++ b/src/Chelleport.hs
@@ -7,6 +7,8 @@ import Chelleport.KeySequence (eventToKeycode, findMatchPosition, generateGrid,
import Chelleport.Types
import Chelleport.Utils (intToCInt)
import qualified Chelleport.View
+import Data.List ((\\))
+import Data.Maybe (fromMaybe)
import qualified SDL
open :: IO ()
@@ -14,12 +16,12 @@ open = setupAppShell initialState update eventToAction Chelleport.View.render
initialState :: DrawContext -> IO State
initialState _ctx = do
- let cells = generateGrid (rows, columns) hintKeys
+ let cells = fromMaybe (pure undefined) $ generateGrid 0 (rows, columns) hintKeys
pure $ State {stateGrid = cells, stateKeySequence = []}
where
rows = 12
columns = 12
- hintKeys = "ABCDEFGHIJKLMNOPRSTUVWXYZ1234567890"
+ hintKeys = ['A' .. 'Z'] \\ "Q"
update :: Update State AppAction
update state _ctx (FilterSequence key) =