Week 44 of 2020
Development log of Word Snake
65 items
- Use four touch buttons to control the snake
- Implement swipe control
- Remove touch buttons
- Mentions swipe in the instruction text
- Merge branch 'swipe' into 'master'
- Fix typo
- Add type annotations, remove unused names
- Merge branch 'cleanup' into master
- Use sans-serif font, make the challenge text smaller
- Add LICENSE
- Branding, styling, SEO
- Implement continuous swipe control
- Merge branch 'better-swipe' into 'master'
- Reorder definitions to group related stuff together
- Let the snake be controlled using arrow keys
- Fix Chromium and Android WebView bugs
- Implement play again button
- Separate challenges (renamed to passwords) to own module
- Separate Game module from Main
- Fix: Only Firefox implements inset css property
- Add Capacitor and Android project
- Create icon, setup make for android project
- Make the SVG element fill it's parent
- Tweak the icon. Make the background red.
- Make the icon white again
- Add privacy policy
- Add android/app/ directory
- Drop unnecessary permissions from Android manifest
- Merge branch 'capacitor' into 'master'
- Add a password
- Add large icon and credits page, changed og:image
- 1.0.1
- Amend the privacy policy, fix emoji
- 1.0.2
- Make sure that Android build has fresh assets
- 1.0.3
- Set release version in Gradle file
- 1.0.4
- Swallow the letters only when the snake reaches them
- Display dead snake as skull and bones emojis
- Make the snake grow at the rear
- Make the snake poop from the rear, not head
- Prevent letters from spawning under the snake
- Move Swipe type definition to it's rightful place
- Merge branch 'better-animations' into 'master'
- Make the game over / win dialogs fade in with delay
- Fix a glitch when dead snake swallows fire
- Merge branch 'animate-dialogs' into 'master'
- Make the snake die only once the head reaches the danger
- Fix snake pooping when correct letter is swallowed
- Merge branch 'even-better-animations' into 'master'
- Bump Android app version
- 1.0.5
- Add few more passwords. Rearrange. Remove some.
- More passwords
- Setup Fathom analytics
- Fix an ambiguous password
- Rename Password to Level, carry Charset in a Level record
- Rename Level.charset to Level.uppercaseLatinLetters
- The program will load levels from the server
- Disable tracking goals with Fathom unless in production
- Implement smart levels queue
- Let the levels document specify character set
- Let user select different levels document
- Merge branch 'levels' into 'master'
Use four touch buttons to control the snake
On by
index 47981b9..1e14077 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -9,6 +9,7 @@ import Maybe.Extra as Maybe
=import Random
=import Svg exposing (Svg)
=import Svg.Attributes
+import Svg.Events
=import Svg.Keyed
=import Task
=import Time
@@ -171,23 +172,95 @@ areaView area letters snake =
= |> List.map String.fromInt
= |> String.join " "
= in
+ [ directionButtonsView 14 8 8
+ , snakeView snake
+ , lettersView letters
+ ]
+ |> Svg.svg
+ [ Svg.Attributes.viewBox viewbox
+ ]
+
+
+directionButtonsView : Float -> Float -> Float -> Svg Msg
+directionButtonsView scale x y =
+ [ North
+ , East
+ , South
+ , West
+ ]
+ |> List.indexedMap directionButtonView
+ |> Svg.g
+ [ [ Transformations.Translate "" x y
+ , Transformations.Scale scale scale
+ ]
+ |> List.map Transformations.toString
+ |> String.join ", "
+ |> Svg.Attributes.transform
+ ]
+
+
+directionButtonView : Int -> Direction -> Svg Msg
+directionButtonView index direction =
+ let
+ rotation =
+ (90 * index)
+ |> Basics.toFloat
+
+ label =
+ Svg.text_
+ [ Svg.Attributes.fontSize <| String.fromFloat <| (1 / 4)
+ , Html.Attributes.style "text-anchor" "middle"
+ , Html.Attributes.style "dominant-baseline" "hanging"
+ , Svg.Attributes.fill "white"
+ , Transformations.Translate "" (1 / 8) 0
+ |> Transformations.toString
+ |> Svg.Attributes.transform
+ ]
+ [ Svg.text "↑" ]
+
+ shape =
+ Svg.rect
+ [ Svg.Attributes.width <| String.fromFloat <| (1 / 4)
+ , Svg.Attributes.height <| String.fromFloat <| (1 / 4)
+ , Svg.Attributes.fill "silver"
+ , Svg.Attributes.stroke "white"
+ , Svg.Attributes.strokeWidth <| String.fromFloat <| (1 / 100)
+ , Svg.Events.onClick (DirectionButtonClicked direction)
+ ]
+ []
+ in
+ [ shape
+ , label
+ ]
+ |> Svg.g
+ [ [ Transformations.Rotate rotation
+ , Transformations.Translate "" -(1 / 8) -(2 / 5)
+ ]
+ |> List.map Transformations.toString
+ |> String.join ", "
+ |> Svg.Attributes.transform
+ ]
+
+
+lettersView : Letters -> Svg Msg
+lettersView letters =
= letters
= |> Dict.toList
= |> List.map letterView
- |> (::) (snakeView snake)
- |> Svg.Keyed.node "svg"
- [ Svg.Attributes.viewBox viewbox
+ |> Svg.Keyed.node "g"
+ [ Html.Attributes.style "pointer-events" "none"
= ]
=
=
-snakeView : Snake -> ( String, Svg Msg )
+snakeView : Snake -> Svg Msg
=snakeView snake =
= [ headView snake.alive snake.head
= , bodyView snake.body
= , tailView snake.tail
= ]
- |> Svg.g []
- |> Tuple.pair "snake"
+ |> Svg.g
+ [ Html.Attributes.style "pointer-events" "none"
+ ]
=
=
=headView : Bool -> Position -> Svg Msg
@@ -264,6 +337,7 @@ type Msg
= | GotNewChallenge Challenge
= | Step Time.Posix
= | KeyPressed Keyboard.RawKey
+ | DirectionButtonClicked Direction
=
=
=update : Msg -> Model -> ( Model, Cmd Msg )
@@ -361,6 +435,11 @@ update msg model =
= _ ->
= ( model, Cmd.none )
=
+ DirectionButtonClicked direction ->
+ ( { model | snake = setDirection direction model.snake }
+ , Cmd.none
+ )
+
=
=
=-- SUBSCRIPTIONSImplement swipe control
On by
index b3ca72b..afec025 100644
--- a/elm.json
+++ b/elm.json
@@ -13,9 +13,12 @@
= "elm/svg": "1.0.1",
= "elm/time": "1.0.0",
= "elm-community/maybe-extra": "5.2.0",
+ "mpizenberg/elm-pointer-events": "4.0.2",
= "ohanhi/keyboard": "2.0.1"
= },
= "indirect": {
+ "elm/bytes": "1.0.8",
+ "elm/file": "1.0.5",
= "elm/json": "1.1.3",
= "elm/url": "1.0.0",
= "elm/virtual-dom": "1.0.2"index 1e14077..58ad676 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -4,6 +4,7 @@ import Browser
=import Dict exposing (Dict)
=import Html exposing (Html)
=import Html.Attributes
+import Html.Events.Extra.Touch as Touch exposing (Touch)
=import Keyboard
=import Maybe.Extra as Maybe
=import Random
@@ -33,6 +34,14 @@ type alias Model =
= , challenge : Challenge
= , word : String
= , randomness : Random.Seed
+ , swipe : Maybe Swipe
+ }
+
+
+type alias Swipe =
+ { identifier : Int
+ , from : ( Float, Float )
+ , to : ( Float, Float )
= }
=
=
@@ -100,6 +109,7 @@ init flags =
= , word = ""
= , randomness =
= Random.initialSeed 0
+ , swipe = Nothing
= }
= , [ Random.generate GotNewChallenge randomChallenge
= , Time.now |> Task.perform GotTime
@@ -119,6 +129,10 @@ view model =
= , Html.Attributes.style "height" "100%"
= , Html.Attributes.style "display" "flex"
= , Html.Attributes.style "flex-direction" "column"
+ , Touch.onStart TouchStarted
+ , Touch.onEnd TouchEnded
+ , Touch.onMove TouchMoved
+ , Touch.onCancel TouchCanceled
= ]
= [ Html.h1
= [ Html.Attributes.style "text-align" "center" ]
@@ -338,6 +352,10 @@ type Msg
= | Step Time.Posix
= | KeyPressed Keyboard.RawKey
= | DirectionButtonClicked Direction
+ | TouchStarted Touch.Event
+ | TouchMoved Touch.Event
+ | TouchEnded Touch.Event
+ | TouchCanceled Touch.Event
=
=
=update : Msg -> Model -> ( Model, Cmd Msg )
@@ -440,6 +458,172 @@ update msg model =
= , Cmd.none
= )
=
+ TouchStarted event ->
+ case event.touches of
+ [] ->
+ -- This should never happen, but whatever!
+ ( { model | swipe = Nothing }
+ , Cmd.none
+ )
+
+ [ touch ] ->
+ ( { model
+ | swipe =
+ Just
+ { identifier = touch.identifier
+ , from = touch.clientPos
+ , to = touch.clientPos
+ }
+ }
+ , Cmd.none
+ )
+
+ _ ->
+ -- We do not support multiple touches. Cancel the swipe.
+ ( { model | swipe = Nothing }
+ , Cmd.none
+ )
+
+ TouchMoved event ->
+ case event.touches of
+ [] ->
+ -- This should never happen, but whatever!
+ ( { model | swipe = Nothing }
+ , Cmd.none
+ )
+
+ [ touch ] ->
+ case model.swipe of
+ Nothing ->
+ -- This also shouldn't really happen. Surely there was a touch start some time before!
+ ( { model
+ | swipe =
+ Just
+ { identifier = touch.identifier
+ , from = touch.clientPos
+ , to = touch.clientPos
+ }
+ }
+ , Cmd.none
+ )
+
+ Just swipe ->
+ if swipe.identifier == touch.identifier then
+ ( { model
+ | swipe =
+ Just
+ { swipe | to = touch.clientPos }
+ }
+ , Cmd.none
+ )
+
+ else
+ -- There is a swipe, but from a different touch? That is weird. I guess we should start a new swipe then.
+ ( { model
+ | swipe =
+ Just
+ { identifier = touch.identifier
+ , from = touch.clientPos
+ , to = touch.clientPos
+ }
+ }
+ , Cmd.none
+ )
+
+ _ ->
+ -- We do not support multiple touches. Cancel the swipe.
+ ( { model | swipe = Nothing }
+ , Cmd.none
+ )
+
+ TouchEnded event ->
+ case event.changedTouches of
+ [] ->
+ -- This should never happen, but whatever!
+ ( { model | swipe = Nothing }
+ , Cmd.none
+ )
+
+ [ touch ] ->
+ case model.swipe of
+ Nothing ->
+ -- This also shouldn't really happen. Surely there was a touch start some time before! Not much we can do here.
+ -- TODO: Report an error.
+ ( model
+ , Cmd.none
+ )
+
+ Just swipe ->
+ if swipe.identifier == touch.identifier then
+ let
+ direction =
+ if Basics.abs relativeX < Basics.abs relativeY then
+ -- north or south
+ if relativeY > 0 then
+ South
+
+ else
+ North
+
+ else
+ -- east or west
+ if
+ relativeX > 0
+ then
+ East
+
+ else
+ West
+
+ ( fromX, fromY ) =
+ swipe.from
+
+ ( toX, toY ) =
+ touch.clientPos
+
+ ( relativeX, relativeY ) =
+ ( toX - fromX, toY - fromY )
+ in
+ ( { model
+ | swipe = Nothing
+ , snake =
+ model.snake
+ |> setDirection direction
+ }
+ , Cmd.none
+ )
+
+ else
+ -- There is a swipe, but from a different touch? That is weird. I guess we should start a new swipe then.
+ ( { model
+ | swipe =
+ Just
+ { identifier = touch.identifier
+ , from = touch.clientPos
+ , to = touch.clientPos
+ }
+ }
+ , Cmd.none
+ )
+
+ _ ->
+ -- We do not support multiple touches. Cancel the swipe.
+ ( { model | swipe = Nothing }
+ , Cmd.none
+ )
+
+ TouchCanceled event ->
+ let
+ tuple : Touch -> ( Int, ( Float, Float ) )
+ tuple touch =
+ ( touch.identifier, touch.clientPos )
+ in
+ ( { model
+ | swipe = Nothing
+ }
+ , Cmd.none
+ )
+
=
=
=-- SUBSCRIPTIONSRemove touch buttons
On by
Swipe works better!
index 58ad676..3acc332 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -10,7 +10,6 @@ import Maybe.Extra as Maybe
=import Random
=import Svg exposing (Svg)
=import Svg.Attributes
-import Svg.Events
=import Svg.Keyed
=import Task
=import Time
@@ -186,8 +185,7 @@ areaView area letters snake =
= |> List.map String.fromInt
= |> String.join " "
= in
- [ directionButtonsView 14 8 8
- , snakeView snake
+ [ snakeView snake
= , lettersView letters
= ]
= |> Svg.svg
@@ -195,67 +193,6 @@ areaView area letters snake =
= ]
=
=
-directionButtonsView : Float -> Float -> Float -> Svg Msg
-directionButtonsView scale x y =
- [ North
- , East
- , South
- , West
- ]
- |> List.indexedMap directionButtonView
- |> Svg.g
- [ [ Transformations.Translate "" x y
- , Transformations.Scale scale scale
- ]
- |> List.map Transformations.toString
- |> String.join ", "
- |> Svg.Attributes.transform
- ]
-
-
-directionButtonView : Int -> Direction -> Svg Msg
-directionButtonView index direction =
- let
- rotation =
- (90 * index)
- |> Basics.toFloat
-
- label =
- Svg.text_
- [ Svg.Attributes.fontSize <| String.fromFloat <| (1 / 4)
- , Html.Attributes.style "text-anchor" "middle"
- , Html.Attributes.style "dominant-baseline" "hanging"
- , Svg.Attributes.fill "white"
- , Transformations.Translate "" (1 / 8) 0
- |> Transformations.toString
- |> Svg.Attributes.transform
- ]
- [ Svg.text "↑" ]
-
- shape =
- Svg.rect
- [ Svg.Attributes.width <| String.fromFloat <| (1 / 4)
- , Svg.Attributes.height <| String.fromFloat <| (1 / 4)
- , Svg.Attributes.fill "silver"
- , Svg.Attributes.stroke "white"
- , Svg.Attributes.strokeWidth <| String.fromFloat <| (1 / 100)
- , Svg.Events.onClick (DirectionButtonClicked direction)
- ]
- []
- in
- [ shape
- , label
- ]
- |> Svg.g
- [ [ Transformations.Rotate rotation
- , Transformations.Translate "" -(1 / 8) -(2 / 5)
- ]
- |> List.map Transformations.toString
- |> String.join ", "
- |> Svg.Attributes.transform
- ]
-
-
=lettersView : Letters -> Svg Msg
=lettersView letters =
= letters
@@ -351,7 +288,6 @@ type Msg
= | GotNewChallenge Challenge
= | Step Time.Posix
= | KeyPressed Keyboard.RawKey
- | DirectionButtonClicked Direction
= | TouchStarted Touch.Event
= | TouchMoved Touch.Event
= | TouchEnded Touch.Event
@@ -453,11 +389,6 @@ update msg model =
= _ ->
= ( model, Cmd.none )
=
- DirectionButtonClicked direction ->
- ( { model | snake = setDirection direction model.snake }
- , Cmd.none
- )
-
= TouchStarted event ->
= case event.touches of
= [] ->Mentions swipe in the instruction text
On by
index 3acc332..7430475 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -165,7 +165,7 @@ view model =
= Html.text "That's correct! Now help the snake escape to safety."
=
= else
- Html.text "Save the snake! Guess the password. Use W A S D to move around and collect the letters. Avoid fire and poop!"
+ Html.text "Save the snake! Guess the password. Use W A S D (or swipe) to move around. Collect the letters and then escepa the fire trap. Avoid fire and poop!"
=
= else
= Html.text "Oh, no! Your snake is dead. Reload the browser to play again."Merge branch 'swipe' into 'master'
On by
Enable swipe control for touch screens
See merge request hornbook/word-snake!1
Fix typo
On by
index 7430475..3a449c3 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -165,7 +165,7 @@ view model =
= Html.text "That's correct! Now help the snake escape to safety."
=
= else
- Html.text "Save the snake! Guess the password. Use W A S D (or swipe) to move around. Collect the letters and then escepa the fire trap. Avoid fire and poop!"
+ Html.text "Save the snake! Guess the password. Use W A S D (or swipe) to move around. Collect the letters and then escape the fire trap. Avoid fire and poop!"
=
= else
= Html.text "Oh, no! Your snake is dead. Reload the browser to play again."Add type annotations, remove unused names
On by
index 3a449c3..b28dbaa 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -1,4 +1,4 @@
-module Main exposing (Model, Msg, init, subscriptions, update, view)
+module Main exposing (Model, Msg, init, main, subscriptions, update, view)
=
=import Browser
=import Dict exposing (Dict)
@@ -13,7 +13,7 @@ import Svg.Attributes
=import Svg.Keyed
=import Task
=import Time
-import Transformations exposing (Transformation)
+import Transformations
=
=
=main : Program Flags Model Msg
@@ -92,7 +92,7 @@ type alias Flags =
=
=
=init : Flags -> ( Model, Cmd Msg )
-init flags =
+init _ =
= ( { area = Area 16 16
= , letters = Dict.empty
= , snake =
@@ -176,6 +176,7 @@ view model =
=areaView : Area -> Letters -> Snake -> Html Msg
=areaView area letters snake =
= let
+ viewbox : String
= viewbox =
= [ -2
= , -2
@@ -217,6 +218,7 @@ snakeView snake =
=headView : Bool -> Position -> Svg Msg
=headView alive =
= let
+ color : String
= color =
= if alive then
= "green"
@@ -255,6 +257,7 @@ segmentView size color ( x, y ) =
=letterView : ( Position, Char ) -> ( String, Svg Msg )
=letterView ( ( x, y ), letter ) =
= let
+ key : String
= key =
= [ x, y ]
= |> List.map String.fromInt
@@ -487,6 +490,7 @@ update msg model =
= Just swipe ->
= if swipe.identifier == touch.identifier then
= let
+ direction : Direction
= direction =
= if Basics.abs relativeX < Basics.abs relativeY then
= -- north or south
@@ -543,12 +547,7 @@ update msg model =
= , Cmd.none
= )
=
- TouchCanceled event ->
- let
- tuple : Touch -> ( Int, ( Float, Float ) )
- tuple touch =
- ( touch.identifier, touch.clientPos )
- in
+ TouchCanceled _ ->
= ( { model
= | swipe = Nothing
= }
@@ -561,7 +560,7 @@ update msg model =
=
=
=subscriptions : Model -> Sub Msg
-subscriptions model =
+subscriptions _ =
= [ Time.every 250 Step
= , Keyboard.downs KeyPressed
= ]
@@ -584,21 +583,25 @@ burnTheEdge area burn letters =
= , westEdge
= ]
=
+ northEdge : List Position
= northEdge =
= (area.width + 1)
= |> List.range -1
= |> List.map (\x -> ( x, -1 ))
=
+ eastEdge : List Position
= eastEdge =
= (area.height + 1)
= |> List.range -1
= |> List.map (\y -> ( area.width + 1, y ))
=
+ southEdge : List Position
= southEdge =
= (area.width + 1)
= |> List.range -1
= |> List.map (\x -> ( x, area.height + 1 ))
=
+ westEdge : List Position
= westEdge =
= (area.height + 1)
= |> List.range -1
@@ -651,6 +654,7 @@ isOutside area ( x, y ) =
=setDirection : Direction -> Snake -> Snake
=setDirection direction snake =
= let
+ neck : Position
= neck =
= case snake.body of
= [] ->
@@ -661,7 +665,7 @@ setDirection direction snake =
= -- The snake has a single body segment. Let's call it a belly, but it's also a neck!
= belly
=
- torso :: belly :: rest ->
+ torso :: belly :: _ ->
= -- The snake is looooong now. It has torso, belly and the rest.
= if torso == snake.head then
= -- Immediately after swallowing a letter a new segment
@@ -685,15 +689,18 @@ setDirection direction snake =
=moveSnake : Snake -> Snake
=moveSnake snake =
= let
+ head : Position
= head =
= moveSegment snake.direction snake.head
=
+ body : List Position
= body =
= snake.body
= |> List.foldl moveSegments ( snake.head, [] )
= |> Tuple.second
= |> List.reverse
=
+ tail : Position
= tail =
= snake.body
= |> List.reverse
@@ -704,6 +711,7 @@ moveSnake snake =
= moveSegments segment ( target, segments ) =
= ( segment, target :: segments )
=
+ alive : Bool
= alive =
= List.member head body |> not
= in
@@ -838,6 +846,7 @@ charset =
=randomLetter : List Char -> Random.Generator Char
=randomLetter promoted =
= let
+ weights : List Float
= weights =
= charset
= |> List.mapMerge branch 'cleanup' into master
On by
Use sans-serif font, make the challenge text smaller
On by
index b28dbaa..5b983cf 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -128,13 +128,16 @@ view model =
= , Html.Attributes.style "height" "100%"
= , Html.Attributes.style "display" "flex"
= , Html.Attributes.style "flex-direction" "column"
+ , Html.Attributes.style "font-family" "sans-serif"
= , Touch.onStart TouchStarted
= , Touch.onEnd TouchEnded
= , Touch.onMove TouchMoved
= , Touch.onCancel TouchCanceled
= ]
= [ Html.h1
- [ Html.Attributes.style "text-align" "center" ]
+ [ Html.Attributes.style "text-align" "center"
+ , Html.Attributes.style "font-size" "1rem"
+ ]
= [ Html.text model.challenge.intro
= , Html.span
= [ Html.Attributes.style "background" <|Add LICENSE
On by
new file mode 100644
index 0000000..47f78aa
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ Word Snake
+ Copyright (C) 2020 Hornbook
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Word Snake Copyright (C) 2020 Hornbook
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.Branding, styling, SEO
On by
index 5b983cf..5da5fc6 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -128,7 +128,6 @@ view model =
= , Html.Attributes.style "height" "100%"
= , Html.Attributes.style "display" "flex"
= , Html.Attributes.style "flex-direction" "column"
- , Html.Attributes.style "font-family" "sans-serif"
= , Touch.onStart TouchStarted
= , Touch.onEnd TouchEnded
= , Touch.onMove TouchMovedindex 2ad9031..aa41bad 100644
--- a/src/index.html
+++ b/src/index.html
@@ -1,10 +1,28 @@
=<!DOCTYPE html>
=<html lang="en">
= <head>
+ <title>Word Snake</title>
+
= <meta charset="utf-8">
= <meta http-equiv="X-UA-Compatible" content="IE=edge">
= <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Word Snake</title>
+ <meta
+ property="og:title"
+ content="Word Snake"
+ />
+ <meta
+ property="og:image"
+ content="https://images.unsplash.com/photo-1539389004540-770367e1bccb?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&dl=david-clode-QZePScKPb2Q-unsplash.jpg&w=1920"
+ />
+ <meta
+ property="og:description"
+ content="Save the snake from a firetrap by guessing the password and collecting the right letters. Avoid fire and poop!"
+ />
+ <meta
+ property="og:url"
+ content="/word-snake/"
+ />
+
= <script type="text/javascript" src="./index.coffee" defer>
= </script>
= <style type="text/css" media="screen">
@@ -12,16 +30,45 @@
= height: 100%;
= margin: 0;
= padding: 0;
+ font-family: sans-serif;
= }
=
= body {
= background: hsl(0, 0%, 86%);
= color: hsl(0, 0%, 26%);
+ display: flex;
+ flex-direction: column;
= }
+
+ footer {
+ text-align: center;
+ max-width: 640px;
+ align-self: center;
+ font-size: 0.8rem;
+ }
+
= </style>
=
= </head>
= <body>
= <div id="app"></div>
+ <footer>
+ <p>
+ Made by <a href="https://tad-lispy.com/">Tad Lispy</a>.
+ </p>
+
+ <p>
+ This game is a <strong>free software</strong>. You may copy, modify,
+ redistribute it etc. under the terms of
+ <a
+ href="https://www.gnu.org/licenses/gpl-3.0.html"
+ target="_blank"
+ >the GNU General Public License v. 3.0</a>
+ or later.
+ <a
+ href="https://gitlab.com/hornbook/word-snake/"
+ >See the source code</a>. Have fun!
+ </p>
+ </footer>
= </body>
=</html>Implement continuous swipe control
On by
Now player do not have to lift the finger to turn snake in another direction.
index 5da5fc6..d1afccd 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -319,6 +319,12 @@ update msg model =
=
= Step _ ->
= let
+ direction : Direction
+ direction =
+ model.swipe
+ |> Maybe.andThen swipeDirection
+ |> Maybe.withDefault model.snake.direction
+
= ( letters, randomness ) =
= model.letters
= |> randomDecay 0.01
@@ -328,6 +334,7 @@ update msg model =
= snake : Snake
= snake =
= model.snake
+ |> setDirection direction
= |> moveSnake
= |> updateSnake letters
=
@@ -362,6 +369,7 @@ update msg model =
= , randomness = randomness
= , snake = snake
= , word = word
+ , swipe = model.swipe |> Maybe.map (\swipe -> { swipe | from = swipe.to })
= }
= , Cmd.none
= )
@@ -491,41 +499,13 @@ update msg model =
=
= Just swipe ->
= if swipe.identifier == touch.identifier then
- let
- direction : Direction
- direction =
- if Basics.abs relativeX < Basics.abs relativeY then
- -- north or south
- if relativeY > 0 then
- South
-
- else
- North
-
- else
- -- east or west
- if
- relativeX > 0
- then
- East
-
- else
- West
-
- ( fromX, fromY ) =
- swipe.from
-
- ( toX, toY ) =
- touch.clientPos
-
- ( relativeX, relativeY ) =
- ( toX - fromX, toY - fromY )
- in
= ( { model
= | swipe = Nothing
= , snake =
- model.snake
- |> setDirection direction
+ { swipe | to = touch.clientPos }
+ |> swipeDirection
+ |> Maybe.map (\direction -> setDirection direction model.snake)
+ |> Maybe.withDefault model.snake
= }
= , Cmd.none
= )
@@ -653,6 +633,45 @@ isOutside area ( x, y ) =
= (x < 0) || (x > area.width) || (y < 0) || (y > area.height)
=
=
+swipeDirection : Swipe -> Maybe Direction
+swipeDirection swipe =
+ let
+ threshold =
+ 1.0
+
+ ( fromX, fromY ) =
+ swipe.from
+
+ ( toX, toY ) =
+ swipe.to
+
+ ( relativeX, relativeY ) =
+ ( toX - fromX, toY - fromY )
+ in
+ if Basics.abs relativeX < threshold || Basics.abs relativeY < threshold then
+ Nothing
+
+ else
+ Just <|
+ if Basics.abs relativeX < Basics.abs relativeY then
+ -- north or south
+ if relativeY > 0 then
+ South
+
+ else
+ North
+
+ else
+ -- east or west
+ if
+ relativeX > 0
+ then
+ East
+
+ else
+ West
+
+
=setDirection : Direction -> Snake -> Snake
=setDirection direction snake =
= letMerge branch 'better-swipe' into 'master'
On by
Implement continuous swipe control
See merge request hornbook/word-snake!2
Reorder definitions to group related stuff together
On by
index d1afccd..b579954 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -601,6 +601,22 @@ burnTheEdge area burn letters =
= letters
=
=
+updateSnake : Letters -> Snake -> Snake
+updateSnake letters snake =
+ case Dict.get snake.head letters of
+ Nothing ->
+ snake
+
+ Just '🔥' ->
+ { snake | alive = False }
+
+ Just '💩' ->
+ { snake | alive = False }
+
+ Just _ ->
+ { snake | body = snake.head :: snake.body }
+
+
=updateWord : Char -> Snake -> Letters -> String -> String
=updateWord wanted snake letters word =
= case Dict.get snake.head letters of
@@ -618,6 +634,33 @@ updateWord wanted snake letters word =
= word
=
=
+updateLetters : Char -> Snake -> Letters -> Letters
+updateLetters wanted snake letters =
+ letters
+ |> Dict.update snake.head (updateLetter wanted)
+
+
+updateLetter : Char -> Maybe Char -> Maybe Char
+updateLetter wanted letter =
+ case letter of
+ Nothing ->
+ Nothing
+
+ Just '🔥' ->
+ letter
+
+ Just c ->
+ if c == wanted then
+ Nothing
+
+ else
+ Just '💩'
+
+
+
+-- game state predicates
+
+
=passwordCollected : Model -> Bool
=passwordCollected model =
= String.toUpper model.word == String.toUpper model.challenge.password
@@ -633,6 +676,10 @@ isOutside area ( x, y ) =
= (x < 0) || (x > area.width) || (y < 0) || (y > area.height)
=
=
+
+-- direction helpers
+
+
=swipeDirection : Swipe -> Maybe Direction
=swipeDirection swipe =
= let
@@ -707,6 +754,10 @@ setDirection direction snake =
= { snake | direction = direction }
=
=
+
+-- snake movement
+
+
=moveSnake : Snake -> Snake
=moveSnake snake =
= let
@@ -748,22 +799,6 @@ moveSnake snake =
= snake
=
=
-updateSnake : Letters -> Snake -> Snake
-updateSnake letters snake =
- case Dict.get snake.head letters of
- Nothing ->
- snake
-
- Just '🔥' ->
- { snake | alive = False }
-
- Just '💩' ->
- { snake | alive = False }
-
- Just _ ->
- { snake | body = snake.head :: snake.body }
-
-
=moveSegment : Direction -> Position -> Position
=moveSegment direction ( x, y ) =
= case direction of
@@ -780,27 +815,8 @@ moveSegment direction ( x, y ) =
= ( x - 1, y )
=
=
-updateLetters : Char -> Snake -> Letters -> Letters
-updateLetters wanted snake letters =
- letters
- |> Dict.update snake.head (updateLetter wanted)
-
-
-updateLetter : Char -> Maybe Char -> Maybe Char
-updateLetter wanted letter =
- case letter of
- Nothing ->
- Nothing
-
- Just '🔥' ->
- letter
-
- Just c ->
- if c == wanted then
- Nothing
=
- else
- Just '💩'
+-- challenges
=
=
=challenges : List Challenge
@@ -848,6 +864,15 @@ challenges =
= ]
=
=
+charset : List Char
+charset =
+ String.toList "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+
+
+
+-- random generators
+
+
=randomChallenge : Random.Generator Challenge
=randomChallenge =
= Random.uniform
@@ -859,11 +884,6 @@ randomChallenge =
= challenges
=
=
-charset : List Char
-charset =
- String.toList "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-
-
=randomLetter : List Char -> Random.Generator Char
=randomLetter promoted =
= letLet the snake be controlled using arrow keys
On by
To prevent scorlling I had to use port with a bit of logic on the JS side.
See https://discourse.elm-lang.org/t/a-simple-word-snake-game/6439/2
index afec025..ad2d589 100644
--- a/elm.json
+++ b/elm.json
@@ -9,6 +9,7 @@
= "elm/browser": "1.0.2",
= "elm/core": "1.0.5",
= "elm/html": "1.0.0",
+ "elm/json": "1.1.3",
= "elm/random": "1.0.0",
= "elm/svg": "1.0.1",
= "elm/time": "1.0.0",
@@ -19,7 +20,6 @@
= "indirect": {
= "elm/bytes": "1.0.8",
= "elm/file": "1.0.5",
- "elm/json": "1.1.3",
= "elm/url": "1.0.0",
= "elm/virtual-dom": "1.0.2"
= }index b579954..842475b 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -1,10 +1,11 @@
-module Main exposing (Model, Msg, init, main, subscriptions, update, view)
+port module Main exposing (Model, Msg, init, main, subscriptions, update, view)
=
=import Browser
=import Dict exposing (Dict)
=import Html exposing (Html)
=import Html.Attributes
=import Html.Events.Extra.Touch as Touch exposing (Touch)
+import Json.Decode as Decode
=import Keyboard
=import Maybe.Extra as Maybe
=import Random
@@ -16,6 +17,9 @@ import Time
=import Transformations
=
=
+port keydown : (Decode.Value -> msg) -> Sub msg
+
+
=main : Program Flags Model Msg
=main =
= Browser.element
@@ -292,7 +296,7 @@ type Msg
= = GotTime Time.Posix
= | GotNewChallenge Challenge
= | Step Time.Posix
- | KeyPressed Keyboard.RawKey
+ | KeyPressed (Maybe Keyboard.Key)
= | TouchStarted Touch.Event
= | TouchMoved Touch.Event
= | TouchEnded Touch.Event
@@ -374,26 +378,46 @@ update msg model =
= , Cmd.none
= )
=
- KeyPressed rawKey ->
- case Keyboard.anyKeyUpper rawKey of
+ KeyPressed key ->
+ case key of
= Nothing ->
= ( model, Cmd.none )
=
+ Just Keyboard.ArrowUp ->
+ ( { model | snake = setDirection North model.snake }
+ , Cmd.none
+ )
+
= Just (Keyboard.Character "W") ->
= ( { model | snake = setDirection North model.snake }
= , Cmd.none
= )
=
+ Just Keyboard.ArrowRight ->
+ ( { model | snake = setDirection East model.snake }
+ , Cmd.none
+ )
+
= Just (Keyboard.Character "D") ->
= ( { model | snake = setDirection East model.snake }
= , Cmd.none
= )
=
+ Just Keyboard.ArrowDown ->
+ ( { model | snake = setDirection South model.snake }
+ , Cmd.none
+ )
+
= Just (Keyboard.Character "S") ->
= ( { model | snake = setDirection South model.snake }
= , Cmd.none
= )
=
+ Just Keyboard.ArrowLeft ->
+ ( { model | snake = setDirection West model.snake }
+ , Cmd.none
+ )
+
= Just (Keyboard.Character "A") ->
= ( { model | snake = setDirection West model.snake }
= , Cmd.none
@@ -543,8 +567,17 @@ update msg model =
=
=subscriptions : Model -> Sub Msg
=subscriptions _ =
+ let
+ decodeKeydown : Decode.Value -> Msg
+ decodeKeydown event =
+ event
+ |> Decode.decodeValue Keyboard.eventKeyDecoder
+ |> Result.toMaybe
+ |> Maybe.andThen Keyboard.anyKeyUpper
+ |> KeyPressed
+ in
= [ Time.every 250 Step
- , Keyboard.downs KeyPressed
+ , keydown decodeKeydown
= ]
= |> Sub.batch
=index 586e724..e9136dd 100644
--- a/src/index.coffee
+++ b/src/index.coffee
@@ -3,4 +3,9 @@ import { Elm } from "./Main.elm"
=node = document.getElementById "app"
=flags = {}
=
-Elm.Main.init { node, flags }
+game = Elm.Main.init { node, flags }
+
+document.addEventListener "keydown", (event) =>
+ if event.key in [ "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight" ]
+ do event.preventDefault
+ game.ports.keydown.send eventFix Chromium and Android WebView bugs
On by
In Chroumium (but interestingly not in Chrome) snake was extremely blurred when transitioning.
In Android WebView it was not properly positioned.
Both bugs turned out to be fixed with scaling the units used to render SVG elements by 1000.
Whatever.
index 842475b..53eb917 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -125,6 +125,19 @@ init _ =
=-- VIEW
=
=
+{-| In view scale everything by an arbitrary factor.
+
+In the model everything is positioned on a 1 x 1 grid, but Chromium and Android
+Web View have problems with this setup. So in the view all values (positions,
+sizes, font sizes, etc.) are scaled up by this factor. This is just a workaround
+and has nothing to do with game logic.
+
+-}
+scale : number
+scale =
+ 1000
+
+
=view : Model -> Html Msg
=view model =
= Html.div
@@ -184,10 +197,10 @@ areaView area letters snake =
= let
= viewbox : String
= viewbox =
- [ -2
- , -2
- , area.width + 4
- , area.height + 4
+ [ -2 * scale
+ , -2 * scale
+ , (area.width + 4) * scale
+ , (area.height + 4) * scale
= ]
= |> List.map String.fromInt
= |> String.join " "
@@ -250,12 +263,19 @@ tailView =
=segmentView : Float -> String -> Position -> Svg Msg
=segmentView size color ( x, y ) =
= Svg.circle
- [ Transformations.Translate "px" (Basics.toFloat x) (Basics.toFloat y)
+ [ -- I would prefer to have this unitless (after all we are using SVG
+ -- for scaling), but Firefox does not apply transition to SVG transform
+ -- attribute, and CSS property requires a unit.
+ Transformations.Translate "px"
+ (Basics.toFloat x * scale)
+ (Basics.toFloat y * scale)
= |> Transformations.toString
= |> Html.Attributes.style "transform"
- , size |> String.fromFloat |> Svg.Attributes.r
+ , (size * scale)
+ |> String.fromFloat
+ |> Svg.Attributes.r
= , Svg.Attributes.fill color
- , Html.Attributes.style "transition" "transform 200ms linear"
+ , Html.Attributes.style "transition" "transform 234ms linear"
= ]
= []
=
@@ -274,14 +294,16 @@ letterView ( ( x, y ), letter ) =
= |> Svg.text
= |> List.singleton
= |> Svg.text_
- [ Transformations.Translate "" (Basics.toFloat x) (Basics.toFloat y)
+ [ Transformations.Translate ""
+ (Basics.toFloat x * scale)
+ (Basics.toFloat y * scale)
= |> Transformations.toString
= |> Svg.Attributes.transform
= , Html.Attributes.style "text-anchor" "middle"
= , Html.Attributes.style "dominant-baseline" "middle"
- , Svg.Attributes.width "1"
- , Svg.Attributes.height "1"
- , Svg.Attributes.fontSize "0.6"
+ , Svg.Attributes.width (scale |> String.fromFloat)
+ , Svg.Attributes.height (scale |> String.fromFloat)
+ , Svg.Attributes.fontSize (0.6 * scale |> String.fromFloat)
= , Svg.Attributes.fontWeight "bold"
= , Svg.Attributes.fill "currentColor"
= ]Implement play again button
On by
index 53eb917..ea11226 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -4,6 +4,7 @@ import Browser
=import Dict exposing (Dict)
=import Html exposing (Html)
=import Html.Attributes
+import Html.Events
=import Html.Events.Extra.Touch as Touch exposing (Touch)
=import Json.Decode as Decode
=import Keyboard
@@ -173,22 +174,32 @@ view model =
= , Html.text model.challenge.outro
= ]
= , areaView model.area model.letters model.snake
- , Html.p
+ , Html.div
= [ Html.Attributes.style "text-align" "center"
+ , Html.Attributes.style "padding" "1rem"
= ]
- [ if model.snake.alive then
+ <|
+ if model.snake.alive then
= if snakeEscaped model then
- Html.text "Bravo! The snake is safe. Reload the browser to play again."
+ [ Html.p [] [ Html.text "Bravo! The snake is safe." ]
+ , Html.button [ Html.Events.onClick PlayAgainButtonClicked ] [ Html.text "Play again" ]
+ ]
=
= else if passwordCollected model then
- Html.text "That's correct! Now help the snake escape to safety."
+ [ Html.p [] [ Html.text "That's correct!" ]
+ , Html.p [] [ Html.text " Now help the snake escape to safety." ]
+ ]
=
= else
- Html.text "Save the snake! Guess the password. Use W A S D (or swipe) to move around. Collect the letters and then escape the fire trap. Avoid fire and poop!"
+ [ Html.p [] [ Html.text "Save the snake! Guess the password." ]
+ , Html.p [] [ Html.text "Use W A S D (or swipe 👆) to move around." ]
+ , Html.p [] [ Html.text "Collect the letters and then escape the fire trap. Avoid fire and poop!" ]
+ ]
=
- else
- Html.text "Oh, no! Your snake is dead. Reload the browser to play again."
- ]
+ else
+ [ Html.p [] [ Html.text "Oh, no! Your snake is dead." ]
+ , Html.button [ Html.Events.onClick PlayAgainButtonClicked ] [ Html.text "Play again" ]
+ ]
= ]
=
=
@@ -323,6 +334,7 @@ type Msg
= | TouchMoved Touch.Event
= | TouchEnded Touch.Event
= | TouchCanceled Touch.Event
+ | PlayAgainButtonClicked
=
=
=update : Msg -> Model -> ( Model, Cmd Msg )
@@ -582,6 +594,9 @@ update msg model =
= , Cmd.none
= )
=
+ PlayAgainButtonClicked ->
+ init ()
+
=
=
=-- SUBSCRIPTIONSSeparate challenges (renamed to passwords) to own module
On by
Remove copyrighted content.
index ea11226..ec658aa 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -9,6 +9,7 @@ import Html.Events.Extra.Touch as Touch exposing (Touch)
=import Json.Decode as Decode
=import Keyboard
=import Maybe.Extra as Maybe
+import Password exposing (Password, passwords)
=import Random
=import Svg exposing (Svg)
=import Svg.Attributes
@@ -35,7 +36,7 @@ type alias Model =
= { area : Area
= , letters : Letters
= , snake : Snake
- , challenge : Challenge
+ , password : Password
= , word : String
= , randomness : Random.Seed
= , swipe : Maybe Swipe
@@ -74,13 +75,6 @@ type alias Snake =
= }
=
=
-type alias Challenge =
- { intro : String
- , password : String
- , outro : String
- }
-
-
=type Direction
= = North
= | East
@@ -107,15 +101,15 @@ init _ =
= , direction = East
= , alive = True
= }
- , challenge =
+ , password =
= -- An impossible challenge
- Challenge "" " " ""
+ Password "" " " ""
= , word = ""
= , randomness =
= Random.initialSeed 0
= , swipe = Nothing
= }
- , [ Random.generate GotNewChallenge randomChallenge
+ , [ Random.generate GotNewPassword randomPassword
= , Time.now |> Task.perform GotTime
= ]
= |> Cmd.batch
@@ -155,7 +149,7 @@ view model =
= [ Html.Attributes.style "text-align" "center"
= , Html.Attributes.style "font-size" "1rem"
= ]
- [ Html.text model.challenge.intro
+ [ Html.text model.password.intro
= , Html.span
= [ Html.Attributes.style "background" <|
= if passwordCollected model then
@@ -171,7 +165,7 @@ view model =
= else
= Html.text model.word
= ]
- , Html.text model.challenge.outro
+ , Html.text model.password.outro
= ]
= , areaView model.area model.letters model.snake
= , Html.div
@@ -327,7 +321,7 @@ letterView ( ( x, y ), letter ) =
=
=type Msg
= = GotTime Time.Posix
- | GotNewChallenge Challenge
+ | GotNewPassword Password
= | Step Time.Posix
= | KeyPressed (Maybe Keyboard.Key)
= | TouchStarted Touch.Event
@@ -350,8 +344,8 @@ update msg model =
= , Cmd.none
= )
=
- GotNewChallenge challenge ->
- ( { model | challenge = challenge }
+ GotNewPassword password ->
+ ( { model | password = password }
= , Cmd.none
= )
=
@@ -378,7 +372,7 @@ update msg model =
=
= needed : List Char
= needed =
- model.challenge.password
+ model.password.value
= |> String.toUpper
= |> String.toList
= |> List.drop (String.length model.word)
@@ -733,7 +727,7 @@ updateLetter wanted letter =
=
=passwordCollected : Model -> Bool
=passwordCollected model =
- String.toUpper model.word == String.toUpper model.challenge.password
+ String.toUpper model.word == String.toUpper model.password.value
=
=
=snakeEscaped : Model -> Bool
@@ -886,72 +880,18 @@ moveSegment direction ( x, y ) =
=
=
=
--- challenges
-
-
-challenges : List Challenge
-challenges =
- [ Challenge
- "Thirty six divided by four is "
- "nine"
- "."
- , Challenge
- "Fifty six is "
- "eight"
- " times seven."
- , Challenge
- ""
- "Russia"
- " is the european country with the largest population."
- , Challenge
- "Cobbler is a person who repairs "
- "shoes"
- "."
- , Challenge
- "Anfield Stadium is home to the "
- "Liverpool"
- " football club."
- , Challenge
- "In the periodic table of elements "
- "Hydrogen"
- " is represented by the letter \"H\"."
- , Challenge
- "A typical margarita cocktail recipe needs three ingredients: "
- "lime"
- " juice, orange liqueur and Tequila"
- , Challenge
- "Mount "
- "Everest"
- " is the highest mountain in the world."
- , Challenge
- "Every year there is exactly "
- "seven"
- " months that have thirty one days."
- , Challenge
- "A group of six healthy people have "
- "six"
- " pairs of ears between them."
- ]
-
-
-charset : List Char
-charset =
- String.toList "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-
-
-
=-- random generators
=
=
-randomChallenge : Random.Generator Challenge
-randomChallenge =
+randomPassword : Random.Generator Password
+randomPassword =
= Random.uniform
- (Challenge
+ (Password
= "A slithering animal is called a "
= "snake"
= "."
= )
- challenges
+ passwords
=
=
=randomLetter : List Char -> Random.Generator Char
@@ -959,7 +899,7 @@ randomLetter promoted =
= let
= weights : List Float
= weights =
- charset
+ Password.charset
= |> List.map
= (\letter ->
= if List.member letter promoted then
@@ -970,7 +910,7 @@ randomLetter promoted =
= )
=
= weightmap =
- List.map2 Tuple.pair weights charset
+ List.map2 Tuple.pair weights Password.charset
= in
= Random.weighted ( 1, '🔥' ) weightmap
=new file mode 100644
index 0000000..48e5381
--- /dev/null
+++ b/src/Password.elm
@@ -0,0 +1,74 @@
+module Password exposing (Password, charset, passwords)
+
+
+type alias Password =
+ { intro : String
+ , value : String
+ , outro : String
+ }
+
+
+charset : List Char
+charset =
+ String.toList "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+
+
+passwords : List Password
+passwords =
+ [ Password
+ "Tibia is a name of one of the "
+ "bones"
+ " in the leg."
+ , Password
+ "Somewhat surprisingly, a person can get "
+ "sunburned"
+ " on a cloudy day."
+ , Password
+ "The Jets is an "
+ "American"
+ " family band that had a 1986 hit \"Crush On You\"."
+ , Password
+ "Wales is a country inside the United Kingdom that does not appear on its flag, the Union "
+ "Jack"
+ "."
+ , Password
+ "The Artful Dodger is a nickname of Jack Dawkins, a character in \"Oliver Twist\", a novel by Charles "
+ "Dickens"
+ "."
+ , Password
+ "Dr. Dre is an American "
+ "rapper"
+ "."
+ , Password
+ "Clevo is a "
+ "Taiwanese"
+ " computer manufacturer."
+ , Password
+ "Pokemon Go is a location-based "
+ "augmented"
+ " reality game developed by company called Niantic."
+ , Password
+ "To bypass US Munitions Export Laws, the creator of the PGP "
+ "published"
+ " all the source code in book form."
+ , Password
+ "Munich is a "
+ "German"
+ " city located on the River Isar."
+ , Password
+ "The world's oldest still operational space launch facility located in "
+ "Kazakhstan"
+ "."
+ , Password
+ "Thirty six divided by four is "
+ "nine"
+ "."
+ , Password
+ "Fifty six is "
+ "eight"
+ " times seven."
+ , Password
+ "A group of six healthy people have "
+ "six"
+ " pairs of ears between them."
+ ]Separate Game module from Main
On by
The Game module represents a single play (one password). It will be re-used in Hornbook application as a challenge.
The Main module wraps Game in a Browser.program with some extra UI.
new file mode 100644
index 0000000..021cb71
--- /dev/null
+++ b/src/Game.elm
@@ -0,0 +1,905 @@
+port module Game exposing (Area, Model, Msg, init, snakeEscaped, subscriptions, update, view)
+
+import Dict exposing (Dict)
+import Html exposing (Html)
+import Html.Attributes
+import Html.Events
+import Html.Events.Extra.Touch as Touch exposing (Touch)
+import Json.Decode as Decode
+import Keyboard
+import Maybe.Extra as Maybe
+import Password exposing (Password)
+import Random
+import Svg exposing (Svg)
+import Svg.Attributes
+import Svg.Keyed
+import Task
+import Time
+import Transformations
+
+
+port keydown : (Decode.Value -> msg) -> Sub msg
+
+
+port preventDefault : Decode.Value -> Cmd msg
+
+
+type alias Model =
+ { area : Area
+ , letters : Letters
+ , snake : Snake
+ , password : Password
+ , word : String
+ , randomness : Random.Seed
+ , swipe : Maybe Swipe
+ }
+
+
+type alias Swipe =
+ { identifier : Int
+ , from : ( Float, Float )
+ , to : ( Float, Float )
+ }
+
+
+type alias Area =
+ { width : Int
+ , height : Int
+ }
+
+
+type alias Letters =
+ Dict Position Char
+
+
+type alias Position =
+ ( Int
+ , Int
+ )
+
+
+type alias Snake =
+ { head : Position
+ , body : List Position
+ , tail : Position
+ , direction : Direction
+ , alive : Bool
+ }
+
+
+type Direction
+ = North
+ | East
+ | South
+ | West
+
+
+
+-- INIT
+
+
+type alias Flags =
+ { area : Area
+ , charset : Password.Charset
+ , password : Password
+ , randomness : Random.Seed
+ }
+
+
+init : Flags -> Model
+init flags =
+ { area = flags.area
+ , letters = Dict.empty
+ , snake =
+ { head = ( 0, 0 )
+ , body = List.repeat 5 ( 0, 0 )
+ , tail = ( 0, 0 )
+ , direction = East
+ , alive = True
+ }
+ , password = flags.password
+ , word = ""
+ , randomness = flags.randomness
+ , swipe = Nothing
+ }
+
+
+
+-- VIEW
+
+
+{-| In view scale everything by an arbitrary factor.
+
+In the model everything is positioned on a 1 x 1 grid, but Chromium and Android
+Web View have problems with this setup. So in the view all values (positions,
+sizes, font sizes, etc.) are scaled up by this factor. This is just a workaround
+and has nothing to do with game logic.
+
+-}
+scale : number
+scale =
+ 1000
+
+
+view : Model -> Html Msg
+view model =
+ Html.div
+ [ Html.Attributes.style "width" "100%"
+ , Html.Attributes.style "height" "100%"
+ , Html.Attributes.style "display" "flex"
+ , Html.Attributes.style "flex-direction" "column"
+ , Touch.onStart TouchStarted
+ , Touch.onEnd TouchEnded
+ , Touch.onMove TouchMoved
+ , Touch.onCancel TouchCanceled
+ ]
+ [ Html.h1
+ [ Html.Attributes.style "text-align" "center"
+ , Html.Attributes.style "font-size" "1rem"
+ ]
+ [ Html.text model.password.intro
+ , Html.span
+ [ Html.Attributes.style "background" <|
+ if passwordCollected model then
+ "lightgreen"
+
+ else
+ "lightyellow"
+ , Html.Attributes.style "padding" "0.2em"
+ ]
+ [ if String.isEmpty model.word then
+ Html.text "..."
+
+ else
+ Html.text model.word
+ ]
+ , Html.text model.password.outro
+ ]
+ , areaView model.area model.letters model.snake
+ ]
+
+
+areaView : Area -> Letters -> Snake -> Html Msg
+areaView area letters snake =
+ let
+ viewbox : String
+ viewbox =
+ [ -2 * scale
+ , -2 * scale
+ , (area.width + 4) * scale
+ , (area.height + 4) * scale
+ ]
+ |> List.map String.fromInt
+ |> String.join " "
+ in
+ [ snakeView snake
+ , lettersView letters
+ ]
+ |> Svg.svg
+ [ Svg.Attributes.viewBox viewbox
+ ]
+
+
+lettersView : Letters -> Svg Msg
+lettersView letters =
+ letters
+ |> Dict.toList
+ |> List.map letterView
+ |> Svg.Keyed.node "g"
+ [ Html.Attributes.style "pointer-events" "none"
+ ]
+
+
+snakeView : Snake -> Svg Msg
+snakeView snake =
+ [ headView snake.alive snake.head
+ , bodyView snake.body
+ , tailView snake.tail
+ ]
+ |> Svg.g
+ [ Html.Attributes.style "pointer-events" "none"
+ ]
+
+
+headView : Bool -> Position -> Svg Msg
+headView alive =
+ let
+ color : String
+ color =
+ if alive then
+ "green"
+
+ else
+ "black"
+ in
+ segmentView 0.3 color
+
+
+bodyView : List Position -> Svg Msg
+bodyView segments =
+ segments
+ |> List.map (segmentView 0.2 "green")
+ |> Svg.g []
+
+
+tailView : Position -> Svg Msg
+tailView =
+ segmentView 0.1 "green"
+
+
+segmentView : Float -> String -> Position -> Svg Msg
+segmentView size color ( x, y ) =
+ Svg.circle
+ [ -- I would prefer to have this unitless (after all we are using SVG
+ -- for scaling), but Firefox does not apply transition to SVG transform
+ -- attribute, and CSS property requires a unit.
+ Transformations.Translate "px"
+ (Basics.toFloat x * scale)
+ (Basics.toFloat y * scale)
+ |> Transformations.toString
+ |> Html.Attributes.style "transform"
+ , (size * scale)
+ |> String.fromFloat
+ |> Svg.Attributes.r
+ , Svg.Attributes.fill color
+ , Html.Attributes.style "transition" "transform 234ms linear"
+ ]
+ []
+
+
+letterView : ( Position, Char ) -> ( String, Svg Msg )
+letterView ( ( x, y ), letter ) =
+ let
+ key : String
+ key =
+ [ x, y ]
+ |> List.map String.fromInt
+ |> String.join "-"
+ in
+ letter
+ |> String.fromChar
+ |> Svg.text
+ |> List.singleton
+ |> Svg.text_
+ [ Transformations.Translate ""
+ (Basics.toFloat x * scale)
+ (Basics.toFloat y * scale)
+ |> Transformations.toString
+ |> Svg.Attributes.transform
+ , Html.Attributes.style "text-anchor" "middle"
+ , Html.Attributes.style "dominant-baseline" "middle"
+ , Svg.Attributes.width (scale |> String.fromFloat)
+ , Svg.Attributes.height (scale |> String.fromFloat)
+ , Svg.Attributes.fontSize (0.6 * scale |> String.fromFloat)
+ , Svg.Attributes.fontWeight "bold"
+ , Svg.Attributes.fill "currentColor"
+ ]
+ |> Tuple.pair key
+
+
+
+-- UPDATE
+
+
+type Msg
+ = Step Time.Posix
+ | KeyPressed (Maybe Keyboard.Key)
+ | TouchStarted Touch.Event
+ | TouchMoved Touch.Event
+ | TouchEnded Touch.Event
+ | TouchCanceled Touch.Event
+
+
+update : Msg -> Model -> ( Model, Cmd Msg )
+update msg model =
+ case msg of
+ Step _ ->
+ let
+ direction : Direction
+ direction =
+ model.swipe
+ |> Maybe.andThen swipeDirection
+ |> Maybe.withDefault model.snake.direction
+
+ ( letters, randomness ) =
+ model.letters
+ |> randomDecay 0.01
+ |> Random.andThen (randomSpawn 0.5 model.area needed)
+ |> (\generator -> Random.step generator model.randomness)
+
+ snake : Snake
+ snake =
+ model.snake
+ |> setDirection direction
+ |> moveSnake
+ |> updateSnake letters
+
+ needed : List Char
+ needed =
+ model.password.value
+ |> String.toUpper
+ |> String.toList
+ |> List.drop (String.length model.word)
+
+ wanted : Char
+ wanted =
+ needed
+ |> List.head
+ |> Maybe.withDefault '🔥'
+
+ word : String
+ word =
+ model.word
+ |> updateWord wanted snake letters
+ |> String.toUpper
+
+ burn : Bool
+ burn =
+ model |> passwordCollected |> not
+ in
+ ( { model
+ | letters =
+ letters
+ |> updateLetters wanted snake
+ |> burnTheEdge model.area burn
+ , randomness = randomness
+ , snake = snake
+ , word = word
+ , swipe = model.swipe |> Maybe.map (\swipe -> { swipe | from = swipe.to })
+ }
+ , Cmd.none
+ )
+
+ KeyPressed key ->
+ case key of
+ Nothing ->
+ ( model, Cmd.none )
+
+ Just Keyboard.ArrowUp ->
+ ( { model | snake = setDirection North model.snake }
+ , Cmd.none
+ )
+
+ Just (Keyboard.Character "W") ->
+ ( { model | snake = setDirection North model.snake }
+ , Cmd.none
+ )
+
+ Just Keyboard.ArrowRight ->
+ ( { model | snake = setDirection East model.snake }
+ , Cmd.none
+ )
+
+ Just (Keyboard.Character "D") ->
+ ( { model | snake = setDirection East model.snake }
+ , Cmd.none
+ )
+
+ Just Keyboard.ArrowDown ->
+ ( { model | snake = setDirection South model.snake }
+ , Cmd.none
+ )
+
+ Just (Keyboard.Character "S") ->
+ ( { model | snake = setDirection South model.snake }
+ , Cmd.none
+ )
+
+ Just Keyboard.ArrowLeft ->
+ ( { model | snake = setDirection West model.snake }
+ , Cmd.none
+ )
+
+ Just (Keyboard.Character "A") ->
+ ( { model | snake = setDirection West model.snake }
+ , Cmd.none
+ )
+
+ _ ->
+ ( model, Cmd.none )
+
+ TouchStarted event ->
+ case event.touches of
+ [] ->
+ -- This should never happen, but whatever!
+ ( { model | swipe = Nothing }
+ , Cmd.none
+ )
+
+ [ touch ] ->
+ ( { model
+ | swipe =
+ Just
+ { identifier = touch.identifier
+ , from = touch.clientPos
+ , to = touch.clientPos
+ }
+ }
+ , Cmd.none
+ )
+
+ _ ->
+ -- We do not support multiple touches. Cancel the swipe.
+ ( { model | swipe = Nothing }
+ , Cmd.none
+ )
+
+ TouchMoved event ->
+ case event.touches of
+ [] ->
+ -- This should never happen, but whatever!
+ ( { model | swipe = Nothing }
+ , Cmd.none
+ )
+
+ [ touch ] ->
+ case model.swipe of
+ Nothing ->
+ -- This also shouldn't really happen. Surely there was a touch start some time before!
+ ( { model
+ | swipe =
+ Just
+ { identifier = touch.identifier
+ , from = touch.clientPos
+ , to = touch.clientPos
+ }
+ }
+ , Cmd.none
+ )
+
+ Just swipe ->
+ if swipe.identifier == touch.identifier then
+ ( { model
+ | swipe =
+ Just
+ { swipe | to = touch.clientPos }
+ }
+ , Cmd.none
+ )
+
+ else
+ -- There is a swipe, but from a different touch? That is weird. I guess we should start a new swipe then.
+ ( { model
+ | swipe =
+ Just
+ { identifier = touch.identifier
+ , from = touch.clientPos
+ , to = touch.clientPos
+ }
+ }
+ , Cmd.none
+ )
+
+ _ ->
+ -- We do not support multiple touches. Cancel the swipe.
+ ( { model | swipe = Nothing }
+ , Cmd.none
+ )
+
+ TouchEnded event ->
+ case event.changedTouches of
+ [] ->
+ -- This should never happen, but whatever!
+ ( { model | swipe = Nothing }
+ , Cmd.none
+ )
+
+ [ touch ] ->
+ case model.swipe of
+ Nothing ->
+ -- This also shouldn't really happen. Surely there was a touch start some time before! Not much we can do here.
+ -- TODO: Report an error.
+ ( model
+ , Cmd.none
+ )
+
+ Just swipe ->
+ if swipe.identifier == touch.identifier then
+ ( { model
+ | swipe = Nothing
+ , snake =
+ { swipe | to = touch.clientPos }
+ |> swipeDirection
+ |> Maybe.map (\direction -> setDirection direction model.snake)
+ |> Maybe.withDefault model.snake
+ }
+ , Cmd.none
+ )
+
+ else
+ -- There is a swipe, but from a different touch? That is weird. I guess we should start a new swipe then.
+ ( { model
+ | swipe =
+ Just
+ { identifier = touch.identifier
+ , from = touch.clientPos
+ , to = touch.clientPos
+ }
+ }
+ , Cmd.none
+ )
+
+ _ ->
+ -- We do not support multiple touches. Cancel the swipe.
+ ( { model | swipe = Nothing }
+ , Cmd.none
+ )
+
+ TouchCanceled _ ->
+ ( { model
+ | swipe = Nothing
+ }
+ , Cmd.none
+ )
+
+
+
+-- SUBSCRIPTIONS
+
+
+subscriptions : Model -> Sub Msg
+subscriptions _ =
+ let
+ decodeKeydown : Decode.Value -> Msg
+ decodeKeydown event =
+ event
+ |> Decode.decodeValue Keyboard.eventKeyDecoder
+ |> Result.toMaybe
+ |> Maybe.andThen Keyboard.anyKeyUpper
+ |> KeyPressed
+ in
+ [ Time.every 250 Step
+ , keydown decodeKeydown
+ ]
+ |> Sub.batch
+
+
+
+-- UTILS
+
+
+burnTheEdge : Area -> Bool -> Letters -> Letters
+burnTheEdge area burn letters =
+ let
+ edge : List Position
+ edge =
+ List.concat
+ [ northEdge
+ , eastEdge
+ , southEdge
+ , westEdge
+ ]
+
+ northEdge : List Position
+ northEdge =
+ (area.width + 1)
+ |> List.range -1
+ |> List.map (\x -> ( x, -1 ))
+
+ eastEdge : List Position
+ eastEdge =
+ (area.height + 1)
+ |> List.range -1
+ |> List.map (\y -> ( area.width + 1, y ))
+
+ southEdge : List Position
+ southEdge =
+ (area.width + 1)
+ |> List.range -1
+ |> List.map (\x -> ( x, area.height + 1 ))
+
+ westEdge : List Position
+ westEdge =
+ (area.height + 1)
+ |> List.range -1
+ |> List.map (\y -> ( -1, y ))
+
+ setOnFire : Position -> Letters -> Letters
+ setOnFire position =
+ Dict.insert position '🔥'
+ in
+ if burn then
+ edge
+ |> List.foldl setOnFire letters
+
+ else
+ letters
+
+
+updateSnake : Letters -> Snake -> Snake
+updateSnake letters snake =
+ case Dict.get snake.head letters of
+ Nothing ->
+ snake
+
+ Just '🔥' ->
+ { snake | alive = False }
+
+ Just '💩' ->
+ { snake | alive = False }
+
+ Just _ ->
+ { snake | body = snake.head :: snake.body }
+
+
+updateWord : Char -> Snake -> Letters -> String -> String
+updateWord wanted snake letters word =
+ case Dict.get snake.head letters of
+ Nothing ->
+ word
+
+ Just letter ->
+ if letter == wanted then
+ word
+ |> String.reverse
+ |> String.cons letter
+ |> String.reverse
+
+ else
+ word
+
+
+updateLetters : Char -> Snake -> Letters -> Letters
+updateLetters wanted snake letters =
+ letters
+ |> Dict.update snake.head (updateLetter wanted)
+
+
+updateLetter : Char -> Maybe Char -> Maybe Char
+updateLetter wanted letter =
+ case letter of
+ Nothing ->
+ Nothing
+
+ Just '🔥' ->
+ letter
+
+ Just c ->
+ if c == wanted then
+ Nothing
+
+ else
+ Just '💩'
+
+
+
+-- game state predicates
+
+
+passwordCollected : Model -> Bool
+passwordCollected model =
+ String.toUpper model.word == String.toUpper model.password.value
+
+
+snakeEscaped : Model -> Bool
+snakeEscaped model =
+ model.snake.alive && isOutside model.area model.snake.head
+
+
+isOutside : Area -> Position -> Bool
+isOutside area ( x, y ) =
+ (x < 0) || (x > area.width) || (y < 0) || (y > area.height)
+
+
+
+-- direction helpers
+
+
+swipeDirection : Swipe -> Maybe Direction
+swipeDirection swipe =
+ let
+ threshold =
+ 1.0
+
+ ( fromX, fromY ) =
+ swipe.from
+
+ ( toX, toY ) =
+ swipe.to
+
+ ( relativeX, relativeY ) =
+ ( toX - fromX, toY - fromY )
+ in
+ if Basics.abs relativeX < threshold || Basics.abs relativeY < threshold then
+ Nothing
+
+ else
+ Just <|
+ if Basics.abs relativeX < Basics.abs relativeY then
+ -- north or south
+ if relativeY > 0 then
+ South
+
+ else
+ North
+
+ else
+ -- east or west
+ if
+ relativeX > 0
+ then
+ East
+
+ else
+ West
+
+
+setDirection : Direction -> Snake -> Snake
+setDirection direction snake =
+ let
+ neck : Position
+ neck =
+ case snake.body of
+ [] ->
+ -- The snake has no body - only head and tail. The tail is the neck!
+ snake.tail
+
+ belly :: [] ->
+ -- The snake has a single body segment. Let's call it a belly, but it's also a neck!
+ belly
+
+ torso :: belly :: _ ->
+ -- The snake is looooong now. It has torso, belly and the rest.
+ if torso == snake.head then
+ -- Immediately after swallowing a letter a new segment
+ -- is placed where the head is. This will become neck
+ -- soon. But until the head moves away we have to
+ -- consider the secod segment of the body (i.e. the
+ -- belly) as the neck. Otherwise it would be possible to
+ -- reverse the direction and break the neck.
+ belly
+
+ else
+ torso
+ in
+ if moveSegment direction snake.head == neck then
+ snake
+
+ else
+ { snake | direction = direction }
+
+
+
+-- snake movement
+
+
+moveSnake : Snake -> Snake
+moveSnake snake =
+ let
+ head : Position
+ head =
+ moveSegment snake.direction snake.head
+
+ body : List Position
+ body =
+ snake.body
+ |> List.foldl moveSegments ( snake.head, [] )
+ |> Tuple.second
+ |> List.reverse
+
+ tail : Position
+ tail =
+ snake.body
+ |> List.reverse
+ |> List.head
+ |> Maybe.withDefault snake.head
+
+ moveSegments : Position -> ( Position, List Position ) -> ( Position, List Position )
+ moveSegments segment ( target, segments ) =
+ ( segment, target :: segments )
+
+ alive : Bool
+ alive =
+ List.member head body |> not
+ in
+ if snake.alive then
+ { head = head
+ , body = body
+ , tail = tail
+ , alive = alive
+ , direction = snake.direction
+ }
+
+ else
+ snake
+
+
+moveSegment : Direction -> Position -> Position
+moveSegment direction ( x, y ) =
+ case direction of
+ North ->
+ ( x, y - 1 )
+
+ East ->
+ ( x + 1, y )
+
+ South ->
+ ( x, y + 1 )
+
+ West ->
+ ( x - 1, y )
+
+
+
+-- random generators
+
+
+randomLetter : List Char -> Random.Generator Char
+randomLetter promoted =
+ let
+ weights : List Float
+ weights =
+ Password.charset
+ |> List.map
+ (\letter ->
+ if List.member letter promoted then
+ 2
+
+ else
+ 1
+ )
+
+ weightmap =
+ List.map2 Tuple.pair weights Password.charset
+ in
+ Random.weighted ( 1, '🔥' ) weightmap
+
+
+randomPosition : Area -> Random.Generator Position
+randomPosition area =
+ Random.map2 Tuple.pair
+ (Random.int 0 area.width)
+ (Random.int 0 area.height)
+
+
+randomBoolean : Float -> Random.Generator Bool
+randomBoolean probability =
+ Random.weighted
+ ( probability, True )
+ [ ( 1 - probability, False ) ]
+
+
+randomSpawn :
+ Float
+ -> Area
+ -> List Char
+ -> Letters
+ -> Random.Generator Letters
+randomSpawn probability area needed letters =
+ let
+ perform : Bool -> Position -> Char -> Letters
+ perform spawn position letter =
+ if spawn then
+ Dict.insert position letter letters
+
+ else
+ letters
+ in
+ Random.map3 perform
+ (randomBoolean probability)
+ (randomPosition area)
+ (randomLetter needed)
+
+
+randomDecay : Float -> Dict comparable v -> Random.Generator (Dict comparable v)
+randomDecay probability dict =
+ Random.list (Dict.size dict) (randomBoolean probability)
+ |> Random.map (\decayList -> decay decayList dict)
+
+
+decay : List Bool -> Dict comparable v -> Dict comparable v
+decay decayList dict =
+ let
+ maybeAnnihilate : Bool -> a -> Maybe a
+ maybeAnnihilate annihilate value =
+ if annihilate then
+ Nothing
+
+ else
+ Just value
+ in
+ dict
+ |> Dict.toList
+ |> List.map2 maybeAnnihilate decayList
+ |> Maybe.values
+ |> Dict.fromListindex ec658aa..db62a4d 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -1,25 +1,12 @@
-port module Main exposing (Model, Msg, init, main, subscriptions, update, view)
+module Main exposing (Model, Msg, init, main, subscriptions, update, view)
=
=import Browser
-import Dict exposing (Dict)
+import Game
=import Html exposing (Html)
=import Html.Attributes
=import Html.Events
-import Html.Events.Extra.Touch as Touch exposing (Touch)
-import Json.Decode as Decode
-import Keyboard
-import Maybe.Extra as Maybe
-import Password exposing (Password, passwords)
+import Password exposing (Password)
=import Random
-import Svg exposing (Svg)
-import Svg.Attributes
-import Svg.Keyed
-import Task
-import Time
-import Transformations
-
-
-port keydown : (Decode.Value -> msg) -> Sub msg
=
=
=main : Program Flags Model Msg
@@ -33,55 +20,11 @@ main =
=
=
=type alias Model =
- { area : Area
- , letters : Letters
- , snake : Snake
- , password : Password
- , word : String
- , randomness : Random.Seed
- , swipe : Maybe Swipe
+ { game : Maybe Game.Model
+ , levels : List Password
= }
=
=
-type alias Swipe =
- { identifier : Int
- , from : ( Float, Float )
- , to : ( Float, Float )
- }
-
-
-type alias Area =
- { width : Int
- , height : Int
- }
-
-
-type alias Letters =
- Dict Position Char
-
-
-type alias Position =
- ( Int
- , Int
- )
-
-
-type alias Snake =
- { head : Position
- , body : List Position
- , tail : Position
- , direction : Direction
- , alive : Bool
- }
-
-
-type Direction
- = North
- | East
- | South
- | West
-
-
=
=-- INIT
=
@@ -92,227 +35,141 @@ type alias Flags =
=
=init : Flags -> ( Model, Cmd Msg )
=init _ =
- ( { area = Area 16 16
- , letters = Dict.empty
- , snake =
- { head = ( 0, 0 )
- , body = List.repeat 5 ( 0, 0 )
- , tail = ( 0, 0 )
- , direction = East
- , alive = True
- }
- , password =
- -- An impossible challenge
- Password "" " " ""
- , word = ""
- , randomness =
- Random.initialSeed 0
- , swipe = Nothing
+ ( { game = Nothing
+ , levels = Password.passwords
= }
- , [ Random.generate GotNewPassword randomPassword
- , Time.now |> Task.perform GotTime
- ]
- |> Cmd.batch
+ , Cmd.none
= )
=
=
+view : Model -> Html Msg
+view model =
+ case model.game of
+ Nothing ->
+ introView
=
--- VIEW
-
-
-{-| In view scale everything by an arbitrary factor.
-
-In the model everything is positioned on a 1 x 1 grid, but Chromium and Android
-Web View have problems with this setup. So in the view all values (positions,
-sizes, font sizes, etc.) are scaled up by this factor. This is just a workaround
-and has nothing to do with game logic.
-
--}
-scale : number
-scale =
- 1000
+ Just game ->
+ [ gameView game
+ , popupView game
+ ]
+ |> Html.div
+ [ Html.Attributes.style "height" "100%"
+ , Html.Attributes.style "width" "100%"
+ , Html.Attributes.style "aling-self" "center"
+ ]
=
=
-view : Model -> Html Msg
-view model =
+introView : Html Msg
+introView =
= Html.div
- [ Html.Attributes.style "width" "100%"
- , Html.Attributes.style "height" "100%"
- , Html.Attributes.style "display" "flex"
- , Html.Attributes.style "flex-direction" "column"
- , Touch.onStart TouchStarted
- , Touch.onEnd TouchEnded
- , Touch.onMove TouchMoved
- , Touch.onCancel TouchCanceled
+ [ Html.Attributes.style "text-align" "center"
+ , Html.Attributes.style "max-width" "640px"
+ , Html.Attributes.style "padding" "2rem"
+ , Html.Attributes.style "line-height" "150%"
= ]
- [ Html.h1
- [ Html.Attributes.style "text-align" "center"
- , Html.Attributes.style "font-size" "1rem"
+ [ Html.div []
+ [ Html.h1 [] [ Html.text "Save the snake!" ]
+ , Html.p [] [ Html.text "Guess the password. Use W A S D (or swipe 👆) to move around and collect the letters to fill the missing word. Once the password is collected you will be able to escape the fire trap." ]
+ , Html.p [ Html.Attributes.style "font-size" "2rem" ] [ Html.text "🐍" ]
+ , Html.p [] [ Html.text "The most important: avoid fire and poop." ]
+ , Html.button
+ [ Html.Events.onClick StartButtonClicked
+ , Html.Attributes.autofocus True
+ , Html.Attributes.style "height" "8rem"
+ , Html.Attributes.style "width" "8rem"
+ , Html.Attributes.style "font-size" "1.2rem"
+ , Html.Attributes.style "font-weight" "bold"
+ ]
+ [ Html.text "Start" ]
= ]
- [ Html.text model.password.intro
- , Html.span
- [ Html.Attributes.style "background" <|
- if passwordCollected model then
- "lightgreen"
-
- else
- "lightyellow"
- , Html.Attributes.style "padding" "0.2em"
+ , Html.footer [ Html.Attributes.style "font-size" "0.8rem" ]
+ [ Html.p []
+ [ Html.text "Made by "
+ , Html.a
+ [ Html.Attributes.href "https://tad-lispy.com/" ]
+ [ Html.text "Tad Lispy" ]
+ , Html.text ". "
= ]
- [ if String.isEmpty model.word then
- Html.text "..."
-
- else
- Html.text model.word
+ , Html.p []
+ [ Html.text "This game is a "
+ , Html.strong []
+ [ Html.text "free software" ]
+ , Html.text ". You may copy, modify, redistribute it etc. under the terms of "
+ , Html.a
+ [ Html.Attributes.href "https://www.gnu.org/licenses/gpl-3.0.html"
+ , Html.Attributes.target "_blank"
+ ]
+ [ Html.text "the GNU General Public License v. 3.0" ]
+ , Html.text " or later. "
+ , Html.a [ Html.Attributes.href "https://gitlab.com/hornbook/word-snake/" ]
+ [ Html.text "See the source code" ]
+ , Html.text ". Have fun! "
= ]
- , Html.text model.password.outro
= ]
- , areaView model.area model.letters model.snake
- , Html.div
- [ Html.Attributes.style "text-align" "center"
- , Html.Attributes.style "padding" "1rem"
- ]
- <|
- if model.snake.alive then
- if snakeEscaped model then
- [ Html.p [] [ Html.text "Bravo! The snake is safe." ]
- , Html.button [ Html.Events.onClick PlayAgainButtonClicked ] [ Html.text "Play again" ]
- ]
+ ]
=
- else if passwordCollected model then
- [ Html.p [] [ Html.text "That's correct!" ]
- , Html.p [] [ Html.text " Now help the snake escape to safety." ]
- ]
=
- else
- [ Html.p [] [ Html.text "Save the snake! Guess the password." ]
- , Html.p [] [ Html.text "Use W A S D (or swipe 👆) to move around." ]
- , Html.p [] [ Html.text "Collect the letters and then escape the fire trap. Avoid fire and poop!" ]
- ]
-
- else
- [ Html.p [] [ Html.text "Oh, no! Your snake is dead." ]
- , Html.button [ Html.Events.onClick PlayAgainButtonClicked ] [ Html.text "Play again" ]
- ]
- ]
+gameView : Game.Model -> Html Msg
+gameView game =
+ game
+ |> Game.view
+ |> Html.map GotGameMsg
=
=
-areaView : Area -> Letters -> Snake -> Html Msg
-areaView area letters snake =
+popupView : Game.Model -> Html Msg
+popupView game =
= let
- viewbox : String
- viewbox =
- [ -2 * scale
- , -2 * scale
- , (area.width + 4) * scale
- , (area.height + 4) * scale
- ]
- |> List.map String.fromInt
- |> String.join " "
+ popup : List (Html Msg) -> Html Msg
+ popup elements =
+ elements
+ |> Html.div
+ [ Html.Attributes.style "text-align" "center"
+ , Html.Attributes.style "padding" "4rem"
+ , Html.Attributes.style "background" "hsl(0, 0%, 86%)"
+ , Html.Attributes.style "border-radius" "10px"
+ , Html.Attributes.style "box-shadow" "-2px -2px 6px 0 hsla(0, 0%, 0%, 20%)"
+ ]
+ |> List.singleton
+ |> Html.div
+ [ Html.Attributes.style "position" "absolute"
+ , Html.Attributes.style "inset" "0"
+ , Html.Attributes.style "display" "flex"
+ , Html.Attributes.style "align-items" "center"
+ , Html.Attributes.style "justify-content" "center"
+ ]
= in
- [ snakeView snake
- , lettersView letters
- ]
- |> Svg.svg
- [ Svg.Attributes.viewBox viewbox
- ]
-
-
-lettersView : Letters -> Svg Msg
-lettersView letters =
- letters
- |> Dict.toList
- |> List.map letterView
- |> Svg.Keyed.node "g"
- [ Html.Attributes.style "pointer-events" "none"
+ if Game.snakeEscaped game then
+ popup
+ [ Html.h2 [] [ Html.text "🙏" ]
+ , Html.p [] [ Html.text "Bravo! The snake is safe." ]
+ , Html.button
+ [ Html.Events.onClick PlayAgainButtonClicked
+ , Html.Attributes.autofocus True
+ , Html.Attributes.style "height" "8rem"
+ , Html.Attributes.style "width" "8rem"
+ , Html.Attributes.style "font-size" "1.2rem"
+ , Html.Attributes.style "font-weight" "bold"
+ ]
+ [ Html.text "Play again" ]
= ]
=
-
-snakeView : Snake -> Svg Msg
-snakeView snake =
- [ headView snake.alive snake.head
- , bodyView snake.body
- , tailView snake.tail
- ]
- |> Svg.g
- [ Html.Attributes.style "pointer-events" "none"
+ else if not game.snake.alive then
+ popup
+ [ Html.h2 [] [ Html.text "☠️" ]
+ , Html.p [] [ Html.text "Oh, no! Your snake is dead." ]
+ , Html.button
+ [ Html.Events.onClick PlayAgainButtonClicked
+ , Html.Attributes.autofocus True
+ , Html.Attributes.style "height" "8rem"
+ , Html.Attributes.style "width" "8rem"
+ , Html.Attributes.style "font-size" "1.2rem"
+ , Html.Attributes.style "font-weight" "bold"
+ ]
+ [ Html.text "Play again" ]
= ]
=
-
-headView : Bool -> Position -> Svg Msg
-headView alive =
- let
- color : String
- color =
- if alive then
- "green"
-
- else
- "black"
- in
- segmentView 0.3 color
-
-
-bodyView : List Position -> Svg Msg
-bodyView segments =
- segments
- |> List.map (segmentView 0.2 "green")
- |> Svg.g []
-
-
-tailView : Position -> Svg Msg
-tailView =
- segmentView 0.1 "green"
-
-
-segmentView : Float -> String -> Position -> Svg Msg
-segmentView size color ( x, y ) =
- Svg.circle
- [ -- I would prefer to have this unitless (after all we are using SVG
- -- for scaling), but Firefox does not apply transition to SVG transform
- -- attribute, and CSS property requires a unit.
- Transformations.Translate "px"
- (Basics.toFloat x * scale)
- (Basics.toFloat y * scale)
- |> Transformations.toString
- |> Html.Attributes.style "transform"
- , (size * scale)
- |> String.fromFloat
- |> Svg.Attributes.r
- , Svg.Attributes.fill color
- , Html.Attributes.style "transition" "transform 234ms linear"
- ]
- []
-
-
-letterView : ( Position, Char ) -> ( String, Svg Msg )
-letterView ( ( x, y ), letter ) =
- let
- key : String
- key =
- [ x, y ]
- |> List.map String.fromInt
- |> String.join "-"
- in
- letter
- |> String.fromChar
- |> Svg.text
- |> List.singleton
- |> Svg.text_
- [ Transformations.Translate ""
- (Basics.toFloat x * scale)
- (Basics.toFloat y * scale)
- |> Transformations.toString
- |> Svg.Attributes.transform
- , Html.Attributes.style "text-anchor" "middle"
- , Html.Attributes.style "dominant-baseline" "middle"
- , Svg.Attributes.width (scale |> String.fromFloat)
- , Svg.Attributes.height (scale |> String.fromFloat)
- , Svg.Attributes.fontSize (0.6 * scale |> String.fromFloat)
- , Svg.Attributes.fontWeight "bold"
- , Svg.Attributes.fill "currentColor"
- ]
- |> Tuple.pair key
+ else
+ Html.div [] []
=
=
=
@@ -320,571 +177,82 @@ letterView ( ( x, y ), letter ) =
=
=
=type Msg
- = GotTime Time.Posix
- | GotNewPassword Password
- | Step Time.Posix
- | KeyPressed (Maybe Keyboard.Key)
- | TouchStarted Touch.Event
- | TouchMoved Touch.Event
- | TouchEnded Touch.Event
- | TouchCanceled Touch.Event
+ = StartButtonClicked
+ | GotGameMsg Game.Msg
+ | GotRandomGameFlags Password Random.Seed
= | PlayAgainButtonClicked
=
=
=update : Msg -> Model -> ( Model, Cmd Msg )
=update msg model =
= case msg of
- GotTime time ->
- ( { model
- | randomness =
- time
- |> Time.posixToMillis
- |> Random.initialSeed
- }
- , Cmd.none
+ StartButtonClicked ->
+ ( model
+ , generateRandomGameFlags GotRandomGameFlags model.levels
= )
=
- GotNewPassword password ->
- ( { model | password = password }
- , Cmd.none
- )
-
- Step _ ->
- let
- direction : Direction
- direction =
- model.swipe
- |> Maybe.andThen swipeDirection
- |> Maybe.withDefault model.snake.direction
-
- ( letters, randomness ) =
- model.letters
- |> randomDecay 0.01
- |> Random.andThen (randomSpawn 0.5 model.area needed)
- |> (\generator -> Random.step generator model.randomness)
-
- snake : Snake
- snake =
- model.snake
- |> setDirection direction
- |> moveSnake
- |> updateSnake letters
-
- needed : List Char
- needed =
- model.password.value
- |> String.toUpper
- |> String.toList
- |> List.drop (String.length model.word)
-
- wanted : Char
- wanted =
- needed
- |> List.head
- |> Maybe.withDefault '🔥'
-
- word : String
- word =
- model.word
- |> updateWord wanted snake letters
- |> String.toUpper
-
- burn : Bool
- burn =
- model |> passwordCollected |> not
- in
- ( { model
- | letters =
- letters
- |> updateLetters wanted snake
- |> burnTheEdge model.area burn
- , randomness = randomness
- , snake = snake
- , word = word
- , swipe = model.swipe |> Maybe.map (\swipe -> { swipe | from = swipe.to })
- }
- , Cmd.none
+ PlayAgainButtonClicked ->
+ ( model
+ , generateRandomGameFlags GotRandomGameFlags model.levels
= )
=
- KeyPressed key ->
- case key of
+ GotGameMsg gameMsg ->
+ case model.game of
= Nothing ->
= ( model, Cmd.none )
=
- Just Keyboard.ArrowUp ->
- ( { model | snake = setDirection North model.snake }
- , Cmd.none
- )
-
- Just (Keyboard.Character "W") ->
- ( { model | snake = setDirection North model.snake }
- , Cmd.none
- )
-
- Just Keyboard.ArrowRight ->
- ( { model | snake = setDirection East model.snake }
- , Cmd.none
- )
-
- Just (Keyboard.Character "D") ->
- ( { model | snake = setDirection East model.snake }
- , Cmd.none
- )
-
- Just Keyboard.ArrowDown ->
- ( { model | snake = setDirection South model.snake }
- , Cmd.none
- )
-
- Just (Keyboard.Character "S") ->
- ( { model | snake = setDirection South model.snake }
- , Cmd.none
- )
-
- Just Keyboard.ArrowLeft ->
- ( { model | snake = setDirection West model.snake }
- , Cmd.none
- )
-
- Just (Keyboard.Character "A") ->
- ( { model | snake = setDirection West model.snake }
- , Cmd.none
- )
-
- _ ->
- ( model, Cmd.none )
-
- TouchStarted event ->
- case event.touches of
- [] ->
- -- This should never happen, but whatever!
- ( { model | swipe = Nothing }
- , Cmd.none
- )
-
- [ touch ] ->
+ Just game ->
+ let
+ ( updatedGame, gameCmd ) =
+ Game.update gameMsg game
+ in
= ( { model
- | swipe =
- Just
- { identifier = touch.identifier
- , from = touch.clientPos
- , to = touch.clientPos
- }
+ | game = Just updatedGame
= }
- , Cmd.none
- )
-
- _ ->
- -- We do not support multiple touches. Cancel the swipe.
- ( { model | swipe = Nothing }
- , Cmd.none
- )
-
- TouchMoved event ->
- case event.touches of
- [] ->
- -- This should never happen, but whatever!
- ( { model | swipe = Nothing }
- , Cmd.none
- )
-
- [ touch ] ->
- case model.swipe of
- Nothing ->
- -- This also shouldn't really happen. Surely there was a touch start some time before!
- ( { model
- | swipe =
- Just
- { identifier = touch.identifier
- , from = touch.clientPos
- , to = touch.clientPos
- }
- }
- , Cmd.none
- )
-
- Just swipe ->
- if swipe.identifier == touch.identifier then
- ( { model
- | swipe =
- Just
- { swipe | to = touch.clientPos }
- }
- , Cmd.none
- )
-
- else
- -- There is a swipe, but from a different touch? That is weird. I guess we should start a new swipe then.
- ( { model
- | swipe =
- Just
- { identifier = touch.identifier
- , from = touch.clientPos
- , to = touch.clientPos
- }
- }
- , Cmd.none
- )
-
- _ ->
- -- We do not support multiple touches. Cancel the swipe.
- ( { model | swipe = Nothing }
- , Cmd.none
- )
-
- TouchEnded event ->
- case event.changedTouches of
- [] ->
- -- This should never happen, but whatever!
- ( { model | swipe = Nothing }
- , Cmd.none
- )
-
- [ touch ] ->
- case model.swipe of
- Nothing ->
- -- This also shouldn't really happen. Surely there was a touch start some time before! Not much we can do here.
- -- TODO: Report an error.
- ( model
- , Cmd.none
- )
-
- Just swipe ->
- if swipe.identifier == touch.identifier then
- ( { model
- | swipe = Nothing
- , snake =
- { swipe | to = touch.clientPos }
- |> swipeDirection
- |> Maybe.map (\direction -> setDirection direction model.snake)
- |> Maybe.withDefault model.snake
- }
- , Cmd.none
- )
-
- else
- -- There is a swipe, but from a different touch? That is weird. I guess we should start a new swipe then.
- ( { model
- | swipe =
- Just
- { identifier = touch.identifier
- , from = touch.clientPos
- , to = touch.clientPos
- }
- }
- , Cmd.none
- )
-
- _ ->
- -- We do not support multiple touches. Cancel the swipe.
- ( { model | swipe = Nothing }
- , Cmd.none
+ , Cmd.map GotGameMsg gameCmd
= )
=
- TouchCanceled _ ->
+ GotRandomGameFlags password randomness ->
= ( { model
- | swipe = Nothing
+ | game =
+ { password = password
+ , randomness = randomness
+ , area = Game.Area 16 16
+ , charset = Password.charset
+ }
+ |> Game.init
+ |> Just
= }
= , Cmd.none
= )
=
- PlayAgainButtonClicked ->
- init ()
-
=
=
=-- SUBSCRIPTIONS
=
=
=subscriptions : Model -> Sub Msg
-subscriptions _ =
- let
- decodeKeydown : Decode.Value -> Msg
- decodeKeydown event =
- event
- |> Decode.decodeValue Keyboard.eventKeyDecoder
- |> Result.toMaybe
- |> Maybe.andThen Keyboard.anyKeyUpper
- |> KeyPressed
- in
- [ Time.every 250 Step
- , keydown decodeKeydown
- ]
- |> Sub.batch
-
-
-
--- UTILS
-
-
-burnTheEdge : Area -> Bool -> Letters -> Letters
-burnTheEdge area burn letters =
- let
- edge : List Position
- edge =
- List.concat
- [ northEdge
- , eastEdge
- , southEdge
- , westEdge
- ]
-
- northEdge : List Position
- northEdge =
- (area.width + 1)
- |> List.range -1
- |> List.map (\x -> ( x, -1 ))
-
- eastEdge : List Position
- eastEdge =
- (area.height + 1)
- |> List.range -1
- |> List.map (\y -> ( area.width + 1, y ))
-
- southEdge : List Position
- southEdge =
- (area.width + 1)
- |> List.range -1
- |> List.map (\x -> ( x, area.height + 1 ))
-
- westEdge : List Position
- westEdge =
- (area.height + 1)
- |> List.range -1
- |> List.map (\y -> ( -1, y ))
-
- setOnFire : Position -> Letters -> Letters
- setOnFire position =
- Dict.insert position '🔥'
- in
- if burn then
- edge
- |> List.foldl setOnFire letters
-
- else
- letters
-
-
-updateSnake : Letters -> Snake -> Snake
-updateSnake letters snake =
- case Dict.get snake.head letters of
- Nothing ->
- snake
-
- Just '🔥' ->
- { snake | alive = False }
-
- Just '💩' ->
- { snake | alive = False }
-
- Just _ ->
- { snake | body = snake.head :: snake.body }
-
-
-updateWord : Char -> Snake -> Letters -> String -> String
-updateWord wanted snake letters word =
- case Dict.get snake.head letters of
- Nothing ->
- word
-
- Just letter ->
- if letter == wanted then
- word
- |> String.reverse
- |> String.cons letter
- |> String.reverse
+subscriptions model =
+ model.game
+ |> Maybe.map Game.subscriptions
+ |> Maybe.map (Sub.map GotGameMsg)
+ |> Maybe.withDefault Sub.none
=
- else
- word
=
=
-updateLetters : Char -> Snake -> Letters -> Letters
-updateLetters wanted snake letters =
- letters
- |> Dict.update snake.head (updateLetter wanted)
+-- HELPERS
=
=
-updateLetter : Char -> Maybe Char -> Maybe Char
-updateLetter wanted letter =
- case letter of
- Nothing ->
- Nothing
-
- Just '🔥' ->
- letter
-
- Just c ->
- if c == wanted then
- Nothing
-
- else
- Just '💩'
-
-
-
--- game state predicates
-
-
-passwordCollected : Model -> Bool
-passwordCollected model =
- String.toUpper model.word == String.toUpper model.password.value
-
-
-snakeEscaped : Model -> Bool
-snakeEscaped model =
- model.snake.alive && isOutside model.area model.snake.head
-
-
-isOutside : Area -> Position -> Bool
-isOutside area ( x, y ) =
- (x < 0) || (x > area.width) || (y < 0) || (y > area.height)
-
-
-
--- direction helpers
-
-
-swipeDirection : Swipe -> Maybe Direction
-swipeDirection swipe =
- let
- threshold =
- 1.0
-
- ( fromX, fromY ) =
- swipe.from
-
- ( toX, toY ) =
- swipe.to
-
- ( relativeX, relativeY ) =
- ( toX - fromX, toY - fromY )
- in
- if Basics.abs relativeX < threshold || Basics.abs relativeY < threshold then
- Nothing
-
- else
- Just <|
- if Basics.abs relativeX < Basics.abs relativeY then
- -- north or south
- if relativeY > 0 then
- South
+generateRandomGameFlags : (Password -> Random.Seed -> msg) -> List Password -> Cmd msg
+generateRandomGameFlags tagger passwords =
+ Random.map2 tagger
+ (randomPassword passwords)
+ Random.independentSeed
+ |> Random.generate identity
=
- else
- North
=
- else
- -- east or west
- if
- relativeX > 0
- then
- East
-
- else
- West
-
-
-setDirection : Direction -> Snake -> Snake
-setDirection direction snake =
- let
- neck : Position
- neck =
- case snake.body of
- [] ->
- -- The snake has no body - only head and tail. The tail is the neck!
- snake.tail
-
- belly :: [] ->
- -- The snake has a single body segment. Let's call it a belly, but it's also a neck!
- belly
-
- torso :: belly :: _ ->
- -- The snake is looooong now. It has torso, belly and the rest.
- if torso == snake.head then
- -- Immediately after swallowing a letter a new segment
- -- is placed where the head is. This will become neck
- -- soon. But until the head moves away we have to
- -- consider the secod segment of the body (i.e. the
- -- belly) as the neck. Otherwise it would be possible to
- -- reverse the direction and break the neck.
- belly
-
- else
- torso
- in
- if moveSegment direction snake.head == neck then
- snake
-
- else
- { snake | direction = direction }
-
-
-
--- snake movement
-
-
-moveSnake : Snake -> Snake
-moveSnake snake =
- let
- head : Position
- head =
- moveSegment snake.direction snake.head
-
- body : List Position
- body =
- snake.body
- |> List.foldl moveSegments ( snake.head, [] )
- |> Tuple.second
- |> List.reverse
-
- tail : Position
- tail =
- snake.body
- |> List.reverse
- |> List.head
- |> Maybe.withDefault snake.head
-
- moveSegments : Position -> ( Position, List Position ) -> ( Position, List Position )
- moveSegments segment ( target, segments ) =
- ( segment, target :: segments )
-
- alive : Bool
- alive =
- List.member head body |> not
- in
- if snake.alive then
- { head = head
- , body = body
- , tail = tail
- , alive = alive
- , direction = snake.direction
- }
-
- else
- snake
-
-
-moveSegment : Direction -> Position -> Position
-moveSegment direction ( x, y ) =
- case direction of
- North ->
- ( x, y - 1 )
-
- East ->
- ( x + 1, y )
-
- South ->
- ( x, y + 1 )
-
- West ->
- ( x - 1, y )
-
-
-
--- random generators
-
-
-randomPassword : Random.Generator Password
-randomPassword =
+randomPassword : List Password -> Random.Generator Password
+randomPassword passwords =
= Random.uniform
= (Password
= "A slithering animal is called a "
@@ -892,84 +260,3 @@ randomPassword =
= "."
= )
= passwords
-
-
-randomLetter : List Char -> Random.Generator Char
-randomLetter promoted =
- let
- weights : List Float
- weights =
- Password.charset
- |> List.map
- (\letter ->
- if List.member letter promoted then
- 2
-
- else
- 1
- )
-
- weightmap =
- List.map2 Tuple.pair weights Password.charset
- in
- Random.weighted ( 1, '🔥' ) weightmap
-
-
-randomPosition : Area -> Random.Generator Position
-randomPosition area =
- Random.map2 Tuple.pair
- (Random.int 0 area.width)
- (Random.int 0 area.height)
-
-
-randomBoolean : Float -> Random.Generator Bool
-randomBoolean probability =
- Random.weighted
- ( probability, True )
- [ ( 1 - probability, False ) ]
-
-
-randomSpawn :
- Float
- -> Area
- -> List Char
- -> Letters
- -> Random.Generator Letters
-randomSpawn probability area needed letters =
- let
- perform : Bool -> Position -> Char -> Letters
- perform spawn position letter =
- if spawn then
- Dict.insert position letter letters
-
- else
- letters
- in
- Random.map3 perform
- (randomBoolean probability)
- (randomPosition area)
- (randomLetter needed)
-
-
-randomDecay : Float -> Dict comparable v -> Random.Generator (Dict comparable v)
-randomDecay probability dict =
- Random.list (Dict.size dict) (randomBoolean probability)
- |> Random.map (\decayList -> decay decayList dict)
-
-
-decay : List Bool -> Dict comparable v -> Dict comparable v
-decay decayList dict =
- let
- maybeAnnihilate : Bool -> a -> Maybe a
- maybeAnnihilate annihilate value =
- if annihilate then
- Nothing
-
- else
- Just value
- in
- dict
- |> Dict.toList
- |> List.map2 maybeAnnihilate decayList
- |> Maybe.values
- |> Dict.fromListindex 48e5381..c37f799 100644
--- a/src/Password.elm
+++ b/src/Password.elm
@@ -1,4 +1,4 @@
-module Password exposing (Password, charset, passwords)
+module Password exposing (Charset, Password, charset, passwords)
=
=
=type alias Password =
@@ -8,7 +8,11 @@ type alias Password =
= }
=
=
-charset : List Char
+type alias Charset =
+ List Char
+
+
+charset : Charset
=charset =
= String.toList "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
=index aa41bad..c7aaf6b 100644
--- a/src/index.html
+++ b/src/index.html
@@ -33,18 +33,14 @@
= font-family: sans-serif;
= }
=
- body {
+ body, [data-elm-hot] {
= background: hsl(0, 0%, 86%);
+ width: 100%;
= color: hsl(0, 0%, 26%);
= display: flex;
= flex-direction: column;
- }
-
- footer {
- text-align: center;
- max-width: 640px;
- align-self: center;
- font-size: 0.8rem;
+ align-items: center;
+ justify-content: center;
= }
=
= </style>
@@ -52,23 +48,5 @@
= </head>
= <body>
= <div id="app"></div>
- <footer>
- <p>
- Made by <a href="https://tad-lispy.com/">Tad Lispy</a>.
- </p>
-
- <p>
- This game is a <strong>free software</strong>. You may copy, modify,
- redistribute it etc. under the terms of
- <a
- href="https://www.gnu.org/licenses/gpl-3.0.html"
- target="_blank"
- >the GNU General Public License v. 3.0</a>
- or later.
- <a
- href="https://gitlab.com/hornbook/word-snake/"
- >See the source code</a>. Have fun!
- </p>
- </footer>
= </body>
=</html>Fix: Only Firefox implements inset css property
On by
so let's use old school top, left, bottom, right :(
index db62a4d..96f6860 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -132,7 +132,10 @@ popupView game =
= |> List.singleton
= |> Html.div
= [ Html.Attributes.style "position" "absolute"
- , Html.Attributes.style "inset" "0"
+ , Html.Attributes.style "top" "0"
+ , Html.Attributes.style "left" "0"
+ , Html.Attributes.style "bottom" "0"
+ , Html.Attributes.style "right" "0"
= , Html.Attributes.style "display" "flex"
= , Html.Attributes.style "align-items" "center"
= , Html.Attributes.style "justify-content" "center"Add Capacitor and Android project
On by
The idea is to publish the game to Play Store.
new file mode 100644
index 0000000..68bf5a1
--- /dev/null
+++ b/android/.gitignore
@@ -0,0 +1,92 @@
+# NPM renames .gitignore to .npmignore
+# In order to prevent that, we remove the initial "."
+# And the CLI then renames it
+
+# Using Android gitignore template: https://github.com/github/gitignore/blob/master/Android.gitignore
+
+# Built application files
+*.apk
+*.ap_
+*.aab
+
+# Files for the ART/Dalvik VM
+*.dex
+
+# Java class files
+*.class
+
+# Generated files
+bin/
+gen/
+out/
+release/
+
+# Gradle files
+.gradle/
+build/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Proguard folder generated by Eclipse
+proguard/
+
+# Log Files
+*.log
+
+# Android Studio Navigation editor temp files
+.navigation/
+
+# Android Studio captures folder
+captures/
+
+# IntelliJ
+*.iml
+.idea/workspace.xml
+.idea/tasks.xml
+.idea/gradle.xml
+.idea/assetWizardSettings.xml
+.idea/dictionaries
+.idea/libraries
+# Android Studio 3 in .gitignore file.
+.idea/caches
+.idea/modules.xml
+# Comment next line if keeping position of elements in Navigation Editor is relevant for you
+.idea/navEditor.xml
+
+# Keystore files
+# Uncomment the following lines if you do not want to check your keystore files in.
+#*.jks
+#*.keystore
+
+# External native build folder generated in Android Studio 2.2 and later
+.externalNativeBuild
+
+# Freeline
+freeline.py
+freeline/
+freeline_project_description.json
+
+# fastlane
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots
+fastlane/test_output
+fastlane/readme.md
+
+# Version control
+vcs.xml
+
+# lint
+lint/intermediates/
+lint/generated/
+lint/outputs/
+lint/tmp/
+# lint/reports/
+
+# Cordova plugins for Capacitor
+capacitor-cordova-android-plugins
+
+# Copied web assets
+app/src/main/assets/public
+/app/new file mode 100644
index 0000000..b78268c
--- /dev/null
+++ b/android/build.gradle
@@ -0,0 +1,29 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:4.1.0'
+ classpath 'com.google.gms:google-services:4.3.3'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+apply from: "variables.gradle"
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}new file mode 100644
index 0000000..9a5fa87
--- /dev/null
+++ b/android/capacitor.settings.gradle
@@ -0,0 +1,3 @@
+// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
+include ':capacitor-android'
+project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')new file mode 100644
index 0000000..0566c22
--- /dev/null
+++ b/android/gradle.properties
@@ -0,0 +1,24 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=truenew file mode 100644
index 0000000..5c2d1cf
Binary files /dev/null and b/android/gradle/wrapper/gradle-wrapper.jar differnew file mode 100644
index 0000000..b9e5008
--- /dev/null
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Oct 29 09:40:46 CET 2020
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zipnew file mode 100755
index 0000000..83f2acf
--- /dev/null
+++ b/android/gradlew
@@ -0,0 +1,188 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"new file mode 100644
index 0000000..24467a1
--- /dev/null
+++ b/android/gradlew.bat
@@ -0,0 +1,100 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omeganew file mode 100644
index 0000000..3b4431d
--- /dev/null
+++ b/android/settings.gradle
@@ -0,0 +1,5 @@
+include ':app'
+include ':capacitor-cordova-android-plugins'
+project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/')
+
+apply from: 'capacitor.settings.gradle'
\ No newline at end of filenew file mode 100644
index 0000000..42ed435
--- /dev/null
+++ b/android/variables.gradle
@@ -0,0 +1,17 @@
+ext {
+ minSdkVersion = 21
+ compileSdkVersion = 29
+ targetSdkVersion = 29
+ androidxAppCompatVersion = '1.1.0'
+ androidxCoreVersion = '1.2.0'
+ androidxMaterialVersion = '1.1.0-rc02'
+ androidxBrowserVersion = '1.2.0'
+ androidxLocalbroadcastmanagerVersion = '1.0.0'
+ androidxExifInterfaceVersion = '1.2.0'
+ firebaseMessagingVersion = '20.1.2'
+ playServicesLocationVersion = '17.0.0'
+ junitVersion = '4.12'
+ androidxJunitVersion = '1.1.1'
+ androidxEspressoCoreVersion = '3.2.0'
+ cordovaAndroidVersion = '7.0.0'
+}
\ No newline at end of filenew file mode 100644
index 0000000..758c25a
--- /dev/null
+++ b/capacitor.config.json
@@ -0,0 +1,13 @@
+{
+ "appId": "io.hornbook.wordsnake",
+ "appName": "word-snake",
+ "bundledWebRuntime": false,
+ "npmClient": "npm",
+ "webDir": "dist/",
+ "plugins": {
+ "SplashScreen": {
+ "launchShowDuration": 0
+ }
+ },
+ "cordova": {}
+}index 8fa1bb9..7b8d3d4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1095,6 +1095,58 @@
= "to-fast-properties": "^2.0.0"
= }
= },
+ "@capacitor/android": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-2.4.2.tgz",
+ "integrity": "sha512-0OpOmsno6yFyN0tOEhE9LkAqQrnTGUxz49+ZdivieI3axFe3CpxbFhcfIsJtr96q9jhkspkYPMqGNZm3gPKjaA=="
+ },
+ "@capacitor/cli": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/@capacitor/cli/-/cli-2.4.2.tgz",
+ "integrity": "sha512-a6fTzv3zdfzBsk7h374yM6qSqwc2nb+LJfkw6hiP5otXwM2HUKSA9s13fdCPrsvsOOrk8srtt7ECi6oYulHAmQ==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.3.0",
+ "commander": "^4.1.1",
+ "compare-versions": "^3.1.0",
+ "fs-extra": "^4.0.3",
+ "inquirer": "6.3.1",
+ "open": "^6.1.0",
+ "ora": "^1.3.0",
+ "plist": "^3.0.1",
+ "semver": "^5.4.1",
+ "which": "^1.3.0",
+ "xml2js": "^0.4.19"
+ },
+ "dependencies": {
+ "commander": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
+ "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
+ "dev": true
+ },
+ "ora": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/ora/-/ora-1.4.0.tgz",
+ "integrity": "sha512-iMK1DOQxzzh2MBlVsU42G80mnrvUhqsMh74phHtDlrcTZPK0pH6o7l7DRshK+0YsxDyEuaOkziVdvM3T0QTzpw==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.1.0",
+ "cli-cursor": "^2.1.0",
+ "cli-spinners": "^1.0.1",
+ "log-symbols": "^2.1.0"
+ }
+ }
+ }
+ },
+ "@capacitor/core": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/@capacitor/core/-/core-2.4.2.tgz",
+ "integrity": "sha512-xQyJSZo50+aAvX3ZsX5h2xJDjz1LQxGT0A6/qD1pqJVEUeDhzdfYMbxCPWbmqSONZXddHtwrTiIsjq1Wd+ukuQ==",
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
= "@iarna/toml": {
= "version": "2.2.5",
= "resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz",
@@ -1227,6 +1279,12 @@
= "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=",
= "dev": true
= },
+ "ansi-escapes": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
+ "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==",
+ "dev": true
+ },
= "ansi-regex": {
= "version": "3.0.0",
= "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
@@ -1876,6 +1934,12 @@
= "supports-color": "^5.3.0"
= }
= },
+ "chardet": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",
+ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
+ "dev": true
+ },
= "chokidar": {
= "version": "2.1.8",
= "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
@@ -1944,6 +2008,12 @@
= "integrity": "sha512-1QL4544moEsDVH9T/l6Cemov/37iv1RtoKf7NJ04A60+4MREXNfx/QvavbH6QoGdsD4N4Mwy49cmaINR/o2mdg==",
= "dev": true
= },
+ "cli-width": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz",
+ "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==",
+ "dev": true
+ },
= "clone": {
= "version": "2.1.2",
= "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
@@ -2033,6 +2103,12 @@
= "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
= "dev": true
= },
+ "compare-versions": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz",
+ "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==",
+ "dev": true
+ },
= "component-emitter": {
= "version": "1.3.0",
= "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
@@ -3003,6 +3079,17 @@
= }
= }
= },
+ "external-editor": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz",
+ "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==",
+ "dev": true,
+ "requires": {
+ "chardet": "^0.7.0",
+ "iconv-lite": "^0.4.24",
+ "tmp": "^0.0.33"
+ }
+ },
= "extglob": {
= "version": "2.0.4",
= "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz",
@@ -3132,6 +3219,15 @@
= "integrity": "sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==",
= "dev": true
= },
+ "figures": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
+ "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",
+ "dev": true,
+ "requires": {
+ "escape-string-regexp": "^1.0.5"
+ }
+ },
= "file-uri-to-path": {
= "version": "1.0.0",
= "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
@@ -3227,6 +3323,17 @@
= "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=",
= "dev": true
= },
+ "fs-extra": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz",
+ "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "jsonfile": "^4.0.0",
+ "universalify": "^0.1.0"
+ }
+ },
= "fs.realpath": {
= "version": "1.0.0",
= "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -3674,6 +3781,44 @@
= "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
= "dev": true
= },
+ "inquirer": {
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.3.1.tgz",
+ "integrity": "sha512-MmL624rfkFt4TG9y/Jvmt8vdmOo836U7Y0Hxr2aFk3RelZEGX4Igk0KabWrcaaZaTv9uzglOqWh1Vly+FAWAXA==",
+ "dev": true,
+ "requires": {
+ "ansi-escapes": "^3.2.0",
+ "chalk": "^2.4.2",
+ "cli-cursor": "^2.1.0",
+ "cli-width": "^2.0.0",
+ "external-editor": "^3.0.3",
+ "figures": "^2.0.0",
+ "lodash": "^4.17.11",
+ "mute-stream": "0.0.7",
+ "run-async": "^2.2.0",
+ "rxjs": "^6.4.0",
+ "string-width": "^2.1.0",
+ "strip-ansi": "^5.1.0",
+ "through": "^2.3.6"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^4.1.0"
+ }
+ }
+ }
+ },
= "is-absolute-url": {
= "version": "2.1.0",
= "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz",
@@ -3813,6 +3958,12 @@
= "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
= "dev": true
= },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
= "is-glob": {
= "version": "4.0.1",
= "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
@@ -4092,6 +4243,15 @@
= "minimist": "^1.2.0"
= }
= },
+ "jsonfile": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
+ "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
= "jsprim": {
= "version": "1.4.1",
= "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
@@ -4352,6 +4512,12 @@
= "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
= "dev": true
= },
+ "mute-stream": {
+ "version": "0.0.7",
+ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
+ "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",
+ "dev": true
+ },
= "nan": {
= "version": "2.14.2",
= "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz",
@@ -4656,6 +4822,15 @@
= "mimic-fn": "^1.0.0"
= }
= },
+ "open": {
+ "version": "6.4.0",
+ "resolved": "https://registry.npmjs.org/open/-/open-6.4.0.tgz",
+ "integrity": "sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg==",
+ "dev": true,
+ "requires": {
+ "is-wsl": "^1.1.0"
+ }
+ },
= "opn": {
= "version": "5.5.0",
= "resolved": "https://registry.npmjs.org/opn/-/opn-5.5.0.tgz",
@@ -4699,6 +4874,12 @@
= "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=",
= "dev": true
= },
+ "os-tmpdir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
+ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
+ "dev": true
+ },
= "pako": {
= "version": "0.2.9",
= "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz",
@@ -4868,6 +5049,17 @@
= "integrity": "sha1-GN4vl+S/epVRrXURlCtUlverpmA=",
= "dev": true
= },
+ "plist": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.1.tgz",
+ "integrity": "sha512-GpgvHHocGRyQm74b6FWEZZVRroHKE1I0/BTjAmySaohK+cUn+hZpbqXkc3KWgW3gQYkqcQej35FohcT0FRlkRQ==",
+ "dev": true,
+ "requires": {
+ "base64-js": "^1.2.3",
+ "xmlbuilder": "^9.0.7",
+ "xmldom": "0.1.x"
+ }
+ },
= "pn": {
= "version": "1.1.0",
= "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz",
@@ -5767,6 +5959,21 @@
= "inherits": "^2.0.1"
= }
= },
+ "run-async": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz",
+ "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==",
+ "dev": true
+ },
+ "rxjs": {
+ "version": "6.6.3",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz",
+ "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==",
+ "dev": true,
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
= "safe-buffer": {
= "version": "5.1.2",
= "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
@@ -6279,6 +6486,16 @@
= "xtend": "^4.0.0"
= }
= },
+ "string-width": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
+ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
+ "dev": true,
+ "requires": {
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^4.0.0"
+ }
+ },
= "string.prototype.trimend": {
= "version": "1.0.2",
= "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.2.tgz",
@@ -6408,6 +6625,12 @@
= "source-map-support": "~0.5.10"
= }
= },
+ "through": {
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
+ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
+ "dev": true
+ },
= "through2": {
= "version": "2.0.5",
= "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
@@ -6439,6 +6662,15 @@
= "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==",
= "dev": true
= },
+ "tmp": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "dev": true,
+ "requires": {
+ "os-tmpdir": "~1.0.2"
+ }
+ },
= "to-arraybuffer": {
= "version": "1.0.1",
= "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz",
@@ -6518,6 +6750,11 @@
= "punycode": "^2.1.0"
= }
= },
+ "tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
+ },
= "tty-browserify": {
= "version": "0.0.0",
= "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
@@ -6652,6 +6889,12 @@
= "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=",
= "dev": true
= },
+ "universalify": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
+ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
+ "dev": true
+ },
= "unquote": {
= "version": "1.1.1",
= "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz",
@@ -6937,12 +7180,42 @@
= "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==",
= "dev": true
= },
+ "xml2js": {
+ "version": "0.4.23",
+ "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
+ "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
+ "dev": true,
+ "requires": {
+ "sax": ">=0.6.0",
+ "xmlbuilder": "~11.0.0"
+ },
+ "dependencies": {
+ "xmlbuilder": {
+ "version": "11.0.1",
+ "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
+ "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==",
+ "dev": true
+ }
+ }
+ },
+ "xmlbuilder": {
+ "version": "9.0.7",
+ "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
+ "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=",
+ "dev": true
+ },
= "xmlchars": {
= "version": "2.2.0",
= "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
= "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==",
= "dev": true
= },
+ "xmldom": {
+ "version": "0.1.31",
+ "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.31.tgz",
+ "integrity": "sha512-yS2uJflVQs6n+CyjHoaBmVSqIDevTAWrzMmjG1Gc7h1qQ7uVozNhEPJAwZXWyGQ/Gafo3fCwrcaokezLPupVyQ==",
+ "dev": true
+ },
= "xtend": {
= "version": "4.0.2",
= "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",index e0bc8dd..c990de7 100644
--- a/package.json
+++ b/package.json
@@ -15,10 +15,15 @@
= "author": "Tad Lispy (https://tad-lispy.com/)",
= "license": "GPL-3.0-or-later",
= "devDependencies": {
+ "@capacitor/cli": "^2.4.2",
= "coffeescript": "^2.5.1",
= "elm": "^0.19.1-3",
= "elm-hot": "^1.1.5",
= "node-elm-compiler": "^5.0.5",
= "parcel": "^1.12.4"
+ },
+ "dependencies": {
+ "@capacitor/android": "^2.4.2",
+ "@capacitor/core": "^2.4.2"
= }
=}Create icon, setup make for android project
On by
Including creating icons and splash resources. This requires Inkscape and Image Magick.
The android/app/ directory is not ignored anymore. There is configuration there that cannot be automatically recreated.
index 8a9b87a..0773f71 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
=.idea
=*.log
=tmp/
+.gradle
=
=*.tern-port
=node_modules/
@@ -15,4 +16,5 @@ yarn-error.log*
=.cache/
=dist/
=elm-stuff/
+resources/
=.installedindex 9eb38e2..94af2af 100644
--- a/Makefile
+++ b/Makefile
@@ -21,3 +21,49 @@ dist: .installed
=.PHONY: develop
=develop: .installed
= npx parcel --public-url=$(public-url) $(entrypoints)
+
+# ANDROID APP
+
+.PHONY: android
+android: \
+ resources/splash.png \
+ resources/icon.png \
+ resources/android/icon-foreground.png \
+ resources/android/icon-background.png
+
+ npx cordova-res android --skip-config --copy
+ cap sync android
+
+resources/splash.png: src/splash.jpg
+ mkdir -p resources/
+ convert $< $@
+
+resources/icon.png: src/icon.svg
+ mkdir -p resources/
+ inkscape \
+ --export-width=2048 \
+ --export-height=2048 \
+ --export-filename=$@ \
+ $<
+
+resources/android/icon-foreground.png: src/icon.svg
+ mkdir -p resources/android/
+ inkscape \
+ --export-width=2048 \
+ --export-height=2048 \
+ --export-area-page \
+ --export-id-only \
+ --export-id=foreground \
+ --export-filename=$@ \
+ $<
+
+resources/android/icon-background.png: src/icon.svg
+ mkdir -p resources/android/
+ inkscape \
+ --export-width=2048 \
+ --export-height=2048 \
+ --export-area-page \
+ --export-id-only \
+ --export-id=background \
+ --export-filename=$@ \
+ $<index 68bf5a1..64a88fb 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -89,4 +89,3 @@ capacitor-cordova-android-plugins
=
=# Copied web assets
=app/src/main/assets/public
-/app/index b9e5008..216c53c 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,4 +1,4 @@
-#Thu Oct 29 09:40:46 CET 2020
+#Thu Oct 29 14:33:53 CET 2020
=distributionBase=GRADLE_USER_HOME
=distributionPath=wrapper/dists
=zipStoreBase=GRADLE_USER_HOMEindex 7b8d3d4..8e8c137 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1153,6 +1153,71 @@
= "integrity": "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==",
= "dev": true
= },
+ "@ionic/utils-array": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/@ionic/utils-array/-/utils-array-2.1.5.tgz",
+ "integrity": "sha512-HD72a71IQVBmQckDwmA8RxNVMTbxnaLbgFOl+dO5tbvW9CkkSFCv41h6fUuNsSEVgngfkn0i98HDuZC8mk+lTA==",
+ "dev": true,
+ "requires": {
+ "debug": "^4.0.0",
+ "tslib": "^2.0.1"
+ },
+ "dependencies": {
+ "tslib": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
+ "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==",
+ "dev": true
+ }
+ }
+ },
+ "@ionic/utils-fs": {
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/@ionic/utils-fs/-/utils-fs-3.1.5.tgz",
+ "integrity": "sha512-a41bY2dHqWSEQQ/80CpbXSs8McyiCFf2DnIWWLukrhYWf46h4qi6M/8dxcMKrofRiqI/3F+cL3S2mOm9Zz/o2Q==",
+ "dev": true,
+ "requires": {
+ "debug": "^4.0.0",
+ "fs-extra": "^9.0.0",
+ "tslib": "^2.0.1"
+ },
+ "dependencies": {
+ "fs-extra": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz",
+ "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==",
+ "dev": true,
+ "requires": {
+ "at-least-node": "^1.0.0",
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^6.0.1",
+ "universalify": "^1.0.0"
+ }
+ },
+ "jsonfile": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz",
+ "integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.6",
+ "universalify": "^1.0.0"
+ }
+ },
+ "tslib": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
+ "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==",
+ "dev": true
+ },
+ "universalify": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz",
+ "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==",
+ "dev": true
+ }
+ }
+ },
= "@mrmlnc/readdir-enhanced": {
= "version": "2.2.1",
= "resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz",
@@ -1330,6 +1395,22 @@
= }
= }
= },
+ "aproba": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
+ "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
+ "dev": true
+ },
+ "are-we-there-yet": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
+ "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
+ "dev": true,
+ "requires": {
+ "delegates": "^1.0.0",
+ "readable-stream": "^2.0.6"
+ }
+ },
= "argparse": {
= "version": "1.0.10",
= "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@@ -1455,6 +1536,12 @@
= "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
= "dev": true
= },
+ "at-least-node": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
+ "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",
+ "dev": true
+ },
= "atob": {
= "version": "2.1.2",
= "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
@@ -1622,6 +1709,40 @@
= "file-uri-to-path": "1.0.0"
= }
= },
+ "bl": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz",
+ "integrity": "sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==",
+ "dev": true,
+ "requires": {
+ "buffer": "^5.5.0",
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.4.0"
+ },
+ "dependencies": {
+ "buffer": {
+ "version": "5.7.0",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.0.tgz",
+ "integrity": "sha512-cd+5r1VLBwUqTrmnzW+D7ABkJUM6mr7uv1dv+6jRw4Rcl7tFIFHDqHPL98LhpGFn3dbAt3gtLxtrWp4m1kFrqg==",
+ "dev": true,
+ "requires": {
+ "base64-js": "^1.3.1",
+ "ieee754": "^1.1.13"
+ }
+ },
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ }
+ }
+ },
= "bn.js": {
= "version": "5.1.3",
= "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz",
@@ -1960,6 +2081,12 @@
= "upath": "^1.1.1"
= }
= },
+ "chownr": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
+ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
+ "dev": true
+ },
= "cipher-base": {
= "version": "1.0.4",
= "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz",
@@ -2031,6 +2158,12 @@
= "q": "^1.1.2"
= }
= },
+ "code-point-at": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
+ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
+ "dev": true
+ },
= "coffeescript": {
= "version": "2.5.1",
= "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-2.5.1.tgz",
@@ -2139,6 +2272,12 @@
= "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==",
= "dev": true
= },
+ "console-control-strings": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
+ "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
+ "dev": true
+ },
= "constants-browserify": {
= "version": "1.0.0",
= "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz",
@@ -2160,6 +2299,20 @@
= "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=",
= "dev": true
= },
+ "cordova-res": {
+ "version": "0.15.1",
+ "resolved": "https://registry.npmjs.org/cordova-res/-/cordova-res-0.15.1.tgz",
+ "integrity": "sha512-qD4yrlVZpv4X3W3BnVDEmRVt6ZzZmFr4fIqc8lhxbVEuYb9/N3lXP9lAm7wGC323QBwYfQE4zGeyuUvnOkbJ8w==",
+ "dev": true,
+ "requires": {
+ "@ionic/utils-array": "^2.1.1",
+ "@ionic/utils-fs": "^3.0.0",
+ "debug": "^4.1.1",
+ "elementtree": "^0.1.7",
+ "sharp": "^0.25.1",
+ "tslib": "^1.9.3"
+ }
+ },
= "core-js": {
= "version": "2.6.11",
= "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
@@ -2599,6 +2752,21 @@
= "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
= "dev": true
= },
+ "decompress-response": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz",
+ "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==",
+ "dev": true,
+ "requires": {
+ "mimic-response": "^2.0.0"
+ }
+ },
+ "deep-extend": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
+ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
+ "dev": true
+ },
= "deep-is": {
= "version": "0.1.3",
= "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
@@ -2678,6 +2846,12 @@
= "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
= "dev": true
= },
+ "delegates": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
+ "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
+ "dev": true
+ },
= "depd": {
= "version": "1.1.2",
= "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
@@ -2700,6 +2874,12 @@
= "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=",
= "dev": true
= },
+ "detect-libc": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
+ "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=",
+ "dev": true
+ },
= "diffie-hellman": {
= "version": "5.0.3",
= "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
@@ -2835,6 +3015,23 @@
= "integrity": "sha512-0nCJ7cSqnkMC+kUuPs0YgklFHraWGl/xHqtZWWtOeVtyi+YqkoAOMGuZQad43DscXCQI/yizcTa3u6B5r+BLww==",
= "dev": true
= },
+ "elementtree": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/elementtree/-/elementtree-0.1.7.tgz",
+ "integrity": "sha1-mskb5uUvtuYkTE5UpKw+2K6OKcA=",
+ "dev": true,
+ "requires": {
+ "sax": "1.1.4"
+ },
+ "dependencies": {
+ "sax": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.1.4.tgz",
+ "integrity": "sha1-dLbTPJrh4AFRDxeakRaFiPGu2qk=",
+ "dev": true
+ }
+ }
+ },
= "elliptic": {
= "version": "6.5.3",
= "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
@@ -2879,6 +3076,15 @@
= "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
= "dev": true
= },
+ "end-of-stream": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+ "dev": true,
+ "requires": {
+ "once": "^1.4.0"
+ }
+ },
= "entities": {
= "version": "1.1.2",
= "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
@@ -3052,6 +3258,12 @@
= }
= }
= },
+ "expand-template": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
+ "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
+ "dev": true
+ },
= "extend": {
= "version": "3.0.2",
= "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
@@ -3323,6 +3535,12 @@
= "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=",
= "dev": true
= },
+ "fs-constants": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
+ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
+ "dev": true
+ },
= "fs-extra": {
= "version": "4.0.3",
= "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz",
@@ -3334,6 +3552,15 @@
= "universalify": "^0.1.0"
= }
= },
+ "fs-minipass": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
+ "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
+ "dev": true,
+ "requires": {
+ "minipass": "^3.0.0"
+ }
+ },
= "fs.realpath": {
= "version": "1.0.0",
= "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -3357,6 +3584,59 @@
= "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
= "dev": true
= },
+ "gauge": {
+ "version": "2.7.4",
+ "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
+ "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
+ "dev": true,
+ "requires": {
+ "aproba": "^1.0.3",
+ "console-control-strings": "^1.0.0",
+ "has-unicode": "^2.0.0",
+ "object-assign": "^4.1.0",
+ "signal-exit": "^3.0.0",
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1",
+ "wide-align": "^1.1.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+ "dev": true,
+ "requires": {
+ "number-is-nan": "^1.0.0"
+ }
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+ "dev": true,
+ "requires": {
+ "code-point-at": "^1.0.0",
+ "is-fullwidth-code-point": "^1.0.0",
+ "strip-ansi": "^3.0.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ }
+ }
+ },
= "gensync": {
= "version": "1.0.0-beta.1",
= "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz",
@@ -3384,6 +3664,12 @@
= "assert-plus": "^1.0.0"
= }
= },
+ "github-from-package": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
+ "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=",
+ "dev": true
+ },
= "glob": {
= "version": "7.1.6",
= "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
@@ -3501,6 +3787,12 @@
= "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
= "dev": true
= },
+ "has-unicode": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
+ "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
+ "dev": true
+ },
= "has-value": {
= "version": "1.0.0",
= "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz",
@@ -3781,6 +4073,12 @@
= "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
= "dev": true
= },
+ "ini": {
+ "version": "1.3.5",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
+ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
+ "dev": true
+ },
= "inquirer": {
= "version": "6.3.1",
= "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.3.1.tgz",
@@ -4449,6 +4747,12 @@
= "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",
= "dev": true
= },
+ "mimic-response": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz",
+ "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==",
+ "dev": true
+ },
= "minimalistic-assert": {
= "version": "1.0.1",
= "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
@@ -4476,6 +4780,25 @@
= "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
= "dev": true
= },
+ "minipass": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.3.tgz",
+ "integrity": "sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg==",
+ "dev": true,
+ "requires": {
+ "yallist": "^4.0.0"
+ }
+ },
+ "minizlib": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
+ "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
+ "dev": true,
+ "requires": {
+ "minipass": "^3.0.0",
+ "yallist": "^4.0.0"
+ }
+ },
= "mixin-deep": {
= "version": "1.3.2",
= "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
@@ -4506,6 +4829,12 @@
= "minimist": "^1.2.5"
= }
= },
+ "mkdirp-classic": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
+ "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
+ "dev": true
+ },
= "ms": {
= "version": "2.1.2",
= "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -4544,12 +4873,27 @@
= "to-regex": "^3.0.1"
= }
= },
+ "napi-build-utils": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
+ "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==",
+ "dev": true
+ },
= "nice-try": {
= "version": "1.0.5",
= "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
= "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
= "dev": true
= },
+ "node-abi": {
+ "version": "2.19.1",
+ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.19.1.tgz",
+ "integrity": "sha512-HbtmIuByq44yhAzK7b9j/FelKlHYISKQn0mtvcBrU5QBkhoCMp5bu8Hv5AI34DcKfOAcJBcOEMwLlwO62FFu9A==",
+ "dev": true,
+ "requires": {
+ "semver": "^5.4.1"
+ }
+ },
= "node-addon-api": {
= "version": "1.7.2",
= "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
@@ -4619,6 +4963,12 @@
= "integrity": "sha512-Iec8O9166/x2HRMJyLLLWkd0sFFLrFNy+Xf+JQfSQsdBJzPcHpNl3JQ9gD4j+aJxmCa25jNsIbM4bmACtSbkSg==",
= "dev": true
= },
+ "noop-logger": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz",
+ "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=",
+ "dev": true
+ },
= "normalize-path": {
= "version": "3.0.0",
= "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
@@ -4631,6 +4981,18 @@
= "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==",
= "dev": true
= },
+ "npmlog": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
+ "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
+ "dev": true,
+ "requires": {
+ "are-we-there-yet": "~1.1.2",
+ "console-control-strings": "~1.1.0",
+ "gauge": "~2.7.3",
+ "set-blocking": "~2.0.0"
+ }
+ },
= "nth-check": {
= "version": "1.0.2",
= "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz",
@@ -4640,6 +5002,12 @@
= "boolbase": "~1.0.0"
= }
= },
+ "number-is-nan": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
+ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
+ "dev": true
+ },
= "nwsapi": {
= "version": "2.2.0",
= "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz",
@@ -5563,6 +5931,42 @@
= "integrity": "sha512-rGGayND//VwTlsYKNqdILsA7U/XP0WJa6SMcdAEoqc2WRM5QExplGg/h9qbTuHz7mc2PvaXU+6iNxItvr5aHMg==",
= "dev": true
= },
+ "prebuild-install": {
+ "version": "5.3.6",
+ "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.6.tgz",
+ "integrity": "sha512-s8Aai8++QQGi4sSbs/M1Qku62PFK49Jm1CbgXklGz4nmHveDq0wzJkg7Na5QbnO1uNH8K7iqx2EQ/mV0MZEmOg==",
+ "dev": true,
+ "requires": {
+ "detect-libc": "^1.0.3",
+ "expand-template": "^2.0.3",
+ "github-from-package": "0.0.0",
+ "minimist": "^1.2.3",
+ "mkdirp-classic": "^0.5.3",
+ "napi-build-utils": "^1.0.1",
+ "node-abi": "^2.7.0",
+ "noop-logger": "^0.1.1",
+ "npmlog": "^4.0.1",
+ "pump": "^3.0.0",
+ "rc": "^1.2.7",
+ "simple-get": "^3.0.3",
+ "tar-fs": "^2.0.0",
+ "tunnel-agent": "^0.6.0",
+ "which-pm-runs": "^1.0.0"
+ },
+ "dependencies": {
+ "simple-get": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz",
+ "integrity": "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==",
+ "dev": true,
+ "requires": {
+ "decompress-response": "^4.2.0",
+ "once": "^1.3.1",
+ "simple-concat": "^1.0.0"
+ }
+ }
+ }
+ },
= "prelude-ls": {
= "version": "1.1.2",
= "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
@@ -5609,6 +6013,16 @@
= }
= }
= },
+ "pump": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
+ "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
+ "dev": true,
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
= "punycode": {
= "version": "2.1.1",
= "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
@@ -5715,6 +6129,18 @@
= "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
= "dev": true
= },
+ "rc": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
+ "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
+ "dev": true,
+ "requires": {
+ "deep-extend": "^0.6.0",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
+ }
+ },
= "readable-stream": {
= "version": "2.3.7",
= "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
@@ -6080,6 +6506,12 @@
= "send": "0.17.1"
= }
= },
+ "set-blocking": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
+ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
+ "dev": true
+ },
= "set-value": {
= "version": "2.0.1",
= "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
@@ -6131,6 +6563,37 @@
= "integrity": "sha1-QV9CcC1z2BAzApLMXuhurhoRoXA=",
= "dev": true
= },
+ "sharp": {
+ "version": "0.25.4",
+ "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.25.4.tgz",
+ "integrity": "sha512-umSzJJ1oBwIOfwFFt/fJ7JgCva9FvrEU2cbbm7u/3hSDZhXvkME8WE5qpaJqLIe2Har5msF5UG4CzYlEg5o3BQ==",
+ "dev": true,
+ "requires": {
+ "color": "^3.1.2",
+ "detect-libc": "^1.0.3",
+ "node-addon-api": "^3.0.0",
+ "npmlog": "^4.1.2",
+ "prebuild-install": "^5.3.4",
+ "semver": "^7.3.2",
+ "simple-get": "^4.0.0",
+ "tar": "^6.0.2",
+ "tunnel-agent": "^0.6.0"
+ },
+ "dependencies": {
+ "node-addon-api": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.0.2.tgz",
+ "integrity": "sha512-+D4s2HCnxPd5PjjI0STKwncjXTUKKqm74MDMz9OPXavjsGmjkvwgLtA5yoxJUdmpj52+2u+RrXgPipahKczMKg==",
+ "dev": true
+ },
+ "semver": {
+ "version": "7.3.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
+ "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
+ "dev": true
+ }
+ }
+ },
= "shebang-command": {
= "version": "1.2.0",
= "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
@@ -6152,6 +6615,40 @@
= "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
= "dev": true
= },
+ "simple-concat": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
+ "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
+ "dev": true
+ },
+ "simple-get": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.0.tgz",
+ "integrity": "sha512-ZalZGexYr3TA0SwySsr5HlgOOinS4Jsa8YB2GJ6lUNAazyAu4KG/VmzMTwAt2YVXzzVj8QmefmAonZIK2BSGcQ==",
+ "dev": true,
+ "requires": {
+ "decompress-response": "^6.0.0",
+ "once": "^1.3.1",
+ "simple-concat": "^1.0.0"
+ },
+ "dependencies": {
+ "decompress-response": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
+ "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
+ "dev": true,
+ "requires": {
+ "mimic-response": "^3.1.0"
+ }
+ },
+ "mimic-response": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
+ "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
+ "dev": true
+ }
+ }
+ },
= "simple-swizzle": {
= "version": "0.2.2",
= "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
@@ -6534,6 +7031,12 @@
= "ansi-regex": "^3.0.0"
= }
= },
+ "strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
+ "dev": true
+ },
= "stylehacks": {
= "version": "4.0.3",
= "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz",
@@ -6594,6 +7097,72 @@
= "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
= "dev": true
= },
+ "tar": {
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-6.0.5.tgz",
+ "integrity": "sha512-0b4HOimQHj9nXNEAA7zWwMM91Zhhba3pspja6sQbgTpynOJf+bkjBnfybNYzbpLbnwXnbyB4LOREvlyXLkCHSg==",
+ "dev": true,
+ "requires": {
+ "chownr": "^2.0.0",
+ "fs-minipass": "^2.0.0",
+ "minipass": "^3.0.0",
+ "minizlib": "^2.1.1",
+ "mkdirp": "^1.0.3",
+ "yallist": "^4.0.0"
+ },
+ "dependencies": {
+ "chownr": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
+ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
+ "dev": true
+ },
+ "mkdirp": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
+ "dev": true
+ }
+ }
+ },
+ "tar-fs": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.0.tgz",
+ "integrity": "sha512-9uW5iDvrIMCVpvasdFHW0wJPez0K4JnMZtsuIeDI7HyMGJNxmDZDOCQROr7lXyS+iL/QMpj07qcjGYTSdRFXUg==",
+ "dev": true,
+ "requires": {
+ "chownr": "^1.1.1",
+ "mkdirp-classic": "^0.5.2",
+ "pump": "^3.0.0",
+ "tar-stream": "^2.0.0"
+ }
+ },
+ "tar-stream": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.4.tgz",
+ "integrity": "sha512-o3pS2zlG4gxr67GmFYBLlq+dM8gyRGUOvsrHclSkvtVtQbjV0s/+ZE8OpICbaj8clrX3tjeHngYGP7rweaBnuw==",
+ "dev": true,
+ "requires": {
+ "bl": "^4.0.3",
+ "end-of-stream": "^1.4.1",
+ "fs-constants": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1"
+ },
+ "dependencies": {
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ }
+ }
+ },
= "temp": {
= "version": "0.9.1",
= "resolved": "https://registry.npmjs.org/temp/-/temp-0.9.1.tgz",
@@ -7153,6 +7722,21 @@
= "isexe": "^2.0.0"
= }
= },
+ "which-pm-runs": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz",
+ "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=",
+ "dev": true
+ },
+ "wide-align": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
+ "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
+ "dev": true,
+ "requires": {
+ "string-width": "^1.0.2 || 2"
+ }
+ },
= "word-wrap": {
= "version": "1.2.3",
= "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
@@ -7221,6 +7805,12 @@
= "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
= "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
= "dev": true
+ },
+ "yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
= }
= }
=}index c990de7..3505750 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,7 @@
= "devDependencies": {
= "@capacitor/cli": "^2.4.2",
= "coffeescript": "^2.5.1",
+ "cordova-res": "^0.15.1",
= "elm": "^0.19.1-3",
= "elm-hot": "^1.1.5",
= "node-elm-compiler": "^5.0.5",new file mode 100644
index 0000000..2071848
--- /dev/null
+++ b/src/icon.svg
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48"
+ height="48"
+ viewBox="0 0 12.7 12.7"
+ version="1.1"
+ id="svg8"
+ sodipodi:docname="icon.svg"
+ inkscape:version="1.0.1 (c497b03c, 2020-09-10)">
+ <defs
+ id="defs2">
+ <inkscape:path-effect
+ effect="roughen"
+ id="path-effect1046"
+ is_visible="true"
+ lpeversion="1"
+ method="size"
+ max_segment_size="0.3"
+ segments="5"
+ displace_x="0.01;1"
+ displace_y="0.01;1"
+ global_randomize="0.1;1792603870"
+ handles="smooth"
+ shift_nodes="true"
+ fixed_displacement="true"
+ spray_tool_friendly="true" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="4.5532119"
+ inkscape:cx="31.7847"
+ inkscape:cy="25.706229"
+ inkscape:document-units="mm"
+ inkscape:current-layer="background"
+ inkscape:document-rotation="0"
+ showgrid="false"
+ units="px"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-nodes="false"
+ inkscape:snap-others="true"
+ inkscape:window-width="1440"
+ inkscape:window-height="875"
+ inkscape:window-x="0"
+ inkscape:window-y="25"
+ inkscape:window-maximized="0"
+ inkscape:pagecheckerboard="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid833"
+ originx="6.35"
+ originy="6.35"
+ spacingx="2.38125"
+ spacingy="2.38125" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Background"
+ inkscape:groupmode="layer"
+ id="background"
+ style="display:inline">
+ <g
+ id="g1040"
+ style="opacity:1;stroke:none"
+ transform="matrix(0.52349013,0,0,0.52349013,3.0217034,2.8936359)">
+ <g
+ id="g1048"
+ style="opacity:1"
+ transform="translate(-5.2916667)">
+ <g
+ id="g1063"
+ transform="matrix(0.94438426,0,0,0.9033241,0.61159007,0.84416502)">
+ <path
+ id="path1059"
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#4d4d4d;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.264583;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
+ d="M 11.642578,-0.03710937 C 11.253011,0.03474735 10.994195,-0.12081035 10.839844,0.01757813 10.147932,0.07831657 9.5602578,0.37947463 8.9269751,0.60205715 8.2130181,0.93339727 7.5199128,1.3402485 7.0719364,2.0090639 6.4918515,2.3938021 6.235959,3.0581154 5.9037367,3.6399843 5.6514986,4.2016922 5.4534975,4.7954266 5.3201765,5.3937971 5.2862286,5.9854982 5.2196966,6.5758852 5.314917,7.1686196 c 0.047415,0.922153 0.4507125,1.7787465 0.8593821,2.5889033 0.4670973,0.7757341 1.1301983,1.4320871 1.8731697,1.9441551 0.8167275,0.587999 1.7751869,0.95666 2.7767882,1.059116 1.46464,0.17009 3.009155,-0.141365 4.254126,-0.946401 0.952359,-0.438463 1.53378,-1.343551 2.130601,-2.1600961 C 17.850243,8.4349394 18.253849,7.0426721 18.062482,5.6574635 17.909371,4.5707338 17.594559,3.4813042 16.912582,2.6013095 16.300388,1.6117613 15.2791,0.98132758 14.269579,0.46040693 13.713357,0.12424447 13.012091,0.19681636 12.446981,-0.03523438 c -0.261535,0.14011402 -0.597522,-0.08610833 -0.804403,-0.001875 z m 0.5625,0.18749999 c 0.585591,0.0674727 1.16217,0.21953871 1.71624,0.41958542 0.537564,0.21850982 1.094673,0.44140996 1.547233,0.86169156 0.596905,0.5897057 1.263291,1.1381945 1.624787,1.9170945 0.736684,1.2678369 0.997207,2.7937395 0.694203,4.2313151 -0.07464,0.931895 -0.546377,1.7880094 -1.093996,2.5285748 -0.465132,0.605934 -0.977343,1.168252 -1.639445,1.568573 -0.724365,0.441479 -1.491628,0.721857 -2.331754,0.852587 -0.794766,0.04048 -1.600475,0.174889 -2.378713,-0.07228 C 9.5183199,12.318128 8.7568375,11.908873 8.0657051,11.45239 7.4661492,11.021029 6.9715471,10.493782 6.5488611,9.8886297 6.1762375,9.3814974 5.9627098,8.7712469 5.6929907,8.20481 5.6014877,7.6800051 5.5457126,7.1482857 5.4632626,6.621874 5.4483218,5.8791802 5.4822494,5.124767 5.7835268,4.4338728 5.9333025,3.738304 6.3749645,3.1473694 6.725233,2.540667 7.2145535,1.8429828 7.9419422,1.3936241 8.6351965,0.92664643 9.2071001,0.61354832 9.8172743,0.43205689 10.439086,0.24414062 c 0.437861,0.0234623 1.031363,-0.14405959 1.509924,-0.0781755 0.264717,0.12901161 -0.01801,-0.17320827 0.256068,-0.0155745 z m 2.138672,0.67382813 c 0.05027,0.0301034 0.05614,-0.0549382 0,0 z m 1.251953,0.83593745 c 0.06013,-3.697e-4 -0.05032,-0.071572 0,0 z" />
+ <path
+ style="opacity:1;fill:#ffffff;stroke:none;stroke-width:0.033445;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers fill stroke;stop-color:#000000"
+ d="m 12.115069,0.11658398 c -0.06653,0.005283 -0.01096,0.13587445 -0.101643,0.0835543 C 11.600004,0.08583162 11.167435,0.213711 10.748531,0.22828745 10.091212,0.29740737 9.4632663,0.54893185 8.8633458,0.82665155 8.205652,1.190587 7.5684079,1.6217132 7.0411036,2.174853 6.5605953,2.739949 6.1891123,3.4037976 5.8940281,4.0918611 5.5700622,4.933583 5.3799745,5.8488467 5.4987897,6.7575463 c 0.059903,0.4968712 0.1075494,1.0037745 0.2185398,1.4880147 0.3206723,0.7373509 0.6524489,1.4847247 1.1840831,2.086393 1.0079849,1.252768 2.4989777,2.039476 4.0437404,2.242173 1.026251,0.0329 2.077784,-0.0011 3.048851,-0.388217 1.038678,-0.364013 1.937126,-1.081429 2.612388,-1.975413 0.59345,-0.7673673 1.071456,-1.6660521 1.191349,-2.6578429 0.23228,-1.3637336 0.05592,-2.8197654 -0.616364,-4.0262285 C 16.917992,2.9749286 16.55197,2.4867976 16.114685,2.0743782 15.959529,1.9179735 15.778485,1.7416877 15.610088,1.6258387 15.555459,1.4517408 15.349203,1.368269 15.22693,1.2451598 14.971112,1.0680123 14.696246,0.87777245 14.393632,0.81413915 14.335748,0.82497995 14.330552,0.70831955 14.254871,0.71228435 13.577398,0.39658013 12.836532,0.26821459 12.115069,0.11658398 Z"
+ id="path1072" />
+ </g>
+ </g>
+ </g>
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="foreground"
+ inkscape:label="Foreground"
+ style="display:inline">
+ <g
+ id="g1010"
+ transform="matrix(0.07304482,0,0,0.07304482,5.2549984,6.2389936)">
+ <path
+ style="opacity:1;fill:#000000;stroke:none;stroke-width:0.140335;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers fill stroke;stop-color:#000000"
+ d="m 51.21374,-33.882672 c -3.27662,0.468057 -6.001152,2.679653 -8.154825,5.069308 -1.047661,1.209142 -2.436606,2.541029 -2.168321,4.290952 v 3.880055 c -1.904637,1.762179 -4.181648,3.624284 -6.941669,3.47659 -2.341735,0.101464 -4.006571,-1.838355 -5.693753,-3.157937 -3.035123,-2.664104 -6.658163,-5.133694 -10.844442,-5.208464 -4.125175,-0.02156 -7.8604997,2.64293 -10.0143728,6.024546 -1.424225,2.186895 -1.1176676,4.922951 -0.9860576,7.394476 0.4638947,1.742919 1.4251166,3.3376006 2.3961171,4.8470516 2.2612493,2.971754 5.4007433,5.174001 8.8468843,6.56616097 3.777428,1.74133503 8.001029,2.55665103 11.461454,4.94627503 2.136268,1.578121 4.253732,3.706357 4.638885,6.4495074 0.169859,1.728047 0.171564,3.734091 -1.22358,5.001358 -2.114164,2.150323 -5.698271,2.240178 -8.132437,0.580152 -3.759099,-2.455462 -6.375657,-6.210775 -9.246068,-9.5806794 -3.049644,-3.61386 -5.9099213,-7.59271503 -9.9787841,-10.139182 -3.3755466,-2.050681 -7.7431615,-3.291342 -11.5346363,-1.650312 -3.411178,1.548531 -6.5201706,4.62156397 -6.9106946,8.505091 -0.349751,3.052905 0.683006,6.280206 2.955125,8.3960304 1.7811476,1.861128 3.6188556,3.805694 6.0729326,4.761123 4.64420096,2.170137 9.8263821,3.835781 13.3532422,7.714447 0.9562372,0.941951 1.1334832,2.418823 0.726893,3.660506 -0.8558251,1.291309 -2.5651654,1.912147 -4.0524577,1.426377 -3.3475043,-0.746987 -6.47492754,-2.738208 -10.0227355,-2.493827 -1.445328,0.122152 -3.022692,-0.281496 -4.294214,0.593817 -3.0214816,1.568617 -6.4164416,5.337521 -8.2187876,8.194845 -0.287794,0.498166 0.455109,0.773281 0.704144,0.329459 2.224367,-2.235969 5.62544,-5.774969 8.8484816,-6.365208 3.14769,-0.796891 6.1507465,0.875335 8.9649154,2.042196 2.6845257,1.133572 5.923729,2.125007 8.666805,0.610677 1.772347,-1.050259 3.434492,-2.709662 3.80605,-4.803745 C 14.414205,25.24877 13.496306,23.072776 11.96784,21.472658 9.9061014,19.059734 7.3889723,17.067643 4.5709223,15.607465 1.0546782,13.516456 -3.0068374,12.068546 -5.7909304,8.9470276 c -0.931413,-0.983997 -1.204412,-2.343157 -1.074991,-3.655298 -0.109406,-1.958148 1.689142,-3.544762 3.455211,-4.05794 1.9587787,-0.60507903 4.10477096,-0.06725 5.6833074,1.199429 3.4282129,2.513868 5.9281636,6.080864 8.624501,9.3360924 3.273305,4.008806 6.238015,8.517505 10.721774,11.294031 2.276239,1.414926 4.953703,2.192855 7.642866,1.963002 4.548185,-0.232438 8.85818,-3.026437 11.025851,-7.019735 1.210869,-2.143756 1.909183,-4.603866 1.660097,-7.07824 -0.134153,-3.2577364 -1.587031,-6.3466334 -3.502273,-8.9309574 -2.401489,-2.96096703 -5.537714,-5.364933 -9.180078,-6.572149 -3.676202,-1.468012 -7.591192,-2.436022 -11.064671,-4.338378 -1.417331,-0.943391 -3.065276,-2.2382366 -3.026529,-4.1028906 -0.143068,-1.171693 0.13857,-2.424681 1.108429,-3.180572 1.558316,-1.505318 4.00102,-1.082782 5.691166,-0.02563 3.344403,1.859937 6.302288,4.662512 10.142339,5.46774 3.494023,0.469424 7.010417,-1.105075 9.560216,-3.423355 1.542794,-1.223767 2.791627,-2.866633 4.545408,-3.799806 2.485015,-0.583322 4.887476,-2.090197 5.92952,-4.507807 1.345967,-2.804689 2.038157,-6.017049 1.62036,-9.117609 -0.338164,-1.227817 -1.17646,-2.28983 -2.557833,-2.279628 z"
+ id="path1082"
+ sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccccccccccccccccc" />
+ <path
+ style="opacity:1;fill:#ffffff;stroke:none;stroke-width:0.0854755;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers fill stroke;stop-color:#000000"
+ d="m 43.825045,2.2825516 c -1.995724,0.2850841 -3.655182,1.632123 -4.966941,3.0876139 -0.638109,0.7364646 -1.484088,1.5476901 -1.320681,2.6135336 v 2.3632639 c -1.160076,1.073308 -2.546958,2.207479 -4.228032,2.117521 -1.426304,0.0618 -2.440322,-1.119705 -3.467951,-1.923436 -1.848633,-1.6226525 -4.055354,-3.1268303 -6.605133,-3.1723716 -2.512561,-0.013132 -4.787673,1.6097563 -6.099554,3.6694306 -0.867467,1.331994 -0.680749,2.998471 -0.600588,4.503828 0.282549,1.061577 0.86801,2.032866 1.459427,2.952242 1.377282,1.810036 3.289485,3.151381 5.38846,3.999318 2.300756,1.060612 4.873267,1.557205 6.980943,3.012677 1.301158,0.961202 2.590863,2.257468 2.825452,3.928266 0.103458,1.052519 0.104496,2.27436 -0.745258,3.046227 -1.287695,1.309719 -3.470703,1.364448 -4.953305,0.353359 -2.289592,-1.495573 -3.883285,-3.782859 -5.631595,-5.8354 -1.857477,-2.20113 -3.599615,-4.624571 -6.077878,-6.175573 -2.055978,-1.249029 -4.716205,-2.004691 -7.0255164,-1.005172 -2.0776806,0.943179 -3.971306,2.814902 -4.2091664,5.180281 -0.2130264,1.859463 0.4160051,3.825148 1.7999077,5.113854 1.0848617,1.133576 2.2041727,2.317972 3.6989021,2.899905 2.82869,1.321787 5.985053,2.336297 8.133193,4.698715 0.582425,0.573724 0.690382,1.473257 0.442736,2.229541 -0.521266,0.786511 -1.562391,1.164651 -2.468271,0.868778 -2.038898,-0.454975 -3.943749,-1.667788 -6.104648,-1.51894 -0.8803204,0.0744 -1.8410612,-0.171454 -2.61552,0.361682 -1.840324,0.955413 -3.9081268,3.250977 -5.0058995,4.991316 -0.1752894,0.303423 0.2771976,0.47099 0.4288799,0.200667 1.3548176,-1.361884 3.4263435,-3.517418 5.3894336,-3.876921 1.917195,-0.48537 3.746297,0.533149 5.460351,1.243861 1.635091,0.690436 3.608025,1.294299 5.278778,0.371951 1.079501,-0.639692 2.09188,-1.650401 2.318189,-2.925865 0.107424,-1.358373 -0.45165,-2.683727 -1.382608,-3.658327 C 18.665388,34.528713 17.132255,33.31537 15.415837,32.426005 13.274163,31.152413 10.800375,30.27052 9.1046396,28.369266 8.5373348,27.769933 8.3710562,26.942096 8.4498841,26.142897 c -0.066637,-1.192669 1.0288226,-2.159044 2.1044999,-2.47161 1.193053,-0.368542 2.500134,-0.04096 3.461589,0.730548 2.088056,1.531147 3.610726,3.703733 5.253011,5.686427 1.993705,2.441684 3.79945,5.187842 6.530418,6.878969 1.386412,0.861803 3.017202,1.335624 4.655117,1.195625 2.770209,-0.141573 5.395341,-1.843342 6.715626,-4.27558 0.737516,-1.305719 1.162845,-2.804123 1.011132,-4.311215 -0.08171,-1.984222 -0.966629,-3.865607 -2.133165,-5.439667 -1.462699,-1.803466 -3.372911,-3.267674 -5.591402,-4.002965 -2.239101,-0.894137 -4.623643,-1.483732 -6.73927,-2.642419 -0.863268,-0.574601 -1.866998,-1.363266 -1.843398,-2.498989 -0.08714,-0.713655 0.0844,-1.476825 0.675122,-1.937223 0.949139,-0.916859 2.436941,-0.659501 3.466375,-0.01561 2.037009,1.13285 3.838598,2.839843 6.177496,3.330291 2.12814,0.285917 4.269905,-0.673079 5.822937,-2.085097 0.939685,-0.745372 1.700324,-1.746009 2.768517,-2.314386 1.513573,-0.35529 2.976864,-1.273097 3.611552,-2.7456149 C 45.215843,7.5161007 45.637442,5.5595162 45.38297,3.6710273 45.177001,2.9231888 44.666412,2.2763374 43.825045,2.2825516 Z"
+ id="path1037"
+ transform="matrix(1.6418204,0,0,1.6418204,-27.194758,-37.630212)"
+ sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccccccccccccccccc" />
+ <path
+ style="fill:#000000;stroke-width:0.264583"
+ d="m -23.233067,35.174972 c 1.570567,-3.383914 4.750398,-6.65347 7.851775,-8.073328 3.030905,-1.387594 6.3229515,-1.183383 11.3114035,0.70167 4.28323598,1.618565 5.705728,1.602245 6.95427,-0.07979 0.717731,-0.966925 0.453372,-1.813684 -1.078068,-3.453148 -2.14556702,-2.296909 -5.185283,-4.100047 -10.638702,-6.310802 -1.5279695,-0.619421 -3.5192155,-1.592008 -4.4249925,-2.161307 -2.174129,-1.36648 -4.88279,-4.326505 -5.958359,-6.5112927 -0.814543,-1.65457 -0.861441,-1.90889 -0.861441,-4.671378 0,-2.766999 0.04592,-3.01481 0.867985,-4.68467199 1.07357,-2.18073101 2.835994,-3.82296001 5.53354,-5.15616001 1.716275,-0.848228 2.285611,-0.993241 4.2716325,-1.088009 1.961023,-0.09357 2.596631,-0.0076 4.408093,0.596389 4.81944098,1.606875 7.595541,3.971266 13.9955692,11.919952 4.7266033,5.8703337 6.8314413,8.1072787 8.9344103,9.4951877 2.802347,1.849477 5.549352,1.773793 7.536464,-0.207644 2.592509,-2.585101 1.964976,-6.3346477 -1.608149,-9.6087717 -1.969982,-1.80513 -4.415917,-3.064846 -8.61767,-4.438316 -9.2941323,-3.038065 -14.59932452,-7.721851 -15.88049252,-14.0203873 -0.98127898,-4.824199 1.71786502,-9.84468 6.58636522,-12.250822 1.93425,-0.955959 2.073479,-0.983829 4.9147813,-0.983829 2.56689,0 3.127097,0.08551 4.585401,0.699925 2.514245,1.059305 4.258733,2.207202 6.822165,4.489079 1.280268,1.13965 2.752742,2.282361 3.272164,2.539357 2.09079,1.034466 5.394375,0.189297 7.416996,-1.897519 0.907661,-0.936468 0.90976,-0.944466 0.922737,-3.517014 0.01162,-2.303214 0.08807,-2.705489 0.716272,-3.769037 1.509415,-2.55543 5.589025,-5.848754 8.367222,-6.75456 2.531257,-0.825294 4.177041,-0.07508 4.806345,2.190933 0.735306,2.647706 -0.385077,7.877416 -2.352095,10.979082 -0.896916,1.41429 -2.852776,2.665436 -4.910154,3.14098 -1.068725,0.247028 -1.520072,0.540284 -2.348988,1.526236 -2.565226,3.051193 -6.19952,5.314822 -9.340986,5.818054 -3.43376,0.5500563 -6.284999,-0.395671 -10.614847,-3.520839 -1.353589,-0.976987 -2.960933,-2.003271 -3.571875,-2.280634 -4.451654,-2.021021 -7.5476413,2.548422 -3.978695,5.872255 1.167275,1.0871063 3.600757,2.1863473 8.731705,3.9442423 6.926578,2.37309 9.911615,4.110448 12.587874,7.32642901 2.645963,3.17957399 4.373776,8.10335599 4.076721,11.61751069 -0.364397,4.310813 -2.785417,8.399398 -6.338438,10.704271 -2.397205,1.555083 -4.621189,2.202902 -7.591011,2.21117 -2.957021,0.0082 -4.662199,-0.44778 -7.106632,-1.900512 -3.45037,-2.050559 -5.011187,-3.693941 -11.1450625,-11.734632 -3.41937902,-4.4823457 -7.896904,-9.0004687 -9.794139,-9.8829437 -1.839013,-0.855393 -2.725224,-0.854398 -4.4498045,0.005 -0.984454,0.490574 -1.566752,1.007922 -2.036324,1.809183 -0.812347,1.386168 -0.82778,2.264484 -0.06657,3.788669 1.000043,2.002394 2.9483845,3.5061707 7.4263035,5.7318057 5.08287398,2.526312 7.6616,4.20893 9.9258172,6.476578 2.394628,2.398257 3.338616,4.30811 3.348419,6.774436 0.0062,1.550858 -0.110673,2.052873 -0.718376,3.08664 -0.929552,1.581264 -2.580118,2.990686 -4.1147412,3.513582 -2.46524802,0.839994 -5.262071,0.381992 -9.572903,-1.567643 -3.559355,-1.60977 -4.3273665,-1.811941 -6.2859925,-1.65472 -2.911165,0.23368 -5.083561,1.516192 -8.233595,4.860847 -2.387613,2.535128 -3.219164,3.086824 -3.211319,2.130572 0.0013,-0.173312 0.306515,-0.969957 0.677987,-1.770321 z m 2.295991,-1.345569 c 2.77492,-2.898053 5.359749,-4.33148 8.379991,-4.647157 1.809462,-0.189127 3.4628885,0.239926 6.7509205,1.751814 4.528291,2.08218 7.157365,2.402631 9.624663,1.173125 1.4190082,-0.707123 2.9808232,-2.343279 3.4733232,-3.638656 0.876882,-2.306375 -0.10899,-5.077581 -2.796855,-7.861725 -2.3309662,-2.414461 -4.65393022,-3.971325 -9.7976632,-6.566444 -6.1881545,-3.122054 -8.4055855,-5.3408917 -8.4055855,-8.4109257 0,-3.675928 4.4844635,-6.11780399 8.0508935,-4.383863 2.783342,1.353214 5.76770398,4.43747 11.3253172,11.7044007 1.836311,2.401095 4.176755,5.239188 5.2009863,6.306872 4.818551,5.022985 9.920009,6.682316 15.148307,4.927232 4.41307,-1.481418 7.391988,-4.551558 8.809391,-9.079162 1.787508,-5.7098217 -1.418224,-13.1198507 -7.394823,-17.0930847 -2.201397,-1.463487 -3.310034,-1.94841 -8.530594,-3.731313 -5.325798,-1.818845 -7.278245,-2.714536 -8.68563,-3.984557 -1.3344683,-1.2042253 -1.8500383,-2.2880083 -1.8500383,-3.8889863 0,-1.411261 0.800079,-2.696736 2.1125393,-3.394178 2.016815,-1.071737 4.043918,-0.482716 7.941627,2.30763 4.697439,3.362864 7.223206,4.234404 10.381204,3.58213 2.868634,-0.592508 4.834754,-1.758587 7.742753,-4.592124 1.455208,-1.417947 2.849726,-2.578807 3.098928,-2.579688 0.996369,-0.0035 3.371348,-1.127103 4.310618,-2.03931 2.375494,-2.307051 4.06452,-9.128666 2.931602,-11.840119 -0.742117,-1.776137 -2.341645,-1.926737 -5.212053,-0.490731 -1.435715,0.718259 -2.555838,1.577292 -4.226242,3.241146 -2.671886,2.661408 -3.054212,3.579407 -2.81393,6.756493 l 0.14806,1.957688 -1.309753,1.225121 c -2.608242,2.439705 -5.942822,3.263564 -8.304313,2.051709 -0.582083,-0.298709 -2.010832,-1.395802 -3.174999,-2.437983 -3.615068,-3.236268 -6.291125,-4.729362 -9.559163,-5.333491 -4.3569913,-0.805433 -9.6138605,2.149913 -11.68450552,6.568884 -0.621636,1.326635 -0.716748,1.863162 -0.716748,4.043157 0,2.341716 0.06509,2.649193 0.952116,4.497916 2.45885502,5.1246893 6.36795522,8.0132003 14.67773952,10.84567331 4.783897,1.63064099 6.640155,2.60648699 8.811859,4.63245199 2.208456,2.060252 3.206737,4.060103 3.207033,6.4246437 2.41e-4,1.919686 -0.406474,3.051617 -1.484103,4.130412 -1.153657,1.154903 -2.651124,1.735619 -4.492698,1.74226 -3.544377,0.01278 -6.498987,-2.438896 -13.3999893,-11.1190487 -5.6999272,-7.16942499 -8.36849022,-9.549342 -12.6438712,-11.276245 -4.59623,-1.8565 -8.7985995,-0.996241 -12.3855135,2.535414 -3.217987,3.168412 -3.78523,7.813612 -1.450623,11.87926 1.02925,1.7924057 4.440499,5.0642617 6.3018,6.0442897 0.873125,0.459724 2.9292455,1.373466 4.5691535,2.030534 4.953601,1.98478 8.7571,4.4029 10.365502,6.589988 0.630507,0.857358 0.808053,1.371978 0.808053,2.342166 0,1.088294 -0.1148,1.344181 -0.920385,2.051491 -1.712007,1.503164 -2.76666502,1.420421 -8.207739,-0.643943 -2.462126,-0.93414 -2.847914,-1.004935 -5.5562505,-1.019614 -2.684965,-0.01455 -3.030072,0.04298 -4.455089,0.742699 -1.937652,0.951434 -4.663069,3.479813 -6.166836,5.720992 -0.633616,0.944333 -1.152033,1.774301 -1.152033,1.844373 0,0.07007 0.74414,-0.649753 1.653646,-1.599617 z"
+ id="path1006" />
+ <path
+ style="opacity:1;fill:#008000;stroke:none;stroke-width:0.513781;stroke-linejoin:round;paint-order:markers fill stroke;stop-color:#000000"
+ d="m 44.462503,-32.40551 c -1.685387,0.262236 -3.172189,1.272357 -4.518349,2.270326 -1.5865,1.415209 -3.255592,2.892774 -4.163635,4.854744 -0.07709,1.692436 0.154239,3.430099 -0.117088,5.094051 -0.974704,1.407035 -2.428873,2.513821 -3.945925,3.332256 -2.420863,1.30273 -5.660063,1.688867 -7.941233,-0.119213 -3.360741,-2.44697 -6.285611,-5.813792 -10.479711,-6.834608 -3.6296997,-1.078706 -7.5676397,0.610187 -9.9443597,3.404919 -1.28122,1.390906 -2.29068,3.222047 -2.1317,5.139173 -0.10892,1.626165 -0.0602,3.332896 0.83382,4.757137 1.50072,3.186371 4.04187,5.6899709 7.16437,7.2937065 4.2520297,2.39653781 9.1670897,3.29971623 13.3744997,5.7773288 2.365021,1.5398066 4.562771,3.6043262 5.661081,6.251561 0.72219,2.1349027 0.81066,4.6557487 -0.28197,6.6824757 -2.04443,3.461067 -7.011291,4.215962 -10.333421,2.22758 -3.58891,-2.200193 -6.21362,-5.598621 -8.8882797,-8.777569 -3.03664,-3.6228832 -5.84185,-7.5491884 -9.63434997,-10.4375 -2.81435803,-1.9092824 -6.25983803,-3.5548476 -9.74028833,-2.817265 -3.02056,0.6273274 -5.6521,2.7823275 -7.07516,5.4900956 -1.50412,3.122711 -0.65931,7.025446 1.70003,9.4888544 1.67671,1.938573 3.73344,3.750346 6.1915503,4.792085 4.10949,1.845074 8.459418,3.41084 11.932108,6.378922 1.36296,1.195727 2.89368,2.662512 2.79117,4.638437 0.0558,1.015415 0.11439,2.177227 -0.8664,2.794979 -1.09608,1.142193 -2.67706,1.941113 -4.28881997,1.570667 -3.32810803,-0.472758 -6.28647803,-2.480874 -9.68221803,-2.614113 3.25425,0.692783 6.08254,2.710516 9.35795803,3.316944 1.45112,0.05081 3.06079997,0.243541 4.27620997,-0.737571 1.09833,-0.80664 2.32532,-1.799349 2.60167,-3.197733 0.25188,-1.608567 -0.23298,-3.24243 -1.25583,-4.498437 -2.34991,-3.279981 -5.84713997,-5.446604 -9.375128,-7.263274 -3.08718,-1.729429 -6.4846203,-3.188246 -8.8902303,-5.8698894 -1.62493,-1.8465223 -2.07161,-4.6628928 -1.02087,-6.8930191 1.55079,-3.00061152 5.4606003,-4.2649477 8.5529603,-3.04347554 3.03557,1.22680634 5.25682803,3.79567694 7.390838,6.17881394 3.93572,4.5034021 7.21243,9.6087291 11.5385397,13.7077151 2.71201,2.458044 6.34215,4.197998 10.077211,3.675639 5.87405,-0.611286 10.976513,-6.047007 10.795056,-12.019877 0.0089,-3.2351075 -1.397257,-6.3191646 -3.323496,-8.8564499 -2.17092,-2.66390752 -5.0045,-4.8057434 -8.270741,-5.9263943 -4.12286,-1.6717317 -8.58359,-2.6653419 -12.35734,-5.1010568 -2.4408797,-1.5037369 -3.7127297,-4.861515 -2.3696297,-7.495713 1.13901,-2.437999 4.2636097,-3.425732 6.6896397,-2.416885 3.89886,1.503058 6.84632,4.876923 10.926421,5.979312 3.49925,0.679346 6.999676,-1.07902 9.441265,-3.49198 1.527328,-1.226676 2.78494,-2.909805 4.639098,-3.66086 1.919525,-0.427863 3.878309,-1.483404 4.741372,-3.335795 1.284843,-2.595908 2.144811,-5.57444 1.714095,-8.484984 -0.08339,-0.629369 -0.46868,-1.356193 -1.225568,-1.20937 -0.08985,-0.0039 -0.179515,0.0019 -0.269222,0.0053 z"
+ id="path1008" />
+ </g>
+ </g>
+</svg>new file mode 100644
index 0000000..32a6b5d
Binary files /dev/null and b/src/splash.jpg differMake the SVG element fill it's parent
On by
So that snake goes all the way to the edge.
index 021cb71..c52f081 100644
--- a/src/Game.elm
+++ b/src/Game.elm
@@ -177,6 +177,8 @@ areaView area letters snake =
= ]
= |> Svg.svg
= [ Svg.Attributes.viewBox viewbox
+ , Html.Attributes.style "width" "100%"
+ , Html.Attributes.style "height" "100%"
= ]
=
=Tweak the icon. Make the background red.
On by
index 94af2af..e508bd9 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,7 @@ android: \
= resources/splash.png \
= resources/icon.png \
= resources/android/icon-foreground.png \
- resources/android/icon-background.png
+ resources/android/icon-background.png \
=
= npx cordova-res android --skip-config --copy
= cap sync android
@@ -54,6 +54,7 @@ resources/android/icon-foreground.png: src/icon.svg
= --export-area-page \
= --export-id-only \
= --export-id=foreground \
+ --export-background='hsl(0,100%,50%)' \
= --export-filename=$@ \
= $<
=index 2071848..b990c78 100644
--- a/src/icon.svg
+++ b/src/icon.svg
@@ -39,9 +39,9 @@
= borderopacity="1.0"
= inkscape:pageopacity="0"
= inkscape:pageshadow="2"
- inkscape:zoom="4.5532119"
- inkscape:cx="31.7847"
- inkscape:cy="25.706229"
+ inkscape:zoom="7.4683446"
+ inkscape:cx="36.688468"
+ inkscape:cy="29.961429"
= inkscape:document-units="mm"
= inkscape:current-layer="background"
= inkscape:document-rotation="0"
@@ -51,9 +51,9 @@
= inkscape:snap-nodes="false"
= inkscape:snap-others="true"
= inkscape:window-width="1440"
- inkscape:window-height="875"
+ inkscape:window-height="805"
= inkscape:window-x="0"
- inkscape:window-y="25"
+ inkscape:window-y="23"
= inkscape:window-maximized="0"
= inkscape:pagecheckerboard="true">
= <inkscape:grid
@@ -82,26 +82,18 @@
= id="background"
= style="display:inline">
= <g
- id="g1040"
- style="opacity:1;stroke:none"
- transform="matrix(0.52349013,0,0,0.52349013,3.0217034,2.8936359)">
- <g
- id="g1048"
- style="opacity:1"
- transform="translate(-5.2916667)">
- <g
- id="g1063"
- transform="matrix(0.94438426,0,0,0.9033241,0.61159007,0.84416502)">
- <path
- id="path1059"
- style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#4d4d4d;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.264583;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
- d="M 11.642578,-0.03710937 C 11.253011,0.03474735 10.994195,-0.12081035 10.839844,0.01757813 10.147932,0.07831657 9.5602578,0.37947463 8.9269751,0.60205715 8.2130181,0.93339727 7.5199128,1.3402485 7.0719364,2.0090639 6.4918515,2.3938021 6.235959,3.0581154 5.9037367,3.6399843 5.6514986,4.2016922 5.4534975,4.7954266 5.3201765,5.3937971 5.2862286,5.9854982 5.2196966,6.5758852 5.314917,7.1686196 c 0.047415,0.922153 0.4507125,1.7787465 0.8593821,2.5889033 0.4670973,0.7757341 1.1301983,1.4320871 1.8731697,1.9441551 0.8167275,0.587999 1.7751869,0.95666 2.7767882,1.059116 1.46464,0.17009 3.009155,-0.141365 4.254126,-0.946401 0.952359,-0.438463 1.53378,-1.343551 2.130601,-2.1600961 C 17.850243,8.4349394 18.253849,7.0426721 18.062482,5.6574635 17.909371,4.5707338 17.594559,3.4813042 16.912582,2.6013095 16.300388,1.6117613 15.2791,0.98132758 14.269579,0.46040693 13.713357,0.12424447 13.012091,0.19681636 12.446981,-0.03523438 c -0.261535,0.14011402 -0.597522,-0.08610833 -0.804403,-0.001875 z m 0.5625,0.18749999 c 0.585591,0.0674727 1.16217,0.21953871 1.71624,0.41958542 0.537564,0.21850982 1.094673,0.44140996 1.547233,0.86169156 0.596905,0.5897057 1.263291,1.1381945 1.624787,1.9170945 0.736684,1.2678369 0.997207,2.7937395 0.694203,4.2313151 -0.07464,0.931895 -0.546377,1.7880094 -1.093996,2.5285748 -0.465132,0.605934 -0.977343,1.168252 -1.639445,1.568573 -0.724365,0.441479 -1.491628,0.721857 -2.331754,0.852587 -0.794766,0.04048 -1.600475,0.174889 -2.378713,-0.07228 C 9.5183199,12.318128 8.7568375,11.908873 8.0657051,11.45239 7.4661492,11.021029 6.9715471,10.493782 6.5488611,9.8886297 6.1762375,9.3814974 5.9627098,8.7712469 5.6929907,8.20481 5.6014877,7.6800051 5.5457126,7.1482857 5.4632626,6.621874 5.4483218,5.8791802 5.4822494,5.124767 5.7835268,4.4338728 5.9333025,3.738304 6.3749645,3.1473694 6.725233,2.540667 7.2145535,1.8429828 7.9419422,1.3936241 8.6351965,0.92664643 9.2071001,0.61354832 9.8172743,0.43205689 10.439086,0.24414062 c 0.437861,0.0234623 1.031363,-0.14405959 1.509924,-0.0781755 0.264717,0.12901161 -0.01801,-0.17320827 0.256068,-0.0155745 z m 2.138672,0.67382813 c 0.05027,0.0301034 0.05614,-0.0549382 0,0 z m 1.251953,0.83593745 c 0.06013,-3.697e-4 -0.05032,-0.071572 0,0 z" />
- <path
- style="opacity:1;fill:#ffffff;stroke:none;stroke-width:0.033445;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers fill stroke;stop-color:#000000"
- d="m 12.115069,0.11658398 c -0.06653,0.005283 -0.01096,0.13587445 -0.101643,0.0835543 C 11.600004,0.08583162 11.167435,0.213711 10.748531,0.22828745 10.091212,0.29740737 9.4632663,0.54893185 8.8633458,0.82665155 8.205652,1.190587 7.5684079,1.6217132 7.0411036,2.174853 6.5605953,2.739949 6.1891123,3.4037976 5.8940281,4.0918611 5.5700622,4.933583 5.3799745,5.8488467 5.4987897,6.7575463 c 0.059903,0.4968712 0.1075494,1.0037745 0.2185398,1.4880147 0.3206723,0.7373509 0.6524489,1.4847247 1.1840831,2.086393 1.0079849,1.252768 2.4989777,2.039476 4.0437404,2.242173 1.026251,0.0329 2.077784,-0.0011 3.048851,-0.388217 1.038678,-0.364013 1.937126,-1.081429 2.612388,-1.975413 0.59345,-0.7673673 1.071456,-1.6660521 1.191349,-2.6578429 0.23228,-1.3637336 0.05592,-2.8197654 -0.616364,-4.0262285 C 16.917992,2.9749286 16.55197,2.4867976 16.114685,2.0743782 15.959529,1.9179735 15.778485,1.7416877 15.610088,1.6258387 15.555459,1.4517408 15.349203,1.368269 15.22693,1.2451598 14.971112,1.0680123 14.696246,0.87777245 14.393632,0.81413915 14.335748,0.82497995 14.330552,0.70831955 14.254871,0.71228435 13.577398,0.39658013 12.836532,0.26821459 12.115069,0.11658398 Z"
- id="path1072" />
- </g>
- </g>
+ id="g872"
+ transform="translate(10.583333)">
+ <path
+ style="opacity:1;fill:#ff0000;stroke:none;stroke-width:0.040314;stroke-linejoin:round;paint-order:markers fill stroke;stop-color:#000000"
+ d="m -4.0301949,3.3698849 c -0.033265,-0.00477 -0.02691,0.049032 -0.058415,0.0305 -0.2644394,-0.024146 -0.5291286,0.01719 -0.7916976,0.04397 -0.255523,0.060265 -0.5067538,0.1443091 -0.7458332,0.253128 -0.2847964,0.1430527 -0.5480828,0.3274718 -0.7946294,0.5286348 -0.243899,0.1949376 -0.3927891,0.4746633 -0.5547567,0.7351548 -0.1371039,0.2281518 -0.210535,0.4871236 -0.2899047,0.739166 -0.086071,0.3528941 -0.08317,0.7232258 -0.02009,1.0796941 0.032504,0.2155582 0.049417,0.4404699 0.1590733,0.6343674 0.1246859,0.2765399 0.268542,0.5471536 0.4687906,0.7772196 0.2824834,0.3498268 0.6480214,0.6272242 1.0537991,0.8191394 0.250643,0.128205 0.5224016,0.2068979 0.7980514,0.2596955 0.3142218,0.075129 0.6401821,0.036606 0.9587235,0.019039 0.5332367,-0.042381 1.0506387,-0.2418493 1.4880625,-0.5471099 0.3281811,-0.2440144 0.5944505,-0.5632553 0.8187606,-0.9030163 0.179765,-0.2766002 0.3082472,-0.5896266 0.3464362,-0.9184198 0.071894,-0.3595129 0.070448,-0.7332004 0.00629,-1.0937047 C -1.2697376,5.4069958 -1.4574829,5.0119999 -1.6979307,4.6597966 -1.9140566,4.3969889 -2.1619901,4.1606708 -2.4221584,3.9418783 -2.6937057,3.7331501 -3.0233169,3.6175666 -3.3468762,3.5164453 c -0.2079596,-0.06669 -0.42478,-0.095524 -0.6378411,-0.1389764 -0.014756,-0.00417 -0.029959,-0.0088 -0.045478,-0.00758 z"
+ id="path892"
+ sodipodi:nodetypes="ccccccccccccccccccccccc" />
+ <path
+ id="path1059"
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#4d4d4d;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.127928;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000"
+ d="m -4.2557946,3.3179997 c -0.1925925,0.03398 -0.3205448,-0.039581 -0.3968522,0.025861 -0.3420646,0.028722 -0.6325965,0.171134 -0.9456762,0.2763891 -0.3529631,0.1566846 -0.6956177,0.3490769 -0.9170864,0.6653471 -0.28678,0.1819355 -0.4132871,0.4960768 -0.5775297,0.7712317 -0.1247005,0.2656212 -0.2225874,0.546387 -0.2884981,0.8293452 -0.016783,0.2798044 -0.049675,0.5589873 -0.0026,0.8392803 0.023441,0.4360689 0.2228214,0.8411359 0.4248578,1.2242438 0.2309216,0.3668301 0.5587427,0.6772072 0.9260499,0.9193545 0.4037704,0.2780537 0.8776095,0.4523866 1.372777,0.5008361 0.7240824,0.080432 1.4876533,-0.066849 2.1031368,-0.4475356 C -2.0863924,8.715012 -1.7989519,8.2870129 -1.503898,7.900884 -1.186875,7.3242727 -0.98734197,6.6658956 -1.0819492,6.0108564 -1.1576436,5.4969623 -1.313279,4.9817915 -1.650432,4.5656585 -1.9530859,4.0977197 -2.457986,3.7995994 -2.9570688,3.5532658 -3.2320515,3.3943009 -3.5787405,3.4286188 -3.8581172,3.3188863 -3.9874138,3.3851436 -4.1535177,3.2781673 -4.2557946,3.3179997 Z m 0.2780864,0.088665 c 0.289502,0.031907 0.5745487,0.1038159 0.8484676,0.1984143 0.2657586,0.1033292 0.5411798,0.2087345 0.7649146,0.4074778 0.2950954,0.2788607 0.6245405,0.5382308 0.8032554,0.906558 0.3641988,0.5995363 0.4929951,1.321107 0.3431972,2.0009096 -0.0369,0.4406757 -0.2701156,0.8455161 -0.5408452,1.1957156 -0.22995,0.2865348 -0.4831748,0.5524445 -0.810502,0.7417488 -0.3581085,0.2087671 -0.7374248,0.3413526 -1.1527628,0.4031724 -0.3929131,0.019142 -0.7912361,0.082702 -1.1759782,-0.03418 C -5.3059764,9.1605598 -5.6824349,8.9670308 -6.0241141,8.7511685 -6.3205201,8.547186 -6.5650395,8.2978607 -6.7740052,8.0116956 -6.9582213,7.7718822 -7.0637843,7.4833062 -7.1971269,7.2154488 -7.2423637,6.9672784 -7.2699376,6.7158383 -7.3106989,6.4669081 -7.3180889,6.1157021 -7.3013089,5.7589542 -7.152368,5.4322433 -7.078323,5.1033219 -6.8599755,4.82388 -6.6868112,4.5369818 -6.444903,4.20706 -6.0852995,3.9945667 -5.7425713,3.7737417 -5.459836,3.6256835 -5.1581806,3.5398596 -4.8507719,3.4509975 c 0.2164679,0.011095 0.5098809,-0.068123 0.7464698,-0.036968 0.1308697,0.061007 -0.0089,-0.081907 0.1265939,-0.00736 z"
+ sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccc" />
= </g>
= </g>
= <gMake the icon white again
On by
Red doesn't really work here.
index e508bd9..d2abf42 100644
--- a/Makefile
+++ b/Makefile
@@ -54,7 +54,6 @@ resources/android/icon-foreground.png: src/icon.svg
= --export-area-page \
= --export-id-only \
= --export-id=foreground \
- --export-background='hsl(0,100%,50%)' \
= --export-filename=$@ \
= $<
=index b990c78..ec7dc95 100644
--- a/src/icon.svg
+++ b/src/icon.svg
@@ -43,7 +43,7 @@
= inkscape:cx="36.688468"
= inkscape:cy="29.961429"
= inkscape:document-units="mm"
- inkscape:current-layer="background"
+ inkscape:current-layer="g872"
= inkscape:document-rotation="0"
= showgrid="false"
= units="px"
@@ -72,7 +72,7 @@
= <dc:format>image/svg+xml</dc:format>
= <dc:type
= rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
+ <dc:title />
= </cc:Work>
= </rdf:RDF>
= </metadata>
@@ -85,7 +85,7 @@
= id="g872"
= transform="translate(10.583333)">
= <path
- style="opacity:1;fill:#ff0000;stroke:none;stroke-width:0.040314;stroke-linejoin:round;paint-order:markers fill stroke;stop-color:#000000"
+ style="opacity:1;fill:#ffffff;stroke:none;stroke-width:0.040314;stroke-linejoin:round;paint-order:markers fill stroke;stop-color:#000000"
= d="m -4.0301949,3.3698849 c -0.033265,-0.00477 -0.02691,0.049032 -0.058415,0.0305 -0.2644394,-0.024146 -0.5291286,0.01719 -0.7916976,0.04397 -0.255523,0.060265 -0.5067538,0.1443091 -0.7458332,0.253128 -0.2847964,0.1430527 -0.5480828,0.3274718 -0.7946294,0.5286348 -0.243899,0.1949376 -0.3927891,0.4746633 -0.5547567,0.7351548 -0.1371039,0.2281518 -0.210535,0.4871236 -0.2899047,0.739166 -0.086071,0.3528941 -0.08317,0.7232258 -0.02009,1.0796941 0.032504,0.2155582 0.049417,0.4404699 0.1590733,0.6343674 0.1246859,0.2765399 0.268542,0.5471536 0.4687906,0.7772196 0.2824834,0.3498268 0.6480214,0.6272242 1.0537991,0.8191394 0.250643,0.128205 0.5224016,0.2068979 0.7980514,0.2596955 0.3142218,0.075129 0.6401821,0.036606 0.9587235,0.019039 0.5332367,-0.042381 1.0506387,-0.2418493 1.4880625,-0.5471099 0.3281811,-0.2440144 0.5944505,-0.5632553 0.8187606,-0.9030163 0.179765,-0.2766002 0.3082472,-0.5896266 0.3464362,-0.9184198 0.071894,-0.3595129 0.070448,-0.7332004 0.00629,-1.0937047 C -1.2697376,5.4069958 -1.4574829,5.0119999 -1.6979307,4.6597966 -1.9140566,4.3969889 -2.1619901,4.1606708 -2.4221584,3.9418783 -2.6937057,3.7331501 -3.0233169,3.6175666 -3.3468762,3.5164453 c -0.2079596,-0.06669 -0.42478,-0.095524 -0.6378411,-0.1389764 -0.014756,-0.00417 -0.029959,-0.0088 -0.045478,-0.00758 z"
= id="path892"
= sodipodi:nodetypes="ccccccccccccccccccccccc" />Add privacy policy
On by
index 8e8c137..6669593 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4641,6 +4641,12 @@
= "object-visit": "^1.0.0"
= }
= },
+ "marked": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/marked/-/marked-1.2.2.tgz",
+ "integrity": "sha512-5jjKHVl/FPo0Z6ocP3zYhKiJLzkwJAw4CZoLjv57FkvbUuwOX4LIBBGGcXjAY6ATcd1q9B8UTj5T9Umauj0QYQ==",
+ "dev": true
+ },
= "md5.js": {
= "version": "1.3.5",
= "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",index 3505750..0a8f646 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
= "cordova-res": "^0.15.1",
= "elm": "^0.19.1-3",
= "elm-hot": "^1.1.5",
+ "marked": "^1.2.2",
= "node-elm-compiler": "^5.0.5",
= "parcel": "^1.12.4"
= },index 96f6860..28dc0a6 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -103,7 +103,13 @@ introView =
= , Html.text " or later. "
= , Html.a [ Html.Attributes.href "https://gitlab.com/hornbook/word-snake/" ]
= [ Html.text "See the source code" ]
- , Html.text ". Have fun! "
+ , Html.text ". I respect your "
+ , Html.a
+ [ Html.Attributes.href "privacy.html"
+ , Html.Attributes.target "_blank"
+ ]
+ [ Html.text "privacy" ]
+ , Html.text ". Good luck, have fun!"
= ]
= ]
= ]new file mode 100644
index 0000000..98407fd
Binary files /dev/null and b/src/featured-image.jpg differindex c7aaf6b..1228998 100644
--- a/src/index.html
+++ b/src/index.html
@@ -43,10 +43,17 @@
= justify-content: center;
= }
=
+ #preload {
+ display: none;
+ }
= </style>
=
= </head>
= <body>
= <div id="app"></div>
+ <aside id="preload">
+ <a href="privacy.md" type="text/html" />
+ </aside>
+
= </body>
=</html>new file mode 100644
index 0000000..e29e75d
--- /dev/null
+++ b/src/privacy.md
@@ -0,0 +1,6 @@
+# Privacy Policy
+
+I do not gather or store any data about you.
+
+🙈 🙊 🙊
+Add android/app/ directory
On by
It was not added to the repository before by mistake.
Some questions about what to ignore remain. See:
https://github.com/ionic-team/cordova-res/issues/172
index 64a88fb..3c2bade 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -88,4 +88,9 @@ lint/tmp/
=capacitor-cordova-android-plugins
=
=# Copied web assets
+# See https://github.com/ionic-team/cordova-res/issues/172
=app/src/main/assets/public
+app/res/mipmap/*
+app/src/main/res/drawable-*/splash.png
+app/src/main/res/drawable/splash.png
+app/src/main/res/mipmap-*/*.pngnew file mode 100644
index 0000000..043df80
--- /dev/null
+++ b/android/app/.npmignore
@@ -0,0 +1,2 @@
+/build/*
+!/build/.npmkeepnew file mode 100644
index 0000000..4c8bdfa
--- /dev/null
+++ b/android/app/build.gradle
@@ -0,0 +1,46 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion rootProject.ext.compileSdkVersion
+ defaultConfig {
+ applicationId "io.hornbook.wordsnake"
+ minSdkVersion rootProject.ext.minSdkVersion
+ targetSdkVersion rootProject.ext.targetSdkVersion
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+repositories {
+ flatDir{
+ dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
+ }
+}
+
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
+ implementation project(':capacitor-android')
+ testImplementation "junit:junit:$junitVersion"
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
+ implementation project(':capacitor-cordova-android-plugins')
+}
+
+apply from: 'capacitor.build.gradle'
+
+try {
+ def servicesJSON = file('google-services.json')
+ if (servicesJSON.text) {
+ apply plugin: 'com.google.gms.google-services'
+ }
+} catch(Exception e) {
+ logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
+}
\ No newline at end of filenew file mode 100644
index 0000000..837cd45
--- /dev/null
+++ b/android/app/capacitor.build.gradle
@@ -0,0 +1,19 @@
+// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
+
+android {
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
+dependencies {
+
+
+}
+
+
+if (hasProperty('postBuildExtras')) {
+ postBuildExtras()
+}new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/android/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFilenew file mode 100644
index 0000000..8834b0a
--- /dev/null
+++ b/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java
@@ -0,0 +1,27 @@
+package com.getcapacitor.myapp;
+
+import android.content.Context;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() throws Exception {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+
+ assertEquals("com.getcapacitor.app", appContext.getPackageName());
+ }
+}new file mode 100644
index 0000000..f294102
--- /dev/null
+++ b/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="io.hornbook.wordsnake">
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:roundIcon="@mipmap/ic_launcher_round"
+ android:supportsRtl="true"
+ android:theme="@style/AppTheme">
+
+ <activity
+ android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
+ android:name="io.hornbook.wordsnake.MainActivity"
+ android:label="@string/title_activity_main"
+ android:theme="@style/AppTheme.NoActionBarLaunch"
+ android:launchMode="singleTask">
+
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+ <data android:scheme="@string/custom_url_scheme" />
+ </intent-filter>
+
+ </activity>
+
+ <provider
+ android:name="androidx.core.content.FileProvider"
+ android:authorities="${applicationId}.fileprovider"
+ android:exported="false"
+ android:grantUriPermissions="true">
+ <meta-data
+ android:name="android.support.FILE_PROVIDER_PATHS"
+ android:resource="@xml/file_paths"></meta-data>
+ </provider>
+ </application>
+
+ <!-- Permissions -->
+
+ <uses-permission android:name="android.permission.INTERNET" />
+ <!-- Camera, Photos, input file -->
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <!-- Geolocation API -->
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+ <uses-feature android:name="android.hardware.location.gps" />
+ <!-- Network API -->
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <!-- Navigator.getUserMedia -->
+ <!-- Video -->
+ <uses-permission android:name="android.permission.CAMERA" />
+ <!-- Audio -->
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
+ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
+</manifest>new file mode 100644
index 0000000..758c25a
--- /dev/null
+++ b/android/app/src/main/assets/capacitor.config.json
@@ -0,0 +1,13 @@
+{
+ "appId": "io.hornbook.wordsnake",
+ "appName": "word-snake",
+ "bundledWebRuntime": false,
+ "npmClient": "npm",
+ "webDir": "dist/",
+ "plugins": {
+ "SplashScreen": {
+ "launchShowDuration": 0
+ }
+ },
+ "cordova": {}
+}new file mode 100644
index 0000000..a1a4138
--- /dev/null
+++ b/android/app/src/main/java/io/hornbook/wordsnake/MainActivity.java
@@ -0,0 +1,21 @@
+package io.hornbook.wordsnake;
+
+import android.os.Bundle;
+
+import com.getcapacitor.BridgeActivity;
+import com.getcapacitor.Plugin;
+
+import java.util.ArrayList;
+
+public class MainActivity extends BridgeActivity {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Initializes the Bridge
+ this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
+ // Additional plugins you've installed go here
+ // Ex: add(TotallyAwesomePlugin.class);
+ }});
+ }
+}new file mode 100644
index 0000000..c7bd21d
--- /dev/null
+++ b/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:aapt="http://schemas.android.com/aapt"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportHeight="108"
+ android:viewportWidth="108">
+ <path
+ android:fillType="evenOdd"
+ android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
+ android:strokeColor="#00000000"
+ android:strokeWidth="1">
+ <aapt:attr name="android:fillColor">
+ <gradient
+ android:endX="78.5885"
+ android:endY="90.9159"
+ android:startX="48.7653"
+ android:startY="61.0927"
+ android:type="linear">
+ <item
+ android:color="#44000000"
+ android:offset="0.0" />
+ <item
+ android:color="#00000000"
+ android:offset="1.0" />
+ </gradient>
+ </aapt:attr>
+ </path>
+ <path
+ android:fillColor="#FFFFFF"
+ android:fillType="nonZero"
+ android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
+ android:strokeColor="#00000000"
+ android:strokeWidth="1" />
+</vector>new file mode 100644
index 0000000..d5fccc5
--- /dev/null
+++ b/android/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportHeight="108"
+ android:viewportWidth="108">
+ <path
+ android:fillColor="#26A69A"
+ android:pathData="M0,0h108v108h-108z" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M9,0L9,108"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,0L19,108"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M29,0L29,108"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M39,0L39,108"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M49,0L49,108"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M59,0L59,108"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M69,0L69,108"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M79,0L79,108"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M89,0L89,108"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M99,0L99,108"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,9L108,9"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,19L108,19"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,29L108,29"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,39L108,39"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,49L108,49"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,59L108,59"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,69L108,69"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,79L108,79"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,89L108,89"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M0,99L108,99"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,29L89,29"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,39L89,39"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,49L89,49"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,59L89,59"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,69L89,69"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M19,79L89,79"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M29,19L29,89"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M39,19L39,89"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M49,19L49,89"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M59,19L59,89"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M69,19L69,89"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+ <path
+ android:fillColor="#00000000"
+ android:pathData="M79,19L79,89"
+ android:strokeColor="#33FFFFFF"
+ android:strokeWidth="0.8" />
+</vector>new file mode 100644
index 0000000..b5ad138
--- /dev/null
+++ b/android/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".MainActivity">
+
+ <WebView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+</androidx.coordinatorlayout.widget.CoordinatorLayout>new file mode 100644
index 0000000..036d09b
--- /dev/null
+++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@color/ic_launcher_background"/>
+ <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
+</adaptive-icon>
\ No newline at end of filenew file mode 100644
index 0000000..036d09b
--- /dev/null
+++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@color/ic_launcher_background"/>
+ <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
+</adaptive-icon>
\ No newline at end of filenew file mode 100644
index 0000000..c5d5899
--- /dev/null
+++ b/android/app/src/main/res/values/ic_launcher_background.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="ic_launcher_background">#FFFFFF</color>
+</resources>
\ No newline at end of filenew file mode 100644
index 0000000..1298e11
--- /dev/null
+++ b/android/app/src/main/res/values/strings.xml
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<resources>
+ <string name="app_name">Word Snake</string>
+ <string name="title_activity_main">Word Snake</string>
+ <string name="package_name">io.hornbook.wordsnake</string>
+ <string name="custom_url_scheme">io.hornbook.wordsnake</string>
+</resources>new file mode 100644
index 0000000..bb45498
--- /dev/null
+++ b/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ <item name="colorPrimary">@color/colorPrimary</item>
+ <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+ <item name="colorAccent">@color/colorAccent</item>
+ </style>
+
+ <style name="AppTheme.NoActionBar" parent="Theme.AppCompat.NoActionBar">
+ <item name="windowActionBar">false</item>
+ <item name="windowNoTitle">true</item>
+ <item name="android:background">@null</item>
+ </style>
+
+
+ <style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar">
+ <item name="android:background">@drawable/splash</item>
+ </style>
+</resources>
\ No newline at end of filenew file mode 100644
index 0000000..1b1b0e0
--- /dev/null
+++ b/android/app/src/main/res/xml/config.xml
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='utf-8'?>
+<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+ <access origin="*" />
+
+
+</widget>
\ No newline at end of filenew file mode 100644
index 0000000..bd0c4d8
--- /dev/null
+++ b/android/app/src/main/res/xml/file_paths.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<paths xmlns:android="http://schemas.android.com/apk/res/android">
+ <external-path name="my_images" path="." />
+ <cache-path name="my_cache_images" path="." />
+</paths>
\ No newline at end of filenew file mode 100644
index 0000000..4a45edf
--- /dev/null
+++ b/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.getcapacitor.myapp;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}Drop unnecessary permissions from Android manifest
On by
index f294102..d575be1 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -44,20 +44,20 @@
=
= <!-- Permissions -->
=
- <uses-permission android:name="android.permission.INTERNET" />
+ <!-- <uses-permission android:name="android.permission.INTERNET" /> -->
= <!-- Camera, Photos, input file -->
- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <!-- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> -->
+ <!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> -->
= <!-- Geolocation API -->
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
- <uses-feature android:name="android.hardware.location.gps" />
+ <!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> -->
+ <!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> -->
+ <!-- <uses-feature android:name="android.hardware.location.gps" /> -->
= <!-- Network API -->
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> -->
= <!-- Navigator.getUserMedia -->
= <!-- Video -->
- <uses-permission android:name="android.permission.CAMERA" />
+ <!-- <uses-permission android:name="android.permission.CAMERA" /> -->
= <!-- Audio -->
- <uses-permission android:name="android.permission.RECORD_AUDIO" />
- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
+ <!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
+ <!-- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> -->
=</manifest>Merge branch 'capacitor' into 'master'
On by
Android app using capacitor
See merge request hornbook/word-snake!3
Add a password
On by
index c37f799..71624f8 100644
--- a/src/Password.elm
+++ b/src/Password.elm
@@ -75,4 +75,8 @@ passwords =
= "A group of six healthy people have "
= "six"
= " pairs of ears between them."
+ , Password
+ "The first phase of the Marmaray project opened in 2013 with an "
+ "undersea"
+ " rail tunnel across the Bosphorus strait."
= ]Add large icon and credits page, changed og:image
On by
new file mode 100644
index 0000000..211d351
--- /dev/null
+++ b/src/credits.md
@@ -0,0 +1,5 @@
+# Credits
+
+Splash screen photo by <a href="https://unsplash.com/@davidclode?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">David Clode</a> on <a href="https://unsplash.com/s/photos/snake?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
+
+Feature photo used in marketing materials by <a href="https://unsplash.com/@brookecagle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Brooke Cagle</a> on <a href="https://unsplash.com/@brookecagle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>new file mode 100644
index 0000000..a26730d
--- /dev/null
+++ b/src/icon-large.svg
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48"
+ height="48"
+ viewBox="0 0 12.7 12.7"
+ version="1.1"
+ id="svg8"
+ sodipodi:docname="icon-large.svg"
+ inkscape:version="1.0.1 (c497b03c, 2020-09-10)"
+ inkscape:export-filename="/Users/tadeusz/Projects/hornbook/word-snake/src/icon.png"
+ inkscape:export-xdpi="1024"
+ inkscape:export-ydpi="1024">
+ <defs
+ id="defs2">
+ <inkscape:path-effect
+ effect="roughen"
+ id="path-effect1046"
+ is_visible="true"
+ lpeversion="1"
+ method="size"
+ max_segment_size="0.3"
+ segments="5"
+ displace_x="0.01;1"
+ displace_y="0.01;1"
+ global_randomize="0.1;1792603870"
+ handles="smooth"
+ shift_nodes="true"
+ fixed_displacement="true"
+ spray_tool_friendly="true" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="4"
+ inkscape:cx="24"
+ inkscape:cy="29.961429"
+ inkscape:document-units="mm"
+ inkscape:current-layer="g872"
+ inkscape:document-rotation="0"
+ showgrid="false"
+ units="px"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-nodes="false"
+ inkscape:snap-others="true"
+ inkscape:window-width="1440"
+ inkscape:window-height="805"
+ inkscape:window-x="0"
+ inkscape:window-y="23"
+ inkscape:window-maximized="0"
+ inkscape:pagecheckerboard="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid833"
+ originx="6.35"
+ originy="6.35"
+ spacingx="2.38125"
+ spacingy="2.38125" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Background"
+ inkscape:groupmode="layer"
+ id="background"
+ style="display:inline">
+ <g
+ id="g872"
+ transform="translate(10.583333)">
+ <path
+ style="opacity:1;fill:#ffffff;stroke:none;stroke-width:0.0797628;stroke-linejoin:round;paint-order:markers fill stroke;stop-color:#000000"
+ d="m -3.8314214,0.45373019 c -0.065816,-0.009438 -0.053242,0.0970117 -0.1155762,0.0603454 -0.5232033,-0.0477738 -1.0469009,0.0340111 -1.5664035,0.0869963 -0.5055618,0.11923657 -1.0026314,0.28552097 -1.475659,0.50082321 -0.5634803,0.2830352 -1.0844024,0.6479153 -1.5722041,1.0459238 -0.4825633,0.3856914 -0.777148,0.9391392 -1.0976069,1.4545314 -0.2712653,0.4514069 -0.4165509,0.9637923 -0.5735869,1.4624677 -0.170295,0.6982142 -0.164555,1.4309294 -0.03975,2.1362153 0.06431,0.42649 0.09777,0.8714862 0.3147322,1.2551197 0.2466957,0.5471446 0.5313204,1.082564 0.9275198,1.5377582 0.558904,0.6921458 1.2821347,1.2409868 2.0849811,1.6206978 0.4959066,0.253659 1.0335912,0.409356 1.5789747,0.513818 0.6216996,0.148645 1.2666243,0.07243 1.8968704,0.03767 1.0550288,-0.08385 2.0787281,-0.478508 2.9441875,-1.082477 C 0.12437733,10.600827 0.65120134,9.9691967 1.0950073,9.2969668 1.4506791,8.7497029 1.704886,8.1303684 1.7804444,7.4798387 1.9226893,6.768529 1.9198284,6.0291742 1.7928894,5.3159029 1.6302471,4.4842306 1.2587859,3.7027164 0.78305088,3.0058689 0.35543767,2.485894 -0.13510807,2.0183298 -0.64986082,1.5854406 -1.1871273,1.172464 -1.8392754,0.94377773 -2.4794497,0.74370544 -2.8909055,0.61175677 -3.3198929,0.55470762 -3.7414422,0.46873542 c -0.029195,-0.008251 -0.059275,-0.0174111 -0.08998,-0.0149973 z"
+ id="path892"
+ sodipodi:nodetypes="ccccccccccccccccccccccc" />
+ <path
+ id="path1059"
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#4d4d4d;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.25311;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000"
+ d="m -4.2777789,0.35107337 c -0.3810515,0.0672307 -0.6342099,-0.0783125 -0.7851869,0.051167 -0.6767877,0.0568276 -1.251616,0.33859505 -1.8710559,0.54684621 C -7.6323725,1.2590929 -8.3103275,1.6397483 -8.7485116,2.2655007 -9.3159166,2.625467 -9.5662156,3.2470073 -9.8911758,3.7914116 -10.1379,4.3169531 -10.331573,4.8724588 -10.46198,5.4323022 c -0.03321,0.5536036 -0.09828,1.1059774 -0.0051,1.6605476 0.04638,0.8627787 0.44086,1.664219 0.8405968,2.4222124 0.4568871,0.7257868 1.1054934,1.3398798 1.8322245,1.8189778 0.7988749,0.550139 1.7363834,0.895064 2.7160908,0.990923 1.4326243,0.159137 2.943378,-0.132264 4.16113514,-0.885466 C 0.01446482,11.029265 0.58317665,10.182453 1.1669519,9.418482 1.7941938,8.2776349 2.1889774,6.9750111 2.0017935,5.6789915 1.8520292,4.6622327 1.5440988,3.6429479 0.87702885,2.8196131 0.27821674,1.8937787 -0.72074707,1.3039364 -1.7082011,0.81655619 -2.2522647,0.50203816 -2.9382019,0.56993742 -3.4909592,0.35282754 -3.7467774,0.4839201 -4.0754202,0.27226344 -4.2777789,0.35107337 Z m 0.5502044,0.17542703 c 0.5727906,0.0631292 1.1367662,0.20540366 1.678725,0.39257015 0.5258134,0.20444065 1.07074455,0.41298905 1.51341226,0.80621015 0.58385733,0.5517363 1.23567683,1.0649098 1.58927104,1.793659 0.720581,1.1862051 0.9754093,2.6138598 0.6790285,3.9588748 -0.073008,0.8718934 -0.5344338,1.6728853 -1.07008256,2.3657682 -0.45496471,0.5669203 -0.95597949,1.0930323 -1.60360864,1.4675783 -0.7085311,0.413053 -1.4590226,0.675379 -2.2807845,0.797691 -0.7773933,0.03787 -1.5654903,0.163629 -2.326717,-0.06763 C -6.355603,11.910794 -7.1004403,11.52789 -7.7764654,11.100798 -8.3629158,10.697215 -8.8467066,10.203915 -9.2601531,9.6377269 -9.6246316,9.1632471 -9.8334919,8.5922887 -10.097315,8.0623228 c -0.0895,-0.4910145 -0.144059,-0.9884982 -0.224707,-1.4810159 -0.01462,-0.6948743 0.01858,-1.4007134 0.313264,-2.0471232 0.1465007,-0.6507833 0.5785094,-1.2036696 0.9211215,-1.7713085 0.4786245,-0.6527627 1.1901135,-1.0731886 1.8682141,-1.5100992 0.5594024,-0.29293868 1.156239,-0.46274448 1.7644586,-0.63856149 0.4282899,0.0219519 1.0088185,-0.13478391 1.4769185,-0.0731426 0.2589307,0.12070464 -0.017609,-0.16205608 0.2504708,-0.014562 z"
+ sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccc" />
+ </g>
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="foreground"
+ inkscape:label="Foreground"
+ style="display:inline">
+ <g
+ id="g1010"
+ transform="matrix(0.14452192,0,0,0.14452192,4.1834935,6.1303695)">
+ <path
+ style="opacity:1;fill:#000000;stroke:none;stroke-width:0.140335;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers fill stroke;stop-color:#000000"
+ d="m 51.21374,-33.882672 c -3.27662,0.468057 -6.001152,2.679653 -8.154825,5.069308 -1.047661,1.209142 -2.436606,2.541029 -2.168321,4.290952 v 3.880055 c -1.904637,1.762179 -4.181648,3.624284 -6.941669,3.47659 -2.341735,0.101464 -4.006571,-1.838355 -5.693753,-3.157937 -3.035123,-2.664104 -6.658163,-5.133694 -10.844442,-5.208464 -4.125175,-0.02156 -7.8604997,2.64293 -10.0143728,6.024546 -1.424225,2.186895 -1.1176676,4.922951 -0.9860576,7.394476 0.4638947,1.742919 1.4251166,3.3376006 2.3961171,4.8470516 2.2612493,2.971754 5.4007433,5.174001 8.8468843,6.56616097 3.777428,1.74133503 8.001029,2.55665103 11.461454,4.94627503 2.136268,1.578121 4.253732,3.706357 4.638885,6.4495074 0.169859,1.728047 0.171564,3.734091 -1.22358,5.001358 -2.114164,2.150323 -5.698271,2.240178 -8.132437,0.580152 -3.759099,-2.455462 -6.375657,-6.210775 -9.246068,-9.5806794 -3.049644,-3.61386 -5.9099213,-7.59271503 -9.9787841,-10.139182 -3.3755466,-2.050681 -7.7431615,-3.291342 -11.5346363,-1.650312 -3.411178,1.548531 -6.5201706,4.62156397 -6.9106946,8.505091 -0.349751,3.052905 0.683006,6.280206 2.955125,8.3960304 1.7811476,1.861128 3.6188556,3.805694 6.0729326,4.761123 4.64420096,2.170137 9.8263821,3.835781 13.3532422,7.714447 0.9562372,0.941951 1.1334832,2.418823 0.726893,3.660506 -0.8558251,1.291309 -2.5651654,1.912147 -4.0524577,1.426377 -3.3475043,-0.746987 -6.47492754,-2.738208 -10.0227355,-2.493827 -1.445328,0.122152 -3.022692,-0.281496 -4.294214,0.593817 -3.0214816,1.568617 -6.4164416,5.337521 -8.2187876,8.194845 -0.287794,0.498166 0.455109,0.773281 0.704144,0.329459 2.224367,-2.235969 5.62544,-5.774969 8.8484816,-6.365208 3.14769,-0.796891 6.1507465,0.875335 8.9649154,2.042196 2.6845257,1.133572 5.923729,2.125007 8.666805,0.610677 1.772347,-1.050259 3.434492,-2.709662 3.80605,-4.803745 C 14.414205,25.24877 13.496306,23.072776 11.96784,21.472658 9.9061014,19.059734 7.3889723,17.067643 4.5709223,15.607465 1.0546782,13.516456 -3.0068374,12.068546 -5.7909304,8.9470276 c -0.931413,-0.983997 -1.204412,-2.343157 -1.074991,-3.655298 -0.109406,-1.958148 1.689142,-3.544762 3.455211,-4.05794 1.9587787,-0.60507903 4.10477096,-0.06725 5.6833074,1.199429 3.4282129,2.513868 5.9281636,6.080864 8.624501,9.3360924 3.273305,4.008806 6.238015,8.517505 10.721774,11.294031 2.276239,1.414926 4.953703,2.192855 7.642866,1.963002 4.548185,-0.232438 8.85818,-3.026437 11.025851,-7.019735 1.210869,-2.143756 1.909183,-4.603866 1.660097,-7.07824 -0.134153,-3.2577364 -1.587031,-6.3466334 -3.502273,-8.9309574 -2.401489,-2.96096703 -5.537714,-5.364933 -9.180078,-6.572149 -3.676202,-1.468012 -7.591192,-2.436022 -11.064671,-4.338378 -1.417331,-0.943391 -3.065276,-2.2382366 -3.026529,-4.1028906 -0.143068,-1.171693 0.13857,-2.424681 1.108429,-3.180572 1.558316,-1.505318 4.00102,-1.082782 5.691166,-0.02563 3.344403,1.859937 6.302288,4.662512 10.142339,5.46774 3.494023,0.469424 7.010417,-1.105075 9.560216,-3.423355 1.542794,-1.223767 2.791627,-2.866633 4.545408,-3.799806 2.485015,-0.583322 4.887476,-2.090197 5.92952,-4.507807 1.345967,-2.804689 2.038157,-6.017049 1.62036,-9.117609 -0.338164,-1.227817 -1.17646,-2.28983 -2.557833,-2.279628 z"
+ id="path1082"
+ sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccccccccccccccccc" />
+ <path
+ style="opacity:1;fill:#ffffff;stroke:none;stroke-width:0.0854755;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:markers fill stroke;stop-color:#000000"
+ d="m 43.825045,2.2825516 c -1.995724,0.2850841 -3.655182,1.632123 -4.966941,3.0876139 -0.638109,0.7364646 -1.484088,1.5476901 -1.320681,2.6135336 v 2.3632639 c -1.160076,1.073308 -2.546958,2.207479 -4.228032,2.117521 -1.426304,0.0618 -2.440322,-1.119705 -3.467951,-1.923436 -1.848633,-1.6226525 -4.055354,-3.1268303 -6.605133,-3.1723716 -2.512561,-0.013132 -4.787673,1.6097563 -6.099554,3.6694306 -0.867467,1.331994 -0.680749,2.998471 -0.600588,4.503828 0.282549,1.061577 0.86801,2.032866 1.459427,2.952242 1.377282,1.810036 3.289485,3.151381 5.38846,3.999318 2.300756,1.060612 4.873267,1.557205 6.980943,3.012677 1.301158,0.961202 2.590863,2.257468 2.825452,3.928266 0.103458,1.052519 0.104496,2.27436 -0.745258,3.046227 -1.287695,1.309719 -3.470703,1.364448 -4.953305,0.353359 -2.289592,-1.495573 -3.883285,-3.782859 -5.631595,-5.8354 -1.857477,-2.20113 -3.599615,-4.624571 -6.077878,-6.175573 -2.055978,-1.249029 -4.716205,-2.004691 -7.0255164,-1.005172 -2.0776806,0.943179 -3.971306,2.814902 -4.2091664,5.180281 -0.2130264,1.859463 0.4160051,3.825148 1.7999077,5.113854 1.0848617,1.133576 2.2041727,2.317972 3.6989021,2.899905 2.82869,1.321787 5.985053,2.336297 8.133193,4.698715 0.582425,0.573724 0.690382,1.473257 0.442736,2.229541 -0.521266,0.786511 -1.562391,1.164651 -2.468271,0.868778 -2.038898,-0.454975 -3.943749,-1.667788 -6.104648,-1.51894 -0.8803204,0.0744 -1.8410612,-0.171454 -2.61552,0.361682 -1.840324,0.955413 -3.9081268,3.250977 -5.0058995,4.991316 -0.1752894,0.303423 0.2771976,0.47099 0.4288799,0.200667 1.3548176,-1.361884 3.4263435,-3.517418 5.3894336,-3.876921 1.917195,-0.48537 3.746297,0.533149 5.460351,1.243861 1.635091,0.690436 3.608025,1.294299 5.278778,0.371951 1.079501,-0.639692 2.09188,-1.650401 2.318189,-2.925865 0.107424,-1.358373 -0.45165,-2.683727 -1.382608,-3.658327 C 18.665388,34.528713 17.132255,33.31537 15.415837,32.426005 13.274163,31.152413 10.800375,30.27052 9.1046396,28.369266 8.5373348,27.769933 8.3710562,26.942096 8.4498841,26.142897 c -0.066637,-1.192669 1.0288226,-2.159044 2.1044999,-2.47161 1.193053,-0.368542 2.500134,-0.04096 3.461589,0.730548 2.088056,1.531147 3.610726,3.703733 5.253011,5.686427 1.993705,2.441684 3.79945,5.187842 6.530418,6.878969 1.386412,0.861803 3.017202,1.335624 4.655117,1.195625 2.770209,-0.141573 5.395341,-1.843342 6.715626,-4.27558 0.737516,-1.305719 1.162845,-2.804123 1.011132,-4.311215 -0.08171,-1.984222 -0.966629,-3.865607 -2.133165,-5.439667 -1.462699,-1.803466 -3.372911,-3.267674 -5.591402,-4.002965 -2.239101,-0.894137 -4.623643,-1.483732 -6.73927,-2.642419 -0.863268,-0.574601 -1.866998,-1.363266 -1.843398,-2.498989 -0.08714,-0.713655 0.0844,-1.476825 0.675122,-1.937223 0.949139,-0.916859 2.436941,-0.659501 3.466375,-0.01561 2.037009,1.13285 3.838598,2.839843 6.177496,3.330291 2.12814,0.285917 4.269905,-0.673079 5.822937,-2.085097 0.939685,-0.745372 1.700324,-1.746009 2.768517,-2.314386 1.513573,-0.35529 2.976864,-1.273097 3.611552,-2.7456149 C 45.215843,7.5161007 45.637442,5.5595162 45.38297,3.6710273 45.177001,2.9231888 44.666412,2.2763374 43.825045,2.2825516 Z"
+ id="path1037"
+ transform="matrix(1.6418204,0,0,1.6418204,-27.194758,-37.630212)"
+ sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccccccccccccccccc" />
+ <path
+ style="fill:#000000;stroke-width:0.264583"
+ d="m -23.233067,35.174972 c 1.570567,-3.383914 4.750398,-6.65347 7.851775,-8.073328 3.030905,-1.387594 6.3229515,-1.183383 11.3114035,0.70167 4.28323598,1.618565 5.705728,1.602245 6.95427,-0.07979 0.717731,-0.966925 0.453372,-1.813684 -1.078068,-3.453148 -2.14556702,-2.296909 -5.185283,-4.100047 -10.638702,-6.310802 -1.5279695,-0.619421 -3.5192155,-1.592008 -4.4249925,-2.161307 -2.174129,-1.36648 -4.88279,-4.326505 -5.958359,-6.5112927 -0.814543,-1.65457 -0.861441,-1.90889 -0.861441,-4.671378 0,-2.766999 0.04592,-3.01481 0.867985,-4.68467199 1.07357,-2.18073101 2.835994,-3.82296001 5.53354,-5.15616001 1.716275,-0.848228 2.285611,-0.993241 4.2716325,-1.088009 1.961023,-0.09357 2.596631,-0.0076 4.408093,0.596389 4.81944098,1.606875 7.595541,3.971266 13.9955692,11.919952 4.7266033,5.8703337 6.8314413,8.1072787 8.9344103,9.4951877 2.802347,1.849477 5.549352,1.773793 7.536464,-0.207644 2.592509,-2.585101 1.964976,-6.3346477 -1.608149,-9.6087717 -1.969982,-1.80513 -4.415917,-3.064846 -8.61767,-4.438316 -9.2941323,-3.038065 -14.59932452,-7.721851 -15.88049252,-14.0203873 -0.98127898,-4.824199 1.71786502,-9.84468 6.58636522,-12.250822 1.93425,-0.955959 2.073479,-0.983829 4.9147813,-0.983829 2.56689,0 3.127097,0.08551 4.585401,0.699925 2.514245,1.059305 4.258733,2.207202 6.822165,4.489079 1.280268,1.13965 2.752742,2.282361 3.272164,2.539357 2.09079,1.034466 5.394375,0.189297 7.416996,-1.897519 0.907661,-0.936468 0.90976,-0.944466 0.922737,-3.517014 0.01162,-2.303214 0.08807,-2.705489 0.716272,-3.769037 1.509415,-2.55543 5.589025,-5.848754 8.367222,-6.75456 2.531257,-0.825294 4.177041,-0.07508 4.806345,2.190933 0.735306,2.647706 -0.385077,7.877416 -2.352095,10.979082 -0.896916,1.41429 -2.852776,2.665436 -4.910154,3.14098 -1.068725,0.247028 -1.520072,0.540284 -2.348988,1.526236 -2.565226,3.051193 -6.19952,5.314822 -9.340986,5.818054 -3.43376,0.5500563 -6.284999,-0.395671 -10.614847,-3.520839 -1.353589,-0.976987 -2.960933,-2.003271 -3.571875,-2.280634 -4.451654,-2.021021 -7.5476413,2.548422 -3.978695,5.872255 1.167275,1.0871063 3.600757,2.1863473 8.731705,3.9442423 6.926578,2.37309 9.911615,4.110448 12.587874,7.32642901 2.645963,3.17957399 4.373776,8.10335599 4.076721,11.61751069 -0.364397,4.310813 -2.785417,8.399398 -6.338438,10.704271 -2.397205,1.555083 -4.621189,2.202902 -7.591011,2.21117 -2.957021,0.0082 -4.662199,-0.44778 -7.106632,-1.900512 -3.45037,-2.050559 -5.011187,-3.693941 -11.1450625,-11.734632 -3.41937902,-4.4823457 -7.896904,-9.0004687 -9.794139,-9.8829437 -1.839013,-0.855393 -2.725224,-0.854398 -4.4498045,0.005 -0.984454,0.490574 -1.566752,1.007922 -2.036324,1.809183 -0.812347,1.386168 -0.82778,2.264484 -0.06657,3.788669 1.000043,2.002394 2.9483845,3.5061707 7.4263035,5.7318057 5.08287398,2.526312 7.6616,4.20893 9.9258172,6.476578 2.394628,2.398257 3.338616,4.30811 3.348419,6.774436 0.0062,1.550858 -0.110673,2.052873 -0.718376,3.08664 -0.929552,1.581264 -2.580118,2.990686 -4.1147412,3.513582 -2.46524802,0.839994 -5.262071,0.381992 -9.572903,-1.567643 -3.559355,-1.60977 -4.3273665,-1.811941 -6.2859925,-1.65472 -2.911165,0.23368 -5.083561,1.516192 -8.233595,4.860847 -2.387613,2.535128 -3.219164,3.086824 -3.211319,2.130572 0.0013,-0.173312 0.306515,-0.969957 0.677987,-1.770321 z m 2.295991,-1.345569 c 2.77492,-2.898053 5.359749,-4.33148 8.379991,-4.647157 1.809462,-0.189127 3.4628885,0.239926 6.7509205,1.751814 4.528291,2.08218 7.157365,2.402631 9.624663,1.173125 1.4190082,-0.707123 2.9808232,-2.343279 3.4733232,-3.638656 0.876882,-2.306375 -0.10899,-5.077581 -2.796855,-7.861725 -2.3309662,-2.414461 -4.65393022,-3.971325 -9.7976632,-6.566444 -6.1881545,-3.122054 -8.4055855,-5.3408917 -8.4055855,-8.4109257 0,-3.675928 4.4844635,-6.11780399 8.0508935,-4.383863 2.783342,1.353214 5.76770398,4.43747 11.3253172,11.7044007 1.836311,2.401095 4.176755,5.239188 5.2009863,6.306872 4.818551,5.022985 9.920009,6.682316 15.148307,4.927232 4.41307,-1.481418 7.391988,-4.551558 8.809391,-9.079162 1.787508,-5.7098217 -1.418224,-13.1198507 -7.394823,-17.0930847 -2.201397,-1.463487 -3.310034,-1.94841 -8.530594,-3.731313 -5.325798,-1.818845 -7.278245,-2.714536 -8.68563,-3.984557 -1.3344683,-1.2042253 -1.8500383,-2.2880083 -1.8500383,-3.8889863 0,-1.411261 0.800079,-2.696736 2.1125393,-3.394178 2.016815,-1.071737 4.043918,-0.482716 7.941627,2.30763 4.697439,3.362864 7.223206,4.234404 10.381204,3.58213 2.868634,-0.592508 4.834754,-1.758587 7.742753,-4.592124 1.455208,-1.417947 2.849726,-2.578807 3.098928,-2.579688 0.996369,-0.0035 3.371348,-1.127103 4.310618,-2.03931 2.375494,-2.307051 4.06452,-9.128666 2.931602,-11.840119 -0.742117,-1.776137 -2.341645,-1.926737 -5.212053,-0.490731 -1.435715,0.718259 -2.555838,1.577292 -4.226242,3.241146 -2.671886,2.661408 -3.054212,3.579407 -2.81393,6.756493 l 0.14806,1.957688 -1.309753,1.225121 c -2.608242,2.439705 -5.942822,3.263564 -8.304313,2.051709 -0.582083,-0.298709 -2.010832,-1.395802 -3.174999,-2.437983 -3.615068,-3.236268 -6.291125,-4.729362 -9.559163,-5.333491 -4.3569913,-0.805433 -9.6138605,2.149913 -11.68450552,6.568884 -0.621636,1.326635 -0.716748,1.863162 -0.716748,4.043157 0,2.341716 0.06509,2.649193 0.952116,4.497916 2.45885502,5.1246893 6.36795522,8.0132003 14.67773952,10.84567331 4.783897,1.63064099 6.640155,2.60648699 8.811859,4.63245199 2.208456,2.060252 3.206737,4.060103 3.207033,6.4246437 2.41e-4,1.919686 -0.406474,3.051617 -1.484103,4.130412 -1.153657,1.154903 -2.651124,1.735619 -4.492698,1.74226 -3.544377,0.01278 -6.498987,-2.438896 -13.3999893,-11.1190487 -5.6999272,-7.16942499 -8.36849022,-9.549342 -12.6438712,-11.276245 -4.59623,-1.8565 -8.7985995,-0.996241 -12.3855135,2.535414 -3.217987,3.168412 -3.78523,7.813612 -1.450623,11.87926 1.02925,1.7924057 4.440499,5.0642617 6.3018,6.0442897 0.873125,0.459724 2.9292455,1.373466 4.5691535,2.030534 4.953601,1.98478 8.7571,4.4029 10.365502,6.589988 0.630507,0.857358 0.808053,1.371978 0.808053,2.342166 0,1.088294 -0.1148,1.344181 -0.920385,2.051491 -1.712007,1.503164 -2.76666502,1.420421 -8.207739,-0.643943 -2.462126,-0.93414 -2.847914,-1.004935 -5.5562505,-1.019614 -2.684965,-0.01455 -3.030072,0.04298 -4.455089,0.742699 -1.937652,0.951434 -4.663069,3.479813 -6.166836,5.720992 -0.633616,0.944333 -1.152033,1.774301 -1.152033,1.844373 0,0.07007 0.74414,-0.649753 1.653646,-1.599617 z"
+ id="path1006" />
+ <path
+ style="opacity:1;fill:#008000;stroke:none;stroke-width:0.513781;stroke-linejoin:round;paint-order:markers fill stroke;stop-color:#000000"
+ d="m 44.462503,-32.40551 c -1.685387,0.262236 -3.172189,1.272357 -4.518349,2.270326 -1.5865,1.415209 -3.255592,2.892774 -4.163635,4.854744 -0.07709,1.692436 0.154239,3.430099 -0.117088,5.094051 -0.974704,1.407035 -2.428873,2.513821 -3.945925,3.332256 -2.420863,1.30273 -5.660063,1.688867 -7.941233,-0.119213 -3.360741,-2.44697 -6.285611,-5.813792 -10.479711,-6.834608 -3.6296997,-1.078706 -7.5676397,0.610187 -9.9443597,3.404919 -1.28122,1.390906 -2.29068,3.222047 -2.1317,5.139173 -0.10892,1.626165 -0.0602,3.332896 0.83382,4.757137 1.50072,3.186371 4.04187,5.6899709 7.16437,7.2937065 4.2520297,2.39653781 9.1670897,3.29971623 13.3744997,5.7773288 2.365021,1.5398066 4.562771,3.6043262 5.661081,6.251561 0.72219,2.1349027 0.81066,4.6557487 -0.28197,6.6824757 -2.04443,3.461067 -7.011291,4.215962 -10.333421,2.22758 -3.58891,-2.200193 -6.21362,-5.598621 -8.8882797,-8.777569 -3.03664,-3.6228832 -5.84185,-7.5491884 -9.63434997,-10.4375 -2.81435803,-1.9092824 -6.25983803,-3.5548476 -9.74028833,-2.817265 -3.02056,0.6273274 -5.6521,2.7823275 -7.07516,5.4900956 -1.50412,3.122711 -0.65931,7.025446 1.70003,9.4888544 1.67671,1.938573 3.73344,3.750346 6.1915503,4.792085 4.10949,1.845074 8.459418,3.41084 11.932108,6.378922 1.36296,1.195727 2.89368,2.662512 2.79117,4.638437 0.0558,1.015415 0.11439,2.177227 -0.8664,2.794979 -1.09608,1.142193 -2.67706,1.941113 -4.28881997,1.570667 -3.32810803,-0.472758 -6.28647803,-2.480874 -9.68221803,-2.614113 3.25425,0.692783 6.08254,2.710516 9.35795803,3.316944 1.45112,0.05081 3.06079997,0.243541 4.27620997,-0.737571 1.09833,-0.80664 2.32532,-1.799349 2.60167,-3.197733 0.25188,-1.608567 -0.23298,-3.24243 -1.25583,-4.498437 -2.34991,-3.279981 -5.84713997,-5.446604 -9.375128,-7.263274 -3.08718,-1.729429 -6.4846203,-3.188246 -8.8902303,-5.8698894 -1.62493,-1.8465223 -2.07161,-4.6628928 -1.02087,-6.8930191 1.55079,-3.00061152 5.4606003,-4.2649477 8.5529603,-3.04347554 3.03557,1.22680634 5.25682803,3.79567694 7.390838,6.17881394 3.93572,4.5034021 7.21243,9.6087291 11.5385397,13.7077151 2.71201,2.458044 6.34215,4.197998 10.077211,3.675639 5.87405,-0.611286 10.976513,-6.047007 10.795056,-12.019877 0.0089,-3.2351075 -1.397257,-6.3191646 -3.323496,-8.8564499 -2.17092,-2.66390752 -5.0045,-4.8057434 -8.270741,-5.9263943 -4.12286,-1.6717317 -8.58359,-2.6653419 -12.35734,-5.1010568 -2.4408797,-1.5037369 -3.7127297,-4.861515 -2.3696297,-7.495713 1.13901,-2.437999 4.2636097,-3.425732 6.6896397,-2.416885 3.89886,1.503058 6.84632,4.876923 10.926421,5.979312 3.49925,0.679346 6.999676,-1.07902 9.441265,-3.49198 1.527328,-1.226676 2.78494,-2.909805 4.639098,-3.66086 1.919525,-0.427863 3.878309,-1.483404 4.741372,-3.335795 1.284843,-2.595908 2.144811,-5.57444 1.714095,-8.484984 -0.08339,-0.629369 -0.46868,-1.356193 -1.225568,-1.20937 -0.08985,-0.0039 -0.179515,0.0019 -0.269222,0.0053 z"
+ id="path1008" />
+ </g>
+ </g>
+</svg>index 1228998..5f7c6d0 100644
--- a/src/index.html
+++ b/src/index.html
@@ -12,7 +12,7 @@
= />
= <meta
= property="og:image"
- content="https://images.unsplash.com/photo-1539389004540-770367e1bccb?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&dl=david-clode-QZePScKPb2Q-unsplash.jpg&w=1920"
+ content="featured-image.jpg"
= />
= <meta
= property="og:description"
@@ -53,6 +53,7 @@
= <div id="app"></div>
= <aside id="preload">
= <a href="privacy.md" type="text/html" />
+ <a href="credits.md" type="text/html" />
= </aside>
=
= </body>1.0.1
On by
index 6669593..475ea40 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
={
= "name": "word-snake",
- "version": "1.0.0",
+ "version": "1.0.1",
= "lockfileVersion": 1,
= "requires": true,
= "dependencies": {index 0a8f646..1cae5ca 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
={
= "name": "word-snake",
- "version": "1.0.0",
+ "version": "1.0.1",
= "description": "A word snake challenge for Hornbook - prototype",
= "main": "src/index.coffee",
= "scripts": {Amend the privacy policy, fix emoji
On by
index e29e75d..daffb94 100644
--- a/src/privacy.md
+++ b/src/privacy.md
@@ -1,6 +1,6 @@
=# Privacy Policy
=
-I do not gather or store any data about you.
+I do not gather, store or share any data about you.
=
-🙈 🙊 🙊
+🙈 🙉 🙊
=1.0.2
On by
index 475ea40..1e3f32c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
={
= "name": "word-snake",
- "version": "1.0.1",
+ "version": "1.0.2",
= "lockfileVersion": 1,
= "requires": true,
= "dependencies": {index 1cae5ca..af5de5d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
={
= "name": "word-snake",
- "version": "1.0.1",
+ "version": "1.0.2",
= "description": "A word snake challenge for Hornbook - prototype",
= "main": "src/index.coffee",
= "scripts": {Make sure that Android build has fresh assets
On by
index d2abf42..929b449 100644
--- a/Makefile
+++ b/Makefile
@@ -22,10 +22,18 @@ dist: .installed
=develop: .installed
= npx parcel --public-url=$(public-url) $(entrypoints)
=
+clean-artifacts:
+ rm -rf \
+ dist/ \
+ .cache/ \
+ elm-stuff/ \
+
=# ANDROID APP
=
=.PHONY: android
=android: \
+ clean-artifacts \
+ dist \
= resources/splash.png \
= resources/icon.png \
= resources/android/icon-foreground.png \1.0.3
On by
index 1e3f32c..b571712 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
={
= "name": "word-snake",
- "version": "1.0.2",
+ "version": "1.0.3",
= "lockfileVersion": 1,
= "requires": true,
= "dependencies": {index af5de5d..55294c6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
={
= "name": "word-snake",
- "version": "1.0.2",
+ "version": "1.0.3",
= "description": "A word snake challenge for Hornbook - prototype",
= "main": "src/index.coffee",
= "scripts": {Set release version in Gradle file
On by
index 4c8bdfa..2b5d15d 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -6,8 +6,8 @@ android {
= applicationId "io.hornbook.wordsnake"
= minSdkVersion rootProject.ext.minSdkVersion
= targetSdkVersion rootProject.ext.targetSdkVersion
- versionCode 1
- versionName "1.0"
+ versionCode 2
+ versionName "1.0.4"
= testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
= }
= buildTypes {index 216c53c..335341f 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Thu Oct 29 14:33:53 CET 2020
+#Fri Oct 30 13:34:03 CET 2020
=distributionBase=GRADLE_USER_HOME
=distributionPath=wrapper/dists
=zipStoreBase=GRADLE_USER_HOME
=zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip1.0.4
On by
index b571712..c37322c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
={
= "name": "word-snake",
- "version": "1.0.3",
+ "version": "1.0.4",
= "lockfileVersion": 1,
= "requires": true,
= "dependencies": {index 55294c6..9096462 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
={
= "name": "word-snake",
- "version": "1.0.3",
+ "version": "1.0.4",
= "description": "A word snake challenge for Hornbook - prototype",
= "main": "src/index.coffee",
= "scripts": {Swallow the letters only when the snake reaches them
On by
Draw snake above the letters
index c52f081..39a51ab 100644
--- a/src/Game.elm
+++ b/src/Game.elm
@@ -172,8 +172,8 @@ areaView area letters snake =
= |> List.map String.fromInt
= |> String.join " "
= in
- [ snakeView snake
- , lettersView letters
+ [ lettersView letters
+ , snakeView snake
= ]
= |> Svg.svg
= [ Svg.Attributes.viewBox viewbox
@@ -342,7 +342,7 @@ update msg model =
= ( { model
= | letters =
= letters
- |> updateLetters wanted snake
+ |> updateLetters wanted model.snake
= |> burnTheEdge model.area burn
= , randomness = randomness
= , snake = snakeDisplay dead snake as skull and bones emojis
On by
index 39a51ab..695b4cb 100644
--- a/src/Game.elm
+++ b/src/Game.elm
@@ -194,9 +194,9 @@ lettersView letters =
=
=snakeView : Snake -> Svg Msg
=snakeView snake =
- [ headView snake.alive snake.head
- , bodyView snake.body
- , tailView snake.tail
+ [ bodyView snake.alive snake.body
+ , tailView snake.alive snake.tail
+ , headView snake.alive snake.head
= ]
= |> Svg.g
= [ Html.Attributes.style "pointer-events" "none"
@@ -204,49 +204,111 @@ snakeView snake =
=
=
=headView : Bool -> Position -> Svg Msg
-headView alive =
+headView alive position =
= let
- color : String
- color =
+ shape =
= if alive then
- "green"
+ Svg.circle
+ [ (0.3 * scale)
+ |> String.fromFloat
+ |> Svg.Attributes.r
+ , Svg.Attributes.fill "green"
+ ]
+ []
=
= else
- "black"
+ "☠️"
+ |> Svg.text
+ |> List.singleton
+ |> Svg.text_
+ [ (0.8 * scale)
+ |> String.fromFloat
+ |> Svg.Attributes.fontSize
+ , Html.Attributes.style "text-anchor" "middle"
+ , Html.Attributes.style "dominant-baseline" "middle"
+ ]
= in
- segmentView 0.3 color
+ segmentView shape position
=
=
-bodyView : List Position -> Svg Msg
-bodyView segments =
+bodyView : Bool -> List Position -> Svg Msg
+bodyView alive segments =
= segments
- |> List.map (segmentView 0.2 "green")
+ |> List.map (bodySegmentView alive)
= |> Svg.g []
=
=
-tailView : Position -> Svg Msg
-tailView =
- segmentView 0.1 "green"
-
-
-segmentView : Float -> String -> Position -> Svg Msg
-segmentView size color ( x, y ) =
- Svg.circle
- [ -- I would prefer to have this unitless (after all we are using SVG
- -- for scaling), but Firefox does not apply transition to SVG transform
- -- attribute, and CSS property requires a unit.
- Transformations.Translate "px"
- (Basics.toFloat x * scale)
- (Basics.toFloat y * scale)
- |> Transformations.toString
- |> Html.Attributes.style "transform"
- , (size * scale)
- |> String.fromFloat
- |> Svg.Attributes.r
- , Svg.Attributes.fill color
- , Html.Attributes.style "transition" "transform 234ms linear"
- ]
- []
+tailView : Bool -> Position -> Svg Msg
+tailView alive position =
+ let
+ shape =
+ if alive then
+ Svg.circle
+ [ (0.1 * scale)
+ |> String.fromFloat
+ |> Svg.Attributes.r
+ , Svg.Attributes.fill "green"
+ ]
+ []
+
+ else
+ "🦴"
+ |> Svg.text
+ |> List.singleton
+ |> Svg.text_
+ [ (0.3 * scale)
+ |> String.fromFloat
+ |> Svg.Attributes.fontSize
+ , Html.Attributes.style "text-anchor" "middle"
+ , Html.Attributes.style "dominant-baseline" "middle"
+ ]
+ in
+ segmentView shape position
+
+
+bodySegmentView : Bool -> Position -> Svg Msg
+bodySegmentView alive position =
+ let
+ shape =
+ if alive then
+ Svg.circle
+ [ (0.2 * scale)
+ |> String.fromFloat
+ |> Svg.Attributes.r
+ , Svg.Attributes.fill "green"
+ ]
+ []
+
+ else
+ "🦴"
+ |> Svg.text
+ |> List.singleton
+ |> Svg.text_
+ [ (0.6 * scale)
+ |> String.fromFloat
+ |> Svg.Attributes.fontSize
+ , Html.Attributes.style "text-anchor" "middle"
+ , Html.Attributes.style "dominant-baseline" "middle"
+ ]
+ in
+ segmentView shape position
+
+
+segmentView : Svg Msg -> Position -> Svg Msg
+segmentView shape ( x, y ) =
+ shape
+ |> List.singleton
+ |> Svg.g
+ [ -- I would prefer to have this unitless (after all we are using SVG
+ -- for scaling), but Firefox does not apply transition to SVG transform
+ -- attribute, and CSS property requires a unit.
+ Transformations.Translate "px"
+ (Basics.toFloat x * scale)
+ (Basics.toFloat y * scale)
+ |> Transformations.toString
+ |> Html.Attributes.style "transform"
+ , Html.Attributes.style "transition" "transform 200ms linear"
+ ]
=
=
=letterView : ( Position, Char ) -> ( String, Svg Msg )Make the snake grow at the rear
On by
Improve snake growing mechanism. Instead of adding a new body segment where the head is, add one where the tail is. This look better and makes the snake longer immediately. Previously it would only grow longer after it's whole length would pass the point where it swallowed the letter.
index 695b4cb..333669a 100644
--- a/src/Game.elm
+++ b/src/Game.elm
@@ -683,7 +683,13 @@ updateSnake letters snake =
= { snake | alive = False }
=
= Just _ ->
- { snake | body = snake.head :: snake.body }
+ { snake
+ | body =
+ snake.body
+ |> List.reverse
+ |> (::) snake.tail
+ |> List.reverse
+ }
=
=
=updateWord : Char -> Snake -> Letters -> String -> StringMake the snake poop from the rear, not head
On by
Looks much better!
index 333669a..808043a 100644
--- a/src/Game.elm
+++ b/src/Game.elm
@@ -711,25 +711,21 @@ updateWord wanted snake letters word =
=
=updateLetters : Char -> Snake -> Letters -> Letters
=updateLetters wanted snake letters =
- letters
- |> Dict.update snake.head (updateLetter wanted)
-
-
-updateLetter : Char -> Maybe Char -> Maybe Char
-updateLetter wanted letter =
- case letter of
+ case Dict.get snake.head letters of
= Nothing ->
- Nothing
+ letters
=
= Just '🔥' ->
- letter
+ letters
=
- Just c ->
- if c == wanted then
- Nothing
+ Just letter ->
+ if letter == wanted then
+ Dict.remove snake.head letters
=
= else
- Just '💩'
+ letters
+ |> Dict.remove snake.head
+ |> Dict.insert snake.tail '💩'
=
=
=Prevent letters from spawning under the snake
On by
It looks weird!
index 808043a..cc9533e 100644
--- a/src/Game.elm
+++ b/src/Game.elm
@@ -368,7 +368,7 @@ update msg model =
= ( letters, randomness ) =
= model.letters
= |> randomDecay 0.01
- |> Random.andThen (randomSpawn 0.5 model.area needed)
+ |> Random.andThen (randomSpawn 0.5 model.area needed model.snake)
= |> (\generator -> Random.step generator model.randomness)
=
= snake : Snake
@@ -929,13 +929,19 @@ randomSpawn :
= Float
= -> Area
= -> List Char
+ -> Snake
= -> Letters
= -> Random.Generator Letters
-randomSpawn probability area needed letters =
+randomSpawn probability area needed snake letters =
= let
= perform : Bool -> Position -> Char -> Letters
= perform spawn position letter =
- if spawn then
+ if
+ spawn
+ && position
+ /= snake.head
+ && not (List.member position snake.body)
+ then
= Dict.insert position letter letters
=
= elseMove Swipe type definition to it's rightful place
On by
index cc9533e..d7aa768 100644
--- a/src/Game.elm
+++ b/src/Game.elm
@@ -35,13 +35,6 @@ type alias Model =
= }
=
=
-type alias Swipe =
- { identifier : Int
- , from : ( Float, Float )
- , to : ( Float, Float )
- }
-
-
=type alias Area =
= { width : Int
= , height : Int
@@ -74,6 +67,13 @@ type Direction
= | West
=
=
+type alias Swipe =
+ { identifier : Int
+ , from : ( Float, Float )
+ , to : ( Float, Float )
+ }
+
+
=
=-- INIT
=Merge branch 'better-animations' into 'master'
On by
Better animations
See merge request hornbook/word-snake!4
Make the game over / win dialogs fade in with delay
On by
index 28dc0a6..3b69d5f 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -125,8 +125,8 @@ gameView game =
=popupView : Game.Model -> Html Msg
=popupView game =
= let
- popup : List (Html Msg) -> Html Msg
- popup elements =
+ popup : Bool -> List (Html Msg) -> Html Msg
+ popup show elements =
= elements
= |> Html.div
= [ Html.Attributes.style "text-align" "center"
@@ -142,13 +142,35 @@ popupView game =
= , Html.Attributes.style "left" "0"
= , Html.Attributes.style "bottom" "0"
= , Html.Attributes.style "right" "0"
- , Html.Attributes.style "display" "flex"
= , Html.Attributes.style "align-items" "center"
= , Html.Attributes.style "justify-content" "center"
+ , Html.Attributes.style "opacity"
+ (if show then
+ "1"
+
+ else
+ "0"
+ )
+ , Html.Attributes.style "display" "flex"
+ , Html.Attributes.style "pointer-events"
+ (if show then
+ "auto"
+
+ else
+ "none"
+ )
+ , Html.Attributes.style "visibility"
+ (if show then
+ "visible"
+
+ else
+ "hidden"
+ )
+ , Html.Attributes.style "transition" "opacity 500ms 1000ms"
= ]
= in
= if Game.snakeEscaped game then
- popup
+ popup True
= [ Html.h2 [] [ Html.text "🙏" ]
= , Html.p [] [ Html.text "Bravo! The snake is safe." ]
= , Html.button
@@ -163,7 +185,7 @@ popupView game =
= ]
=
= else if not game.snake.alive then
- popup
+ popup True
= [ Html.h2 [] [ Html.text "☠️" ]
= , Html.p [] [ Html.text "Oh, no! Your snake is dead." ]
= , Html.button
@@ -178,7 +200,7 @@ popupView game =
= ]
=
= else
- Html.div [] []
+ popup False []
=
=
=Fix a glitch when dead snake swallows fire
On by
After the password is completed the wanted letter was set to fire emoji. I thought it's funny, but the result is that running into a fire kills the snake (as it should) but also adds the fire emoji to the password every on step.
Now it's fixed by changing the default wanted letter to space.
index d7aa768..4348b81 100644
--- a/src/Game.elm
+++ b/src/Game.elm
@@ -389,7 +389,7 @@ update msg model =
= wanted =
= needed
= |> List.head
- |> Maybe.withDefault '🔥'
+ |> Maybe.withDefault ' '
=
= word : String
= word =Merge branch 'animate-dialogs' into 'master'
On by
Animate dialogs
See merge request hornbook/word-snake!5
Make the snake die only once the head reaches the danger
On by
index 4348b81..8dbe31f 100644
--- a/src/Game.elm
+++ b/src/Game.elm
@@ -375,8 +375,8 @@ update msg model =
= snake =
= model.snake
= |> setDirection direction
- |> moveSnake
= |> updateSnake letters
+ |> moveSnake
=
= needed : List Char
= needed =Fix snake pooping when correct letter is swallowed
On by
Regression was introduced when updating letters was delayed to the next step (8b8ad0f). So should have been updating the word, but it was not changed then. So now it is :)
index 8dbe31f..42d2aa8 100644
--- a/src/Game.elm
+++ b/src/Game.elm
@@ -394,7 +394,7 @@ update msg model =
= word : String
= word =
= model.word
- |> updateWord wanted snake letters
+ |> updateWord wanted model.snake letters
= |> String.toUpper
=
= burn : BoolMerge branch 'even-better-animations' into 'master'
On by
Even better animations
See merge request hornbook/word-snake!6
Bump Android app version
On by
index 2b5d15d..326a462 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -6,8 +6,8 @@ android {
= applicationId "io.hornbook.wordsnake"
= minSdkVersion rootProject.ext.minSdkVersion
= targetSdkVersion rootProject.ext.targetSdkVersion
- versionCode 2
- versionName "1.0.4"
+ versionCode 3
+ versionName "1.0.5"
= testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
= }
= buildTypes {
@@ -43,4 +43,4 @@ try {
= }
=} catch(Exception e) {
= logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
-}
\ No newline at end of file
+}1.0.5
On by
index c37322c..68e9afa 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
={
= "name": "word-snake",
- "version": "1.0.4",
+ "version": "1.0.5",
= "lockfileVersion": 1,
= "requires": true,
= "dependencies": {index 9096462..91a7daf 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
={
= "name": "word-snake",
- "version": "1.0.4",
+ "version": "1.0.5",
= "description": "A word snake challenge for Hornbook - prototype",
= "main": "src/index.coffee",
= "scripts": {Add few more passwords. Rearrange. Remove some.
On by
index 71624f8..603fb2a 100644
--- a/src/Password.elm
+++ b/src/Password.elm
@@ -23,14 +23,14 @@ passwords =
= "Tibia is a name of one of the "
= "bones"
= " in the leg."
+ , Password
+ "Dr. Dre is an American "
+ "rapper"
+ "."
= , Password
= "Somewhat surprisingly, a person can get "
= "sunburned"
= " on a cloudy day."
- , Password
- "The Jets is an "
- "American"
- " family band that had a 1986 hit \"Crush On You\"."
= , Password
= "Wales is a country inside the United Kingdom that does not appear on its flag, the Union "
= "Jack"
@@ -40,17 +40,13 @@ passwords =
= "Dickens"
= "."
= , Password
- "Dr. Dre is an American "
- "rapper"
- "."
+ "Pokemon Go is a location-based augmented "
+ "reality"
+ " game developed by company called Niantic."
= , Password
- "Clevo is a "
- "Taiwanese"
- " computer manufacturer."
- , Password
- "Pokemon Go is a location-based "
- "augmented"
- " reality game developed by company called Niantic."
+ "In 1960 Michael Woodruff "
+ "performed"
+ " the first successful kidney transplant in the United Kingdom."
= , Password
= "To bypass US Munitions Export Laws, the creator of the PGP "
= "published"
@@ -72,11 +68,35 @@ passwords =
= "eight"
= " times seven."
= , Password
- "A group of six healthy people have "
+ "A group of six healthy people typically have "
= "six"
= " pairs of ears between them."
= , Password
= "The first phase of the Marmaray project opened in 2013 with an "
= "undersea"
= " rail tunnel across the Bosphorus strait."
+ , Password
+ "In the context of spaceflight, a "
+ "satellite"
+ " is an object that has been intentionally placed into orbit."
+ , Password
+ "Mercury rotates in a way that is "
+ "unique"
+ " in the Solar System."
+ , Password
+ "In Virgil's Aeneid, Mercury reminds Aeneas of his mission to found the "
+ "city"
+ " of Rome."
+ , Password
+ "X-bracing was used in the construction of the 1908 Singer Building, then the "
+ "tallest"
+ " building in the world."
+ , Password
+ "It is bordered on the west by the "
+ "Pacific"
+ " Ocean and on the north and east by the Atlantic Ocean."
+ , Password
+ ""
+ "Bolivia"
+ "is a landlocked country located in western-central South America."
= ]More passwords
On by
index 603fb2a..9ffa7a1 100644
--- a/src/Password.elm
+++ b/src/Password.elm
@@ -99,4 +99,52 @@ passwords =
= ""
= "Bolivia"
= "is a landlocked country located in western-central South America."
+ , Password
+ "Babylon was built along both "
+ "banks"
+ " of the Euphrates river."
+ , Password
+ "The Norte Chico civilization, which flourished between the fourth and second "
+ "millennia"
+ " BC is the oldest known civilization in the Americas."
+ , Password
+ "The Andes are the longest continental mountain "
+ "range"
+ " in the world."
+ , Password
+ "Mountain ranges are usually segmented by highlands or mountain passes and "
+ "valleys"
+ "."
+ , Password
+ "Doom Mons is the name of a mountain range and its eponymous peak on Titan, the largest "
+ "moon"
+ " of Saturn."
+ , Password
+ "The number of dwarf planets in the Solar System is "
+ "unknown"
+ "."
+ , Password
+ "If the ellipse is "
+ "rotated"
+ " about its major axis, the result is a prolate - an elongated spheroid"
+ , Password
+ "The Earth is often approximated by an oblate spheroid, known as the reference ellipsoid, instead of a "
+ "sphere"
+ "."
+ , Password
+ "The "
+ "opposite"
+ " of \"literally\" is \"figuratively\"."
+ , Password
+ "A metaphor can help to identify "
+ "hidden"
+ " similarities between two ideas."
+ , Password
+ "The metropolitan area of Cairo, with a "
+ "population"
+ " of over 20 million, is the largest in Africa, the Arab world, and the Middle East, and the 6th-largest in the world."
+ , Password
+ "Bali is an island located 8 "
+ "degrees"
+ " south of the equator"
= ]Setup Fathom analytics
On by
index 3b69d5f..df48bb6 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -1,4 +1,4 @@
-module Main exposing (Model, Msg, init, main, subscriptions, update, view)
+port module Main exposing (Model, Msg, init, main, subscriptions, update, view)
=
=import Browser
=import Game
@@ -9,6 +9,9 @@ import Password exposing (Password)
=import Random
=
=
+port goalTracking : ( String, Int ) -> Cmd msg
+
+
=main : Program Flags Model Msg
=main =
= Browser.element
@@ -223,8 +226,24 @@ update msg model =
= )
=
= PlayAgainButtonClicked ->
+ let
+ trackGoal =
+ case Maybe.map Game.snakeEscaped model.game of
+ Nothing ->
+ Cmd.none
+
+ Just True ->
+ -- TODO: Extract Fathom analytics to own module. Have a union type for goal ids.
+ goalTracking ( "MNUMD96E", 0 )
+
+ Just False ->
+ goalTracking ( "QHPNWQCC", 0 )
+ in
= ( model
- , generateRandomGameFlags GotRandomGameFlags model.levels
+ , [ generateRandomGameFlags GotRandomGameFlags model.levels
+ , trackGoal
+ ]
+ |> Cmd.batch
= )
=
= GotGameMsg gameMsg ->index e9136dd..c5ca1a8 100644
--- a/src/index.coffee
+++ b/src/index.coffee
@@ -9,3 +9,6 @@ document.addEventListener "keydown", (event) =>
= if event.key in [ "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight" ]
= do event.preventDefault
= game.ports.keydown.send event
+
+game.ports.goalTracking.subscribe ([goal, value]) =>
+ fathom.trackGoal goal, valueindex 5f7c6d0..9771568 100644
--- a/src/index.html
+++ b/src/index.html
@@ -23,8 +23,13 @@
= content="/word-snake/"
= />
=
+ <script src="https://hookworm.hornbook.io/script.js" data-site="XRUGIRXN" defer>
+ </script>
+
= <script type="text/javascript" src="./index.coffee" defer>
= </script>
+
+
= <style type="text/css" media="screen">
= html, body {
= height: 100%;Fix an ambiguous password
On by
index 9ffa7a1..af7a168 100644
--- a/src/Password.elm
+++ b/src/Password.elm
@@ -92,7 +92,7 @@ passwords =
= "tallest"
= " building in the world."
= , Password
- "It is bordered on the west by the "
+ "South America is bordered on the west by the "
= "Pacific"
= " Ocean and on the north and east by the Atlantic Ocean."
= , PasswordRename Password to Level, carry Charset in a Level record
On by
index 42d2aa8..e54140c 100644
--- a/src/Game.elm
+++ b/src/Game.elm
@@ -7,8 +7,8 @@ import Html.Events
=import Html.Events.Extra.Touch as Touch exposing (Touch)
=import Json.Decode as Decode
=import Keyboard
+import Level exposing (Level)
=import Maybe.Extra as Maybe
-import Password exposing (Password)
=import Random
=import Svg exposing (Svg)
=import Svg.Attributes
@@ -28,7 +28,7 @@ type alias Model =
= { area : Area
= , letters : Letters
= , snake : Snake
- , password : Password
+ , level : Level
= , word : String
= , randomness : Random.Seed
= , swipe : Maybe Swipe
@@ -80,8 +80,7 @@ type alias Swipe =
=
=type alias Flags =
= { area : Area
- , charset : Password.Charset
- , password : Password
+ , level : Level
= , randomness : Random.Seed
= }
=
@@ -97,7 +96,7 @@ init flags =
= , direction = East
= , alive = True
= }
- , password = flags.password
+ , level = flags.level
= , word = ""
= , randomness = flags.randomness
= , swipe = Nothing
@@ -137,7 +136,7 @@ view model =
= [ Html.Attributes.style "text-align" "center"
= , Html.Attributes.style "font-size" "1rem"
= ]
- [ Html.text model.password.intro
+ [ Html.text model.level.intro
= , Html.span
= [ Html.Attributes.style "background" <|
= if passwordCollected model then
@@ -153,7 +152,7 @@ view model =
= else
= Html.text model.word
= ]
- , Html.text model.password.outro
+ , Html.text model.level.outro
= ]
= , areaView model.area model.letters model.snake
= ]
@@ -368,7 +367,13 @@ update msg model =
= ( letters, randomness ) =
= model.letters
= |> randomDecay 0.01
- |> Random.andThen (randomSpawn 0.5 model.area needed model.snake)
+ |> Random.andThen
+ (randomSpawn 0.5
+ model.area
+ needed
+ model.level.charset
+ model.snake
+ )
= |> (\generator -> Random.step generator model.randomness)
=
= snake : Snake
@@ -380,7 +385,7 @@ update msg model =
=
= needed : List Char
= needed =
- model.password.value
+ model.level.password
= |> String.toUpper
= |> String.toList
= |> List.drop (String.length model.word)
@@ -734,7 +739,7 @@ updateLetters wanted snake letters =
=
=passwordCollected : Model -> Bool
=passwordCollected model =
- String.toUpper model.word == String.toUpper model.password.value
+ String.toUpper model.word == String.toUpper model.level.password
=
=
=snakeEscaped : Model -> Bool
@@ -890,12 +895,12 @@ moveSegment direction ( x, y ) =
=-- random generators
=
=
-randomLetter : List Char -> Random.Generator Char
-randomLetter promoted =
+randomLetter : List Char -> Level.Charset -> Random.Generator Char
+randomLetter promoted charset =
= let
= weights : List Float
= weights =
- Password.charset
+ charset
= |> List.map
= (\letter ->
= if List.member letter promoted then
@@ -906,7 +911,7 @@ randomLetter promoted =
= )
=
= weightmap =
- List.map2 Tuple.pair weights Password.charset
+ List.map2 Tuple.pair weights charset
= in
= Random.weighted ( 1, '🔥' ) weightmap
=
@@ -929,10 +934,11 @@ randomSpawn :
= Float
= -> Area
= -> List Char
+ -> Level.Charset
= -> Snake
= -> Letters
= -> Random.Generator Letters
-randomSpawn probability area needed snake letters =
+randomSpawn probability area needed charset snake letters =
= let
= perform : Bool -> Position -> Char -> Letters
= perform spawn position letter =
@@ -950,7 +956,7 @@ randomSpawn probability area needed snake letters =
= Random.map3 perform
= (randomBoolean probability)
= (randomPosition area)
- (randomLetter needed)
+ (randomLetter needed charset)
=
=
=randomDecay : Float -> Dict comparable v -> Random.Generator (Dict comparable v)similarity index 85%
rename from src/Password.elm
rename to src/Level.elm
index af7a168..7aeb217 100644
--- a/src/Password.elm
+++ b/src/Level.elm
@@ -1,10 +1,11 @@
-module Password exposing (Charset, Password, charset, passwords)
+module Level exposing (Charset, Level, charset, levels)
=
=
-type alias Password =
+type alias Level =
= { intro : String
- , value : String
+ , password : String
= , outro : String
+ , charset : Charset
= }
=
=
@@ -17,134 +18,135 @@ charset =
= String.toList "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
=
=
-passwords : List Password
-passwords =
- [ Password
+levels : List Level
+levels =
+ [ Level
= "Tibia is a name of one of the "
= "bones"
= " in the leg."
- , Password
+ , Level
= "Dr. Dre is an American "
= "rapper"
= "."
- , Password
+ , Level
= "Somewhat surprisingly, a person can get "
= "sunburned"
= " on a cloudy day."
- , Password
+ , Level
= "Wales is a country inside the United Kingdom that does not appear on its flag, the Union "
= "Jack"
= "."
- , Password
+ , Level
= "The Artful Dodger is a nickname of Jack Dawkins, a character in \"Oliver Twist\", a novel by Charles "
= "Dickens"
= "."
- , Password
+ , Level
= "Pokemon Go is a location-based augmented "
= "reality"
= " game developed by company called Niantic."
- , Password
+ , Level
= "In 1960 Michael Woodruff "
= "performed"
= " the first successful kidney transplant in the United Kingdom."
- , Password
+ , Level
= "To bypass US Munitions Export Laws, the creator of the PGP "
= "published"
= " all the source code in book form."
- , Password
+ , Level
= "Munich is a "
= "German"
= " city located on the River Isar."
- , Password
+ , Level
= "The world's oldest still operational space launch facility located in "
= "Kazakhstan"
= "."
- , Password
+ , Level
= "Thirty six divided by four is "
= "nine"
= "."
- , Password
+ , Level
= "Fifty six is "
= "eight"
= " times seven."
- , Password
+ , Level
= "A group of six healthy people typically have "
= "six"
= " pairs of ears between them."
- , Password
+ , Level
= "The first phase of the Marmaray project opened in 2013 with an "
= "undersea"
= " rail tunnel across the Bosphorus strait."
- , Password
+ , Level
= "In the context of spaceflight, a "
= "satellite"
= " is an object that has been intentionally placed into orbit."
- , Password
+ , Level
= "Mercury rotates in a way that is "
= "unique"
= " in the Solar System."
- , Password
+ , Level
= "In Virgil's Aeneid, Mercury reminds Aeneas of his mission to found the "
= "city"
= " of Rome."
- , Password
+ , Level
= "X-bracing was used in the construction of the 1908 Singer Building, then the "
= "tallest"
= " building in the world."
- , Password
+ , Level
= "South America is bordered on the west by the "
= "Pacific"
= " Ocean and on the north and east by the Atlantic Ocean."
- , Password
+ , Level
= ""
= "Bolivia"
= "is a landlocked country located in western-central South America."
- , Password
+ , Level
= "Babylon was built along both "
= "banks"
= " of the Euphrates river."
- , Password
+ , Level
= "The Norte Chico civilization, which flourished between the fourth and second "
= "millennia"
= " BC is the oldest known civilization in the Americas."
- , Password
+ , Level
= "The Andes are the longest continental mountain "
= "range"
= " in the world."
- , Password
+ , Level
= "Mountain ranges are usually segmented by highlands or mountain passes and "
= "valleys"
= "."
- , Password
+ , Level
= "Doom Mons is the name of a mountain range and its eponymous peak on Titan, the largest "
= "moon"
= " of Saturn."
- , Password
+ , Level
= "The number of dwarf planets in the Solar System is "
= "unknown"
= "."
- , Password
+ , Level
= "If the ellipse is "
= "rotated"
= " about its major axis, the result is a prolate - an elongated spheroid"
- , Password
+ , Level
= "The Earth is often approximated by an oblate spheroid, known as the reference ellipsoid, instead of a "
= "sphere"
= "."
- , Password
+ , Level
= "The "
= "opposite"
= " of \"literally\" is \"figuratively\"."
- , Password
+ , Level
= "A metaphor can help to identify "
= "hidden"
= " similarities between two ideas."
- , Password
+ , Level
= "The metropolitan area of Cairo, with a "
= "population"
= " of over 20 million, is the largest in Africa, the Arab world, and the Middle East, and the 6th-largest in the world."
- , Password
+ , Level
= "Bali is an island located 8 "
= "degrees"
= " south of the equator"
= ]
+ |> List.map (\constructor -> constructor charset)index df48bb6..6db187b 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -5,7 +5,7 @@ import Game
=import Html exposing (Html)
=import Html.Attributes
=import Html.Events
-import Password exposing (Password)
+import Level exposing (Level)
=import Random
=
=
@@ -24,7 +24,7 @@ main =
=
=type alias Model =
= { game : Maybe Game.Model
- , levels : List Password
+ , levels : List Level
= }
=
=
@@ -39,7 +39,7 @@ type alias Flags =
=init : Flags -> ( Model, Cmd Msg )
=init _ =
= ( { game = Nothing
- , levels = Password.passwords
+ , levels = Level.levels
= }
= , Cmd.none
= )
@@ -213,7 +213,7 @@ popupView game =
=type Msg
= = StartButtonClicked
= | GotGameMsg Game.Msg
- | GotRandomGameFlags Password Random.Seed
+ | GotRandomGameFlags Level Random.Seed
= | PlayAgainButtonClicked
=
=
@@ -262,13 +262,12 @@ update msg model =
= , Cmd.map GotGameMsg gameCmd
= )
=
- GotRandomGameFlags password randomness ->
+ GotRandomGameFlags level randomness ->
= ( { model
= | game =
- { password = password
+ { level = level
= , randomness = randomness
= , area = Game.Area 16 16
- , charset = Password.charset
= }
= |> Game.init
= |> Just
@@ -293,20 +292,21 @@ subscriptions model =
=-- HELPERS
=
=
-generateRandomGameFlags : (Password -> Random.Seed -> msg) -> List Password -> Cmd msg
-generateRandomGameFlags tagger passwords =
+generateRandomGameFlags : (Level -> Random.Seed -> msg) -> List Level -> Cmd msg
+generateRandomGameFlags tagger levels =
= Random.map2 tagger
- (randomPassword passwords)
+ (randomLevel levels)
= Random.independentSeed
= |> Random.generate identity
=
=
-randomPassword : List Password -> Random.Generator Password
-randomPassword passwords =
+randomLevel : List Level -> Random.Generator Level
+randomLevel levels =
= Random.uniform
- (Password
+ (Level
= "A slithering animal is called a "
= "snake"
= "."
+ Level.charset
= )
- passwords
+ levelsRename Level.charset to Level.uppercaseLatinLetters
On by
In preparation to support other character sets.
index 7aeb217..15f9f35 100644
--- a/src/Level.elm
+++ b/src/Level.elm
@@ -1,4 +1,4 @@
-module Level exposing (Charset, Level, charset, levels)
+module Level exposing (Charset, Level, levels, uppercaseLatinLetters)
=
=
=type alias Level =
@@ -9,12 +9,16 @@ type alias Level =
= }
=
=
+
+-- Charset
+
+
=type alias Charset =
= List Char
=
=
-charset : Charset
-charset =
+uppercaseLatinLetters : Charset
+uppercaseLatinLetters =
= String.toList "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
=
=
@@ -149,4 +153,4 @@ levels =
= "degrees"
= " south of the equator"
= ]
- |> List.map (\constructor -> constructor charset)
+ |> List.map (\constructor -> constructor uppercaseLatinLetters)index 6db187b..3fd5601 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -307,6 +307,6 @@ randomLevel levels =
= "A slithering animal is called a "
= "snake"
= "."
- Level.charset
+ Level.uppercaseLatinLetters
= )
= levelsThe program will load levels from the server
On by
The levels document will be parsed using a simple parser that expects each line to contain an intro, password (currently in upper case latin letters only but different character set are going to be supported soon) and outro. No blank lines are allowed yet.
index ad2d589..a0ed691 100644
--- a/elm.json
+++ b/elm.json
@@ -9,11 +9,14 @@
= "elm/browser": "1.0.2",
= "elm/core": "1.0.5",
= "elm/html": "1.0.0",
+ "elm/http": "2.0.0",
= "elm/json": "1.1.3",
+ "elm/parser": "1.1.0",
= "elm/random": "1.0.0",
= "elm/svg": "1.0.1",
= "elm/time": "1.0.0",
= "elm-community/maybe-extra": "5.2.0",
+ "krisajenkins/remotedata": "6.0.1",
= "mpizenberg/elm-pointer-events": "4.0.2",
= "ohanhi/keyboard": "2.0.1"
= },index 68e9afa..2fe5f21 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5327,6 +5327,16 @@
= "ws": "^5.1.1"
= }
= },
+ "parcel-plugin-static-files-copy": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/parcel-plugin-static-files-copy/-/parcel-plugin-static-files-copy-2.5.0.tgz",
+ "integrity": "sha512-5rxOPw3iV+WXhePfByoIxsUlL4I0o95CgcF31gwgnhPuj2q6tVPuzEAJsag9bWJr5Vd/SXFPTNsUAGAg4jP07Q==",
+ "dev": true,
+ "requires": {
+ "minimatch": "3.0.4",
+ "path": "0.12.7"
+ }
+ },
= "parse-asn1": {
= "version": "5.1.6",
= "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz",
@@ -5368,6 +5378,33 @@
= "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=",
= "dev": true
= },
+ "path": {
+ "version": "0.12.7",
+ "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
+ "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=",
+ "dev": true,
+ "requires": {
+ "process": "^0.11.1",
+ "util": "^0.10.3"
+ },
+ "dependencies": {
+ "inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
+ "dev": true
+ },
+ "util": {
+ "version": "0.10.4",
+ "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
+ "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
+ "dev": true,
+ "requires": {
+ "inherits": "2.0.3"
+ }
+ }
+ }
+ },
= "path-browserify": {
= "version": "0.0.1",
= "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz",index 91a7daf..21c5f8e 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,10 @@
= ],
= "author": "Tad Lispy (https://tad-lispy.com/)",
= "license": "GPL-3.0-or-later",
+ "staticFiles": {
+ "staticPath": "static",
+ "watcherGlob": "**"
+ },
= "devDependencies": {
= "@capacitor/cli": "^2.4.2",
= "coffeescript": "^2.5.1",
@@ -22,7 +26,8 @@
= "elm-hot": "^1.1.5",
= "marked": "^1.2.2",
= "node-elm-compiler": "^5.0.5",
- "parcel": "^1.12.4"
+ "parcel": "^1.12.4",
+ "parcel-plugin-static-files-copy": "^2.5.0"
= },
= "dependencies": {
= "@capacitor/android": "^2.4.2",index 15f9f35..6170510 100644
--- a/src/Level.elm
+++ b/src/Level.elm
@@ -1,16 +1,18 @@
-module Level exposing (Charset, Level, levels, uppercaseLatinLetters)
+module Level exposing (Charset, Level, parse, parser, uppercaseLatinLetters)
+
+import Parser exposing ((|.), (|=), Parser)
=
=
=type alias Level =
- { intro : String
+ { charset : Charset
+ , intro : String
= , password : String
= , outro : String
- , charset : Charset
= }
=
=
=
--- Charset
+-- CHARACTER SETS
=
=
=type alias Charset =
@@ -22,135 +24,56 @@ uppercaseLatinLetters =
= String.toList "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
=
=
-levels : List Level
-levels =
- [ Level
- "Tibia is a name of one of the "
- "bones"
- " in the leg."
- , Level
- "Dr. Dre is an American "
- "rapper"
- "."
- , Level
- "Somewhat surprisingly, a person can get "
- "sunburned"
- " on a cloudy day."
- , Level
- "Wales is a country inside the United Kingdom that does not appear on its flag, the Union "
- "Jack"
- "."
- , Level
- "The Artful Dodger is a nickname of Jack Dawkins, a character in \"Oliver Twist\", a novel by Charles "
- "Dickens"
- "."
- , Level
- "Pokemon Go is a location-based augmented "
- "reality"
- " game developed by company called Niantic."
- , Level
- "In 1960 Michael Woodruff "
- "performed"
- " the first successful kidney transplant in the United Kingdom."
- , Level
- "To bypass US Munitions Export Laws, the creator of the PGP "
- "published"
- " all the source code in book form."
- , Level
- "Munich is a "
- "German"
- " city located on the River Isar."
- , Level
- "The world's oldest still operational space launch facility located in "
- "Kazakhstan"
- "."
- , Level
- "Thirty six divided by four is "
- "nine"
- "."
- , Level
- "Fifty six is "
- "eight"
- " times seven."
- , Level
- "A group of six healthy people typically have "
- "six"
- " pairs of ears between them."
- , Level
- "The first phase of the Marmaray project opened in 2013 with an "
- "undersea"
- " rail tunnel across the Bosphorus strait."
- , Level
- "In the context of spaceflight, a "
- "satellite"
- " is an object that has been intentionally placed into orbit."
- , Level
- "Mercury rotates in a way that is "
- "unique"
- " in the Solar System."
- , Level
- "In Virgil's Aeneid, Mercury reminds Aeneas of his mission to found the "
- "city"
- " of Rome."
- , Level
- "X-bracing was used in the construction of the 1908 Singer Building, then the "
- "tallest"
- " building in the world."
- , Level
- "South America is bordered on the west by the "
- "Pacific"
- " Ocean and on the north and east by the Atlantic Ocean."
- , Level
- ""
- "Bolivia"
- "is a landlocked country located in western-central South America."
- , Level
- "Babylon was built along both "
- "banks"
- " of the Euphrates river."
- , Level
- "The Norte Chico civilization, which flourished between the fourth and second "
- "millennia"
- " BC is the oldest known civilization in the Americas."
- , Level
- "The Andes are the longest continental mountain "
- "range"
- " in the world."
- , Level
- "Mountain ranges are usually segmented by highlands or mountain passes and "
- "valleys"
- "."
- , Level
- "Doom Mons is the name of a mountain range and its eponymous peak on Titan, the largest "
- "moon"
- " of Saturn."
- , Level
- "The number of dwarf planets in the Solar System is "
- "unknown"
- "."
- , Level
- "If the ellipse is "
- "rotated"
- " about its major axis, the result is a prolate - an elongated spheroid"
- , Level
- "The Earth is often approximated by an oblate spheroid, known as the reference ellipsoid, instead of a "
- "sphere"
- "."
- , Level
- "The "
- "opposite"
- " of \"literally\" is \"figuratively\"."
- , Level
- "A metaphor can help to identify "
- "hidden"
- " similarities between two ideas."
- , Level
- "The metropolitan area of Cairo, with a "
- "population"
- " of over 20 million, is the largest in Africa, the Arab world, and the Middle East, and the 6th-largest in the world."
- , Level
- "Bali is an island located 8 "
- "degrees"
- " south of the equator"
- ]
- |> List.map (\constructor -> constructor uppercaseLatinLetters)
+
+-- PARSERS
+
+
+parse : String -> Result (List Parser.DeadEnd) (List Level)
+parse =
+ Parser.run parser
+
+
+parser : Parser (List Level)
+parser =
+ let
+ lineHelper : List Level -> Parser (Parser.Step (List Level) (List Level))
+ lineHelper levels =
+ Parser.oneOf
+ [ lineParser uppercaseLatinLetters
+ |> Parser.map (\level -> Parser.Loop (level :: levels))
+ , Parser.end
+ |> Parser.map (\_ -> Parser.Done (List.reverse levels))
+ ]
+ in
+ Parser.loop [] lineHelper
+
+
+lineParser : Charset -> Parser Level
+lineParser charset =
+ Parser.succeed (Level charset)
+ |= introParser
+ |. Parser.symbol "{"
+ |. Parser.spaces
+ |= passwordParser charset
+ |. Parser.spaces
+ |. Parser.symbol "}"
+ |= outroParser
+
+
+introParser : Parser String
+introParser =
+ Parser.chompWhile (\character -> not <| List.member character [ '{', '\n' ])
+ |> Parser.getChompedString
+
+
+outroParser : Parser String
+outroParser =
+ Parser.chompUntil "\n"
+ |. Parser.chompIf ((==) '\n')
+ |> Parser.getChompedString
+
+
+passwordParser : Charset -> Parser String
+passwordParser charset =
+ Parser.chompWhile (\c -> List.member c charset)
+ |> Parser.getChompedStringindex 3fd5601..3894537 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -5,8 +5,12 @@ import Game
=import Html exposing (Html)
=import Html.Attributes
=import Html.Events
+import Http
=import Level exposing (Level)
+import Parser
=import Random
+import RemoteData exposing (WebData)
+import Svg.Attributes exposing (result)
=
=
=port goalTracking : ( String, Int ) -> Cmd msg
@@ -24,7 +28,7 @@ main =
=
=type alias Model =
= { game : Maybe Game.Model
- , levels : List Level
+ , levels : WebData (List Level)
= }
=
=
@@ -33,18 +37,45 @@ type alias Model =
=
=
=type alias Flags =
- ()
+ { levels_url : String
+ }
=
=
=init : Flags -> ( Model, Cmd Msg )
-init _ =
+init flags =
= ( { game = Nothing
- , levels = Level.levels
+ , levels = RemoteData.Loading
= }
- , Cmd.none
+ , fetchLevels GotLevelsResponse flags.levels_url
= )
=
=
+fetchLevels : (Result Http.Error (List Level) -> msg) -> String -> Cmd msg
+fetchLevels tag url =
+ let
+ expectLevels : Http.Expect msg
+ expectLevels =
+ Http.expectString toMsg
+
+ toMsg : Result Http.Error String -> msg
+ toMsg result =
+ result
+ |> Result.andThen toHttpResult
+ |> tag
+
+ toHttpResult : String -> Result Http.Error (List Level)
+ toHttpResult text =
+ text
+ |> Level.parse
+ |> Result.mapError Parser.deadEndsToString
+ |> Result.mapError Http.BadBody
+ in
+ Http.get
+ { url = "levels.snake"
+ , expect = expectLevels
+ }
+
+
=view : Model -> Html Msg
=view model =
= case model.game of
@@ -211,7 +242,8 @@ popupView game =
=
=
=type Msg
- = StartButtonClicked
+ = GotLevelsResponse (Result Http.Error (List Level))
+ | StartButtonClicked
= | GotGameMsg Game.Msg
= | GotRandomGameFlags Level Random.Seed
= | PlayAgainButtonClicked
@@ -220,9 +252,16 @@ type Msg
=update : Msg -> Model -> ( Model, Cmd Msg )
=update msg model =
= case msg of
+ GotLevelsResponse response ->
+ ( { model | levels = RemoteData.fromResult response }
+ , Cmd.none
+ )
+
= StartButtonClicked ->
= ( model
- , generateRandomGameFlags GotRandomGameFlags model.levels
+ , model.levels
+ |> RemoteData.map (generateRandomGameFlags GotRandomGameFlags)
+ |> RemoteData.withDefault Cmd.none
= )
=
= PlayAgainButtonClicked ->
@@ -238,9 +277,14 @@ update msg model =
=
= Just False ->
= goalTracking ( "QHPNWQCC", 0 )
+
+ prepareNewGame =
+ model.levels
+ |> RemoteData.map (generateRandomGameFlags GotRandomGameFlags)
+ |> RemoteData.withDefault Cmd.none
= in
= ( model
- , [ generateRandomGameFlags GotRandomGameFlags model.levels
+ , [ prepareNewGame
= , trackGoal
= ]
= |> Cmd.batch
@@ -304,9 +348,9 @@ randomLevel : List Level -> Random.Generator Level
=randomLevel levels =
= Random.uniform
= (Level
+ Level.uppercaseLatinLetters
= "A slithering animal is called a "
= "snake"
= "."
- Level.uppercaseLatinLetters
= )
= levelsindex c5ca1a8..0742887 100644
--- a/src/index.coffee
+++ b/src/index.coffee
@@ -1,7 +1,13 @@
=import { Elm } from "./Main.elm"
=
+levels_url =
+ if process.env.NODE_ENV is "development"
+ "/levels.snake"
+ else
+ "https://hornbook.gitlab.io/word-snake/levels.snake"
+
=node = document.getElementById "app"
-flags = {}
+flags = { levels_url }
=
=game = Elm.Main.init { node, flags }
=new file mode 100644
index 0000000..40dd948
--- /dev/null
+++ b/static/levels.snake
@@ -0,0 +1,33 @@
+Tibia is a name of one of the { BONES } in the leg.
+Dr. Dre is an American { RAPPER }.
+Somewhat surprisingly, a person can get { SUNBURNED } on a cloudy day.
+Wales is a country inside the United Kingdom that does not appear on its flag, the Union { JACK }.
+The Artful Dodger is a nickname of Jack Dawkins, a character in \"Oliver Twist\", a novel by Charles { DICKENS }.
+Pokemon Go is a location-based augmented { REALITY } game developed by company called Niantic.
+In 1960 Michael Woodruff { PERFORMED } the first successful kidney transplant in the United Kingdom.
+To bypass US Munitions Export Laws, the creator of the PGP { PUBLISHED } all the source code in book form.
+Munich is a { GERMAN } city located on the River Isar.
+The world's oldest still operational space launch facility located in { KAZAKHSTAN }.
+Thirty six divided by four is { NINE }.
+Fifty six is { EIGHT } times seven.
+A group of six healthy people typically have { SIX } pairs of ears between them.
+The first phase of the Marmaray project opened in 2013 with an { UNDERSEA } rail tunnel across the Bosphorus strait.
+In the context of spaceflight, a { SATELLITE } is an object that has been intentionally placed into orbit.
+Mercury rotates in a way that is { UNIQUE } in the Solar System.
+In Virgil's Aeneid, Mercury reminds Aeneas of his mission to found the { CITY } of Rome.
+X-bracing was used in the construction of the 1908 Singer Building, then the { TALLEST } building in the world.
+South America is bordered on the west by the { PACIFIC } Ocean and on the north and east by the Atlantic Ocean.
+{ BOLIVIA } is a landlocked country located in western-central South America.
+Babylon was built along both { BANKS } of the Euphrates river.
+The Norte Chico civilization, which flourished between the fourth and second { MILLENNIA } BC is the oldest known civilization in the Americas.
+The Andes are the longest continental mountain { RANGE } in the world.
+Mountain ranges are usually segmented by highlands or mountain passes and { VALLEYS }.
+Doom Mons is the name of a mountain range and its eponymous peak on Titan, the largest { MOON } of Saturn.
+The number of dwarf planets in the Solar System is { UNKNOWN }.
+If the ellipse is { ROTATED } about its major axis, the result is a prolate - an elongated spheroid
+The Earth is often approximated by an oblate spheroid, known as the reference ellipsoid, instead of a { SPHERE }.
+The { OPPOSITE } of "literally" is "figuratively".
+A metaphor can help to identify { HIDDEN } similarities between two ideas.
+The metropolitan area of Cairo, with a { POPULATION } of over 20 million, is the largest in Africa, the Arab world, and the Middle East, and the 6th-largest in the world.
+Bali is an island located 8 { DEGREES } south of the equator.
+Once a {SNAKE} always a snake.Disable tracking goals with Fathom unless in production
On by
index 0742887..ed1e7ca 100644
--- a/src/index.coffee
+++ b/src/index.coffee
@@ -17,4 +17,7 @@ document.addEventListener "keydown", (event) =>
= game.ports.keydown.send event
=
=game.ports.goalTracking.subscribe ([goal, value]) =>
- fathom.trackGoal goal, value
+ if process.env.NODE_ENV is "production"
+ fathom.trackGoal goal, value
+ else
+ console.debug "Tracking goals disabled in development environment."Implement smart levels queue
On by
Won levels will be placed at the end of the queue.
Lost levels will be pushed five places back.
New games are initialized by shuffling first 4 levels and taking the first one.
In effect same level will never be played twice in a row.
index 3894537..c84d50e 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -10,7 +10,6 @@ import Level exposing (Level)
=import Parser
=import Random
=import RemoteData exposing (WebData)
-import Svg.Attributes exposing (result)
=
=
=port goalTracking : ( String, Int ) -> Cmd msg
@@ -245,7 +244,7 @@ type Msg
= = GotLevelsResponse (Result Http.Error (List Level))
= | StartButtonClicked
= | GotGameMsg Game.Msg
- | GotRandomGameFlags Level Random.Seed
+ | GotRandomGameFlags (List Level) Random.Seed
= | PlayAgainButtonClicked
=
=
@@ -265,30 +264,41 @@ update msg model =
= )
=
= PlayAgainButtonClicked ->
- let
- trackGoal =
- case Maybe.map Game.snakeEscaped model.game of
- Nothing ->
- Cmd.none
-
- Just True ->
- -- TODO: Extract Fathom analytics to own module. Have a union type for goal ids.
- goalTracking ( "MNUMD96E", 0 )
-
- Just False ->
- goalTracking ( "QHPNWQCC", 0 )
+ case model.game of
+ Nothing ->
+ ( model
+ , Cmd.none
+ )
=
- prepareNewGame =
- model.levels
- |> RemoteData.map (generateRandomGameFlags GotRandomGameFlags)
- |> RemoteData.withDefault Cmd.none
- in
- ( model
- , [ prepareNewGame
- , trackGoal
- ]
- |> Cmd.batch
- )
+ Just game ->
+ case RemoteData.toMaybe model.levels of
+ Nothing ->
+ ( model
+ , Cmd.none
+ )
+
+ Just levels ->
+ let
+ trackGoal =
+ if won then
+ -- TODO: Extract Fathom analytics to own module. Have a union type for goal ids.
+ goalTracking ( "MNUMD96E", 0 )
+
+ else
+ goalTracking ( "QHPNWQCC", 0 )
+
+ won =
+ Game.snakeEscaped game
+
+ rescheduledLevels =
+ scheduleLevel 5 won levels
+ in
+ ( model
+ , [ generateRandomGameFlags GotRandomGameFlags rescheduledLevels
+ , trackGoal
+ ]
+ |> Cmd.batch
+ )
=
= GotGameMsg gameMsg ->
= case model.game of
@@ -306,18 +316,26 @@ update msg model =
= , Cmd.map GotGameMsg gameCmd
= )
=
- GotRandomGameFlags level randomness ->
- ( { model
- | game =
- { level = level
- , randomness = randomness
- , area = Game.Area 16 16
- }
- |> Game.init
- |> Just
- }
- , Cmd.none
- )
+ GotRandomGameFlags levels randomness ->
+ case levels of
+ [] ->
+ ( model
+ , Cmd.none
+ )
+
+ level :: _ ->
+ ( { model
+ | levels = RemoteData.Success levels
+ , game =
+ { level = level
+ , randomness = randomness
+ , area = Game.Area 16 16
+ }
+ |> Game.init
+ |> Just
+ }
+ , Cmd.none
+ )
=
=
=
@@ -336,21 +354,58 @@ subscriptions model =
=-- HELPERS
=
=
-generateRandomGameFlags : (Level -> Random.Seed -> msg) -> List Level -> Cmd msg
-generateRandomGameFlags tagger levels =
- Random.map2 tagger
- (randomLevel levels)
+scheduleLevel : Int -> Bool -> List Level -> List Level
+scheduleLevel push won levels =
+ case levels of
+ [] ->
+ levels
+
+ head :: rest ->
+ if won then
+ -- Move level to the end of the queue
+ rest
+ |> List.reverse
+ |> (::) head
+ |> List.reverse
+
+ else
+ -- Move level 5 position back in the queue
+ List.concat
+ [ List.take push rest
+ , [ head ]
+ , List.drop push rest
+ ]
+
+
+generateRandomGameFlags : (List Level -> Random.Seed -> msg) -> List Level -> Cmd msg
+generateRandomGameFlags tag levels =
+ Random.map2 tag
+ (shuffleFirst 3 levels)
= Random.independentSeed
= |> Random.generate identity
=
=
-randomLevel : List Level -> Random.Generator Level
-randomLevel levels =
- Random.uniform
- (Level
- Level.uppercaseLatinLetters
- "A slithering animal is called a "
- "snake"
- "."
- )
- levels
+shuffleFirst :
+ Int
+ -> List a
+ -> Random.Generator (List a)
+shuffleFirst number list =
+ list
+ |> List.take number
+ |> randomOrder
+ |> Random.map
+ (\shuffled ->
+ list
+ |> List.drop number
+ |> List.append shuffled
+ )
+
+
+randomOrder : List a -> Random.Generator (List a)
+randomOrder list =
+ Random.list
+ (List.length list)
+ (Random.float 0 100)
+ |> Random.map (List.map2 Tuple.pair list)
+ |> Random.map (List.sortBy Tuple.second)
+ |> Random.map (List.map Tuple.first)Let the levels document specify character set
On by
First line must contain all valid characters. The characters can be optionally separated by spaces.
Also create a new Parser.Custom module that holds all the parsers. There is no need to couple them with Level module.
Finally create new levels document (dutch-words.snake) and move all documents to /level/ path.
index 6170510..2a894cc 100644
--- a/src/Level.elm
+++ b/src/Level.elm
@@ -1,6 +1,4 @@
-module Level exposing (Charset, Level, parse, parser, uppercaseLatinLetters)
-
-import Parser exposing ((|.), (|=), Parser)
+module Level exposing (Charset, Level)
=
=
=type alias Level =
@@ -11,69 +9,5 @@ type alias Level =
= }
=
=
-
--- CHARACTER SETS
-
-
=type alias Charset =
= List Char
-
-
-uppercaseLatinLetters : Charset
-uppercaseLatinLetters =
- String.toList "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-
-
-
--- PARSERS
-
-
-parse : String -> Result (List Parser.DeadEnd) (List Level)
-parse =
- Parser.run parser
-
-
-parser : Parser (List Level)
-parser =
- let
- lineHelper : List Level -> Parser (Parser.Step (List Level) (List Level))
- lineHelper levels =
- Parser.oneOf
- [ lineParser uppercaseLatinLetters
- |> Parser.map (\level -> Parser.Loop (level :: levels))
- , Parser.end
- |> Parser.map (\_ -> Parser.Done (List.reverse levels))
- ]
- in
- Parser.loop [] lineHelper
-
-
-lineParser : Charset -> Parser Level
-lineParser charset =
- Parser.succeed (Level charset)
- |= introParser
- |. Parser.symbol "{"
- |. Parser.spaces
- |= passwordParser charset
- |. Parser.spaces
- |. Parser.symbol "}"
- |= outroParser
-
-
-introParser : Parser String
-introParser =
- Parser.chompWhile (\character -> not <| List.member character [ '{', '\n' ])
- |> Parser.getChompedString
-
-
-outroParser : Parser String
-outroParser =
- Parser.chompUntil "\n"
- |. Parser.chompIf ((==) '\n')
- |> Parser.getChompedString
-
-
-passwordParser : Charset -> Parser String
-passwordParser charset =
- Parser.chompWhile (\c -> List.member c charset)
- |> Parser.getChompedStringindex c84d50e..d9c1dc5 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -8,6 +8,7 @@ import Html.Events
=import Http
=import Level exposing (Level)
=import Parser
+import Parser.Custom as Parser
=import Random
=import RemoteData exposing (WebData)
=
@@ -65,12 +66,12 @@ fetchLevels tag url =
= toHttpResult : String -> Result Http.Error (List Level)
= toHttpResult text =
= text
- |> Level.parse
+ |> parseLevels
= |> Result.mapError Parser.deadEndsToString
= |> Result.mapError Http.BadBody
= in
= Http.get
- { url = "levels.snake"
+ { url = url
= , expect = expectLevels
= }
=
@@ -409,3 +410,8 @@ randomOrder list =
= |> Random.map (List.map2 Tuple.pair list)
= |> Random.map (List.sortBy Tuple.second)
= |> Random.map (List.map Tuple.first)
+
+
+parseLevels : String -> Result (List Parser.DeadEnd) (List Level)
+parseLevels =
+ Parser.run Parser.levelsnew file mode 100644
index 0000000..d840429
--- /dev/null
+++ b/src/Parser/Custom.elm
@@ -0,0 +1,96 @@
+module Parser.Custom exposing (charset, intro, letter, levels, line, lines, outro, password)
+
+import Level exposing (Charset, Level)
+import Parser exposing ((|.), (|=), Parser, symbol)
+
+
+levels : Parser (List Level)
+levels =
+ Parser.succeed Basics.identity
+ |= charset
+ |. Parser.symbol "\n"
+ |> Parser.andThen lines
+
+
+charset : Parser Charset
+charset =
+ let
+ charsetHelper : Charset -> Parser (Parser.Step Charset Charset)
+ charsetHelper set =
+ Parser.oneOf
+ [ letter
+ |> Parser.map (\character -> Parser.Loop (character :: set))
+ , Parser.symbol "\n"
+ |> Parser.map (\_ -> Parser.Done (List.reverse set))
+ , Parser.spaces
+ |> Parser.map (\_ -> Parser.Loop set)
+ ]
+ in
+ Parser.loop [] charsetHelper
+
+
+lines : Charset -> Parser (List Level)
+lines set =
+ let
+ lineHelper : List Level -> Parser (Parser.Step (List Level) (List Level))
+ lineHelper memo =
+ Parser.oneOf
+ [ line set
+ |> Parser.map (\level -> Parser.Loop (level :: memo))
+ , Parser.end
+ |> Parser.map (\_ -> Parser.Done (List.reverse memo))
+ ]
+ in
+ Parser.loop [] lineHelper
+
+
+letter : Parser Char
+letter =
+ Parser.chompIf
+ (\character ->
+ not <| List.member character [ '\n', ' ' ]
+ )
+ |> Parser.getChompedString
+ |> Parser.andThen
+ (\string ->
+ case String.toList string of
+ [] ->
+ Parser.problem "Expacting a letter"
+
+ [ character ] ->
+ Parser.succeed character
+
+ _ ->
+ Parser.problem "Expacting a single letter"
+ )
+
+
+line : Charset -> Parser Level
+line set =
+ Parser.succeed (Level set)
+ |= intro
+ |. Parser.symbol "{"
+ |. Parser.spaces
+ |= password set
+ |. Parser.spaces
+ |. Parser.symbol "}"
+ |= outro
+
+
+intro : Parser String
+intro =
+ Parser.chompWhile (\character -> not <| List.member character [ '{', '\n' ])
+ |> Parser.getChompedString
+
+
+outro : Parser String
+outro =
+ Parser.chompUntil "\n"
+ |. Parser.chompIf ((==) '\n')
+ |> Parser.getChompedString
+
+
+password : Charset -> Parser String
+password set =
+ Parser.chompWhile (\character -> List.member character set)
+ |> Parser.getChompedStringindex ed1e7ca..ecb6afc 100644
--- a/src/index.coffee
+++ b/src/index.coffee
@@ -2,9 +2,9 @@ import { Elm } from "./Main.elm"
=
=levels_url =
= if process.env.NODE_ENV is "development"
- "/levels.snake"
+ "/levels/default.snake"
= else
- "https://hornbook.gitlab.io/word-snake/levels.snake"
+ "https://hornbook.gitlab.io/word-snake/levels/default.snake"
=
=node = document.getElementById "app"
=flags = { levels_url }similarity index 98%
rename from static/levels.snake
rename to static/levels/default.snake
index 40dd948..3d4e180 100644
--- a/static/levels.snake
+++ b/static/levels/default.snake
@@ -1,3 +1,5 @@
+A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+
=Tibia is a name of one of the { BONES } in the leg.
=Dr. Dre is an American { RAPPER }.
=Somewhat surprisingly, a person can get { SUNBURNED } on a cloudy day.new file mode 100644
index 0000000..60c56ab
--- /dev/null
+++ b/static/levels/dutch-words.snake
@@ -0,0 +1,3 @@
+A B C D E F G H I J K L M N O P Q R S T U V W X Y Z È Ê É Ô Ç Ñ
+
+Toch kwam Connery in 1983 nog { ÉÉN } keer terug als James Bond in de speelfilm Never Say Never Again.Let user select different levels document
On by
Using URL fragment, e.g.:
#/levels/dutch-words.snake
or: #//gitlab.com/hornbook/word-snake/-/raw/levels/static/levels.snake
for external URLs!
index ecb6afc..f68ed83 100644
--- a/src/index.coffee
+++ b/src/index.coffee
@@ -1,7 +1,16 @@
=import { Elm } from "./Main.elm"
=
+levels =
+ location
+ .hash
+ .trim()
+ .slice 1
+
=levels_url =
- if process.env.NODE_ENV is "development"
+ if levels isnt ""
+ levels
+
+ else if process.env.NODE_ENV is "development"
= "/levels/default.snake"
= else
= "https://hornbook.gitlab.io/word-snake/levels/default.snake"Merge branch 'levels' into 'master'
On by
External levels sets
See merge request hornbook/word-snake!7