PS: The subscription to time is useful if you want some sort of timeout or 
delay between the user move and the AI move.
If you want to do the AI move immediately after the user move (without 
delay), 
a pattern with a recursive update call (and without subscription) is 
probably more suited.

Like so:

update msg model =
  case msg of
    Toggle indexToToggle ->
      let
        modelAfterUserMove =
          { model
          | board = move indexToToggle model.turn model.board
          }
      in
        update AIMove modelAfterUserMove  -- here you do a recursive update 
call without any delay

    AIMove ->
      ( fst (miniMax model 0)
      , Cmd.none
      )


-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to