summaryrefslogtreecommitdiff
path: root/haskell/src/SpaceTraders/Model
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--haskell/src/SpaceTraders/Model/Ship.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/haskell/src/SpaceTraders/Model/Ship.hs b/haskell/src/SpaceTraders/Model/Ship.hs
index f42d558..f30679c 100644
--- a/haskell/src/SpaceTraders/Model/Ship.hs
+++ b/haskell/src/SpaceTraders/Model/Ship.hs
@@ -6,6 +6,7 @@ module SpaceTraders.Model.Ship
( Ship(..)
, isDocked
, isInOrbit
+ , overNinetyPercentFuel
) where
import Data.Aeson
@@ -40,3 +41,10 @@ isDocked ship = status (nav ship) == "DOCKED"
isInOrbit :: Ship -> Bool
isInOrbit = not . isDocked
+
+overNinetyPercentFuel :: Ship -> Bool
+overNinetyPercentFuel ship = curr * 10 > capa * 9
+ where
+ curr = current f
+ capa = SpaceTraders.Model.Fuel.capacity f
+ f = fuel ship