summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--onecard.cabal19
-rw-r--r--src/Card.hs (renamed from Card.hs)0
-rw-r--r--src/Color.hs (renamed from Color.hs)0
-rw-r--r--src/Game.hs (renamed from Game.hs)8
-rw-r--r--src/Main.hs (renamed from Main.hs)0
-rw-r--r--src/Player.hs (renamed from Player.hs)4
7 files changed, 26 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index c56f049..a7d265a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.undodir/
+dist-newstyle/
*.hi
*.o
Main
diff --git a/onecard.cabal b/onecard.cabal
new file mode 100644
index 0000000..c4d2ef4
--- /dev/null
+++ b/onecard.cabal
@@ -0,0 +1,19 @@
+name: onecard
+version: 0.1.0
+build-type: Simple
+cabal-version: 1.18
+
+library
+ default-language: Haskell2010
+ exposed-modules: Game, Player, Card, Color
+ hs-source-dirs: src
+ build-depends: base, random
+ ghc-options: -dynamic
+
+executable onecard
+ default-language: Haskell2010
+ hs-source-dirs: src
+ build-depends: base, random, optparse-applicative, onecard
+ main-is: Main.hs
+ other-modules: Game, Player, Card, Color
+ ghc-options: -dynamic
diff --git a/Card.hs b/src/Card.hs
index c674b5d..c674b5d 100644
--- a/Card.hs
+++ b/src/Card.hs
diff --git a/Color.hs b/src/Color.hs
index 1d63fcd..1d63fcd 100644
--- a/Color.hs
+++ b/src/Color.hs
diff --git a/Game.hs b/src/Game.hs
index 2888bbe..7e553e7 100644
--- a/Game.hs
+++ b/src/Game.hs
@@ -34,12 +34,8 @@ beginGame setup@(Setup n r d c a) = do
gen <- getStdGen
let decks = C.shuffle gen $ C.fullDecks d
let stock = drop n decks
- let defaultPlayers = [ Player "Alice" 0 []
- , Player "Bob" 0 []
- , Player "Carol" 0 []
- ]
- pidx <- firstPlayer defaultPlayers decks
- let game = Game { players = defaultPlayers
+ pidx <- firstPlayer P.defaultPlayers decks
+ let game = Game { players = P.defaultPlayers
, playerIdx = pidx
, attack = 1
, direction = 1
diff --git a/Main.hs b/src/Main.hs
index 1b4996f..1b4996f 100644
--- a/Main.hs
+++ b/src/Main.hs
diff --git a/Player.hs b/src/Player.hs
index 3bec60c..8b64c79 100644
--- a/Player.hs
+++ b/src/Player.hs
@@ -10,6 +10,10 @@ data Player = Player { name :: String
, cards :: [Card]
}
+defaultPlayers :: [Player]
+defaultPlayers = map (\name -> Player name 0 []) $
+ ["Alice", "Bob", "Carol", "David", "Eve", "Frank", "Gina", "Howard"]
+
-- | Update `i`-th player in `ps` to `p`.
update :: [Player] -> Int -> Player -> [Player]
update ps i p =