Skip to content
Permalink
Browse files

Use Random.step with a non-random seed as an experiment

  • Loading branch information...
magopian committed Aug 8, 2019
1 parent f7dba5a commit 5d3630d16f52a01846202cf65baf6771c31570ec
Showing with 6 additions and 12 deletions.
  1. +6 −12 src/Main.elm
@@ -65,7 +65,6 @@ type Msg
| KeyUp PlayerAction
| RestartGame
| NewWinner Player
| NewDirection Int


type PlayerAction
@@ -165,21 +164,16 @@ update msg model =
sleepCmd =
Process.sleep 500
|> Task.perform alwaysRestartGame

( randomDirection, _ ) =
Random.initialSeed 42
|> Random.step (Random.int 0 100)
|> Debug.log "Random direction: "
in
( { model | gameStatus = Winner player, score = updatedScore }
, Cmd.batch
[ sleepCmd
, Random.generate NewDirection (Random.int 0 100)
]
, sleepCmd
)

NewDirection direction ->
let
_ =
Debug.log "New random direction" direction
in
( model, Cmd.none )

KeyDown playerAction ->
case playerAction of
RightPaddleUp ->

0 comments on commit 5d3630d

Please sign in to comment.
You can’t perform that action at this time.