Add Binary instances

This commit is contained in:
2022-08-21 10:58:19 +01:00
parent 386a2b4732
commit 1ce7d4a72d
95 changed files with 345 additions and 3 deletions
+7
View File
@@ -5,6 +5,7 @@
module Dodge.Data.ActionPlan where
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
@@ -23,11 +24,13 @@ data ActionPlan
, _apGoal :: [Goal]
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ActionPlan
data RandImpulse
= RandImpulseList [Impulse]
| RandImpulseCircMove Float
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary RandImpulse
data Impulse
= Move Point2
@@ -62,6 +65,7 @@ data Impulse
}
| ImpulseNothing
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Impulse
infixr 9 `WaitThen`
@@ -169,6 +173,7 @@ data Action
, _mainAction :: Action
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Action
data Strategy
= Flank Int
@@ -187,12 +192,14 @@ data Strategy
| Flee
| MeleeStrike
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Strategy
data Goal
= LiveLongAndProsper
| Kill Int
| SentinelAt Point2 Float
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary Goal
deriveJSON defaultOptions ''ActionPlan
deriveJSON defaultOptions ''RandImpulse