aboutsummaryrefslogtreecommitdiff
path: root/server/lib/Cafp/Game.hs
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/Cafp/Game.hs')
-rw-r--r--server/lib/Cafp/Game.hs14
1 files changed, 5 insertions, 9 deletions
diff --git a/server/lib/Cafp/Game.hs b/server/lib/Cafp/Game.hs
index ad33368..740eac5 100644
--- a/server/lib/Cafp/Game.hs
+++ b/server/lib/Cafp/Game.hs
@@ -5,6 +5,7 @@ module Cafp.Game
( PlayerId
, Cards (..)
, Game (..)
+ , gameCards, gamePlayers, gameNextPlayerId
, newGame
, joinGame
@@ -16,7 +17,8 @@ module Cafp.Game
) where
import Cafp.Messages
-import Control.Lens (at, ix, over, (%~), (&), (.~), (^.), (^?))
+import Control.Lens (at, ix, over, to, (%~), (&), (.~), (^.),
+ (^?))
import Control.Lens.TH (makeLenses)
import qualified Data.HashMap.Strict as HMS
import Data.Maybe (fromMaybe)
@@ -25,18 +27,12 @@ import qualified Data.Text as T
type PlayerId = Int
-data Cards = Cards
- { _cardsBlack :: [BlackCard]
- , _cardsWhite :: [WhiteCard]
- } deriving (Show)
-
data Game = Game
{ _gameCards :: !Cards
, _gamePlayers :: !(HMS.HashMap Int Text)
, _gameNextPlayerId :: !Int
} deriving (Show)
-makeLenses ''Cards
makeLenses ''Game
newGame :: Cards -> Game
@@ -65,6 +61,6 @@ gameViewForPlayer self game =
GameView
{ gameViewOpponents = opponents
, gameViewMyName = name
- , gameViewBlackCard = game ^? gameCards . cardsBlack . ix 0
- , gameViewHand = take 10 $ game ^. gameCards . cardsWhite
+ , gameViewBlackCard = Just $ BlackCard 0
+ , gameViewHand = [WhiteCard x | x <- [0 .. 9]]
}