File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
module Morra where
2
- import Data.Maybe
3
- import Data.Monoid
2
+
3
+ import Control.Applicative
4
4
import Control.Monad
5
5
import Control.Monad.IO.Class
6
6
import Control.Monad.Trans.Class
7
7
import Control.Monad.Trans.Maybe
8
8
import Control.Monad.Trans.Reader
9
9
import Control.Monad.Trans.State
10
- import Control.Applicative
10
+ import Data.Maybe
11
+ import Data.Monoid
11
12
import System.Random
12
13
-- StateT should save scores of both player and computer
13
14
-- Computer should choose its hand randomly
@@ -36,7 +37,7 @@ instance Monoid Score where
36
37
mempty = Score (mempty , mempty )
37
38
(Score (h1, a1)) `mappend` (Score (h2, a2)) =
38
39
Score ((h1 `mappend` h2), (a1 `mappend` a2))
39
-
40
+
40
41
data Winner
41
42
= Humans
42
43
| Computer
@@ -103,7 +104,7 @@ process :: Score -> Maybe Score -> IO Score
103
104
process current maybeNext =
104
105
case maybeNext of
105
106
Just next -> evalStateT go' (current `mappend` next)
106
- Nothing -> return current
107
+ Nothing -> return current
107
108
108
109
go' :: StateT Score IO Score
109
110
go' = do
You can’t perform that action at this time.
0 commit comments