Created
September 7, 2017 19:04
-
-
Save Electron-libre/4cda8be04f20b5a76a5cb2d2a7910cde to your computer and use it in GitHub Desktop.
This file contains hidden or 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
module Analysis.GobanState exposing (GobanState, Intersection(..), Stone(..), blank, addStone) | |
import Matrix exposing (Matrix, repeat, set) | |
type alias GobanState = Matrix Intersection | |
type Intersection = Free | Stone | |
type Stone = Black | White | |
blank : Int -> GobanState | |
blank size = | |
repeat size size Free | |
-- addStone : Int -> Int -> Stone -> GobanState -> GobanState Intersection | |
addStone i j stone goban = | |
set i j stone goban | |
This file contains hidden or 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
-- When | |
addStone 0 0 Black (blank 3) | |
-- Type system fails at: | |
Function `addStone` is expecting the 4th argument to be: | |
Matrix.Matrix Stone | |
But it is: | |
GobanState | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment