Created
May 22, 2017 14:58
-
-
Save leojpod/3e6162261be42ecc4117eee2deab5212 to your computer and use it in GitHub Desktop.
View.elm for the board: HTML version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boardDisplay : Board -> Html BoardMsg | |
boardDisplay board = | |
table [] | |
((tr [] | |
((td [] []) | |
:: ((List.range 0 9) | |
|> List.map (\col -> td [] [ text (toString col) ]) | |
) | |
) | |
) | |
:: (List.indexedMap rowView board) | |
) | |
rowView : Int -> List Cell -> Html BoardMsg | |
rowView idx row = | |
tr [] ((td [] [ text (toString idx) ]) :: (List.map cellView row)) | |
cellView : Cell -> Html BoardMsg | |
cellView cell = | |
case cell of | |
Empty -> | |
td [] [ text "." ] | |
Dead -> | |
td [] [ text "-" ] | |
Alive -> | |
td [] [ text "X" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment