Skip to content

Commit

Permalink
feat: added word dictionary - fixes #19 (#24)
Browse files Browse the repository at this point in the history
* feat: added word dictionary

* fix: split words from code
  • Loading branch information
akiross authored Apr 20, 2024
1 parent e440b2b commit 2362f16
Show file tree
Hide file tree
Showing 3 changed files with 9,410 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ import Element.Font as Font
import Html exposing (Html)
import Html.Events
import Json.Decode as Decode
import Validate exposing (getSecretWord, isParola)
import Word exposing (..)


main =
Browser.element { init = init, update = update, view = view, subscriptions = subscriptions }
Browser.element
{ init = init
, update = update
, view = view
, subscriptions = subscriptions
}


type alias Model =
Expand All @@ -29,7 +35,7 @@ init : () -> ( Model, Cmd Msg )
init _ =
( { guesses = []
, current = []
, solution = testSolution
, solution = String.toList getSecretWord
}
, Cmd.none
)
Expand All @@ -44,6 +50,9 @@ type Msg
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
let
currentGuess =
String.fromList model.current

currentGuessLen =
List.length model.current
in
Expand All @@ -62,6 +71,9 @@ update msg model =
if currentGuessLen < 5 then
model

else if not (isParola currentGuess) then
model

else
confirmGuess model

Expand Down Expand Up @@ -213,10 +225,6 @@ emptyTile =
EmptyTile


testSolution =
[ 'B', 'U', 'F', 'F', 'A' ]


emptyWord =
List.repeat 5 emptyTile

Expand Down
Loading

0 comments on commit 2362f16

Please sign in to comment.