diff --git a/.gitignore b/.gitignore index 087866c..a4ee41a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,5 +17,3 @@ cabal.sandbox.config *.eventlog .stack-work/ cabal.project.local - -Main diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..9a994af --- /dev/null +++ b/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/haskell-go-checkers.cabal b/haskell-go-checkers.cabal new file mode 100644 index 0000000..55ad778 --- /dev/null +++ b/haskell-go-checkers.cabal @@ -0,0 +1,69 @@ +-- Initial haskell-go-checkers.cabal generated by cabal init. For further +-- documentation, see http://haskell.org/cabal/users-guide/ + +-- The name of the package. +name: haskell-go-checkers + +-- The package version. See the Haskell package versioning policy (PVP) +-- for standards guiding when and how versions should be incremented. +-- http://www.haskell.org/haskellwiki/Package_versioning_policy +-- PVP summary: +-+------- breaking API changes +-- | | +----- non-breaking API additions +-- | | | +--- code changes with no API change +version: 0.1.0.0 + +-- A short (one-line) description of the package. +synopsis: Go and Checkers game in Haskell + +-- A longer description of the package. +-- description: + +-- URL for the project homepage or repository. +homepage: https://github.com/prateekkumarweb/haskell-go-checkers + +-- The license under which the package is released. +-- license: + +-- The file containing the license text. +-- license-file: LICENSE + +-- The package author(s). +author: Prateek Kumar, Vaibhav Sinha, Anurag Singh + +-- An email address to which users can send suggestions, bug reports, and +-- patches. +maintainer: prateek@prateekkumar.in + +-- A copyright notice. +-- copyright: + +category: Game + +build-type: Simple + +-- Extra files to be distributed with the package, such as examples or a +-- README. +extra-source-files: README.md + +-- Constraint on the version of Cabal needed to build this package. +cabal-version: >=1.10 + + +executable haskell-go-checkers + -- .hs or .lhs file containing the Main module. + main-is: Main.hs + + -- Modules included in this executable, other than Main. + -- other-modules: + + -- LANGUAGE extensions used by modules in this package. + -- other-extensions: + + -- Other library packages from which modules are imported. + build-depends: base >=4.8 && <4.9, containers >=0.5 && <0.6, gloss ==1.11.* + + -- Directories containing source files. + hs-source-dirs: src + + -- Base language which the package is written in. + default-language: Haskell2010 diff --git a/BoardCheckers.hs b/src/BoardCheckers.hs similarity index 100% rename from BoardCheckers.hs rename to src/BoardCheckers.hs diff --git a/BoardGo.hs b/src/BoardGo.hs similarity index 99% rename from BoardGo.hs rename to src/BoardGo.hs index 69689bc..6b6fd55 100644 --- a/BoardGo.hs +++ b/src/BoardGo.hs @@ -172,7 +172,7 @@ findTerritory game@(Game _ _ boardSize _ _) point@(Point x y) stone (m, points) findTerritories :: Game -> Point -> (Map Point Status) -> (Map Point Status) findTerritories game point m - | seekBoard game point /= Empty = addPiece m point None + | seekBoard game point /= Empty && seekBoard game point /= Ko = addPiece m point None | seekMap m point == SeenW = m | seekMap m point == SeenB = m | seekMap m point == None = m diff --git a/Checkers.hs b/src/Checkers.hs similarity index 100% rename from Checkers.hs rename to src/Checkers.hs diff --git a/Go.hs b/src/Go.hs similarity index 100% rename from Go.hs rename to src/Go.hs diff --git a/Main.hs b/src/Main.hs similarity index 73% rename from Main.hs rename to src/Main.hs index ef9fa49..9c35f61 100644 --- a/Main.hs +++ b/src/Main.hs @@ -1,7 +1,12 @@ +module Main(main) where + import Go import Checkers +import Graphics.Gloss +main :: IO() main = do + display (InWindow "Nice Window" (200, 200) (10, 10)) white (Circle 80) putStrLn $ "Enter 1 to play Go" putStrLn $ "Enter 2 to play Checkers" putStrLn $ "Enter 0 to Exit"