Op woensdag 12 oktober 2016 06:17:37 UTC+2 schreef hoang...@gmail.com:
> But if I do it this way, it's gonna return both the player's move and the 
> AI's move at the same time. What I want to have is that the game displays 
> the player's move THEN call minimax function on current model and THEN 
> display the AI's move

The recursive call still needs a separate Msg (AIMove) for the AIMove. This 
separate Msg is not needed: there is no outside event (user click or server 
or subscription) that calls this message. It is the update function itself 
(during processing of user moves) that calls this. So in that case, it 
would be better to use setup from Luke, to limit all Msg to outside events, 
and remove the AIMove message.

But it sounds like you want something else: you need 2 discrete model 
states (1 after player move, 1 after AI move), because you want *both model 
states to be displayed separately*.

And for that (as far as I know) you need the setup with subscription (+ 
some 'isProcessing' flag like OvermindDL1 suggested), and you also need to 
keep the AIMove message for the subscription command to call.

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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to