On Tue, Oct 25, 2016 at 2:57 PM, Did <didier.cau...@gmail.com> wrote:

> Thanks Peter for your help! I could go further but now, there's another
> issue. I would like to display the current player's shape when he clicks on
> a cell. The thing is I don't know how to interact with the DOM in this
> case. I know how to define an onClick event on each cell (displayed as a
> div), but I don't know how to interact with a cell to display a shape in
> its div).
>

You're making great progress.
Now, it should be obvious that you need to change/update the  "area" on
clicks to reflect the current state of the game.

move the area into the model and on each click check to see if it is a
valid click and if it is a valid click, change the value of the box and
switch to the other player.

the view should also be changed to handle the move of the area into the
model and you should change the rendering of the box to take into
consideration the shape. ;)
I've already started that work in the previous code when I parameterized
the boxStyle but that's only one of the ways to handle it (style the div
with a background image).
another way to approach it is to add the image (or a plain piece of text)
as a child of the box div.


-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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