Rename method, and change debug string on top.
This commit is contained in:
parent
b0c9c5ec18
commit
0d31433b96
6
Go.elm
6
Go.elm
|
@ -1,6 +1,6 @@
|
||||||
import Go.Types exposing (..)
|
import Go.Types exposing (..)
|
||||||
import Go.Game exposing (verify)
|
import Go.Game exposing (verify)
|
||||||
import Go.Decoders exposing (decodeUpdatestring)
|
import Go.Decoders exposing (decodeUpdateString)
|
||||||
import Go.Ws exposing (..)
|
import Go.Ws exposing (..)
|
||||||
import Go.View exposing (..)
|
import Go.View exposing (..)
|
||||||
import WebSocket
|
import WebSocket
|
||||||
|
@ -28,7 +28,7 @@ initDummy = (Model
|
||||||
|
|
||||||
view : Model -> Html Msg
|
view : Model -> Html Msg
|
||||||
view m = div []
|
view m = div []
|
||||||
[ text (toString m.currentColor)
|
[ text (toString m.board)
|
||||||
, renderBoard m.sessionSize m.board
|
, renderBoard m.sessionSize m.board
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ update msg model = case msg of
|
||||||
Place indx -> case verify (indx, model.sessionColor) model of
|
Place indx -> case verify (indx, model.sessionColor) model of
|
||||||
Nothing -> ( { model | error = Just "Can't place piece" }, Cmd.none)
|
Nothing -> ( { model | error = Just "Can't place piece" }, Cmd.none)
|
||||||
Just c -> ( { model | board = c::model.board }, sendMove model c)
|
Just c -> ( { model | board = c::model.board }, sendMove model c)
|
||||||
Update s -> case decodeUpdatestring s of
|
Update s -> case decodeUpdateString s of
|
||||||
Ok (c, xs) -> ( { model | board = xs, currentColor = Just c }, Cmd.none)
|
Ok (c, xs) -> ( { model | board = xs, currentColor = Just c }, Cmd.none)
|
||||||
Err s -> ( { model | error = Just "Can't parse server response" }, Cmd.none)
|
Err s -> ( { model | error = Just "Can't parse server response" }, Cmd.none)
|
||||||
DismissError -> ({ model | error = Nothing }, Cmd.none)
|
DismissError -> ({ model | error = Nothing }, Cmd.none)
|
||||||
|
|
|
@ -30,5 +30,5 @@ decodeUpdate = decode pair
|
||||||
|> required "turn" decodeColor
|
|> required "turn" decodeColor
|
||||||
|> required "board" (Decode.list decodeCell)
|
|> required "board" (Decode.list decodeCell)
|
||||||
|
|
||||||
decodeUpdatestring : String -> Result String Update
|
decodeUpdateString : String -> Result String Update
|
||||||
decodeUpdatestring = Decode.decodeString decodeUpdate
|
decodeUpdateString = Decode.decodeString decodeUpdate
|
||||||
|
|
Loading…
Reference in New Issue
Block a user