summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authormelody!2024-08-07 21:23:52 -0400
committermelody!2024-08-07 21:23:52 -0400
commit7133a728596918544601a18e3090281eaff34ad1 (patch)
tree79aa8aec9445372c8e6fe3f8bef723dd76cdefb3 /src
parent7a6eb573543666ef3f642f84dbb4a386429bf75e (diff)
did stuff
Diffstat (limited to 'src')
-rw-r--r--src/Bee.hs9
-rw-r--r--src/Beekeep.hs41
-rw-r--r--src/MyLib.hs4
-rw-r--r--src/Plant.hs27
4 files changed, 77 insertions, 4 deletions
diff --git a/src/Bee.hs b/src/Bee.hs
new file mode 100644
index 0000000..b83e67e
--- /dev/null
+++ b/src/Bee.hs
@@ -0,0 +1,9 @@
+module Bee
+  ( Beehive (..)
+  ) where
+
+data Beehive = Beehive
+  { hiveWorkers :: Int
+  , hiveOwner :: String
+  }
+
diff --git a/src/Beekeep.hs b/src/Beekeep.hs
new file mode 100644
index 0000000..9fb874a
--- /dev/null
+++ b/src/Beekeep.hs
@@ -0,0 +1,41 @@
+module Beekeep
+  ( Garden
+  , Block (..)
+  , gardenWidth
+  , gardenHeight
+  , newGarden
+  , gardenSet
+  , gardenGet
+  ) where
+import Bee
+import Plant
+import Data.Array.IO
+
+someFunc :: IO ()
+someFunc = putStrLn "someFunc"
+
+data Block =
+    BEmpty
+  | BPlant Plant
+  | BHive Beehive
+
+type Garden = IOArray Int Block
+
+gardenWidth :: Int
+gardenWidth = 128
+
+gardenHeight :: Int
+gardenHeight = 128
+
+newGarden :: IO Garden
+newGarden = newArray (1, gardenWidth * gardenHeight) BEmpty
+
+calcGardenIndex :: (Int, Int) -> Int
+calcGardenIndex (x, y) = x + y * gardenHeight
+
+gardenGet :: Garden -> (Int, Int) -> IO Block
+gardenGet g coords = readArray g (calcGardenIndex coords)
+
+gardenSet :: Garden -> (Int, Int) -> Block -> IO ()
+gardenSet g coords b = writeArray g (calcGardenIndex coords) b
+
diff --git a/src/MyLib.hs b/src/MyLib.hs
deleted file mode 100644
index e657c44..0000000
--- a/src/MyLib.hs
+++ /dev/null
@@ -1,4 +0,0 @@
-module MyLib (someFunc) where
-
-someFunc :: IO ()
-someFunc = putStrLn "someFunc"
diff --git a/src/Plant.hs b/src/Plant.hs
new file mode 100644
index 0000000..04e35e7
--- /dev/null
+++ b/src/Plant.hs
@@ -0,0 +1,27 @@
+module Plant
+  ( GrowthStage (..)
+  , PlantType (..)
+  , Plant (..)
+  , Seed (..)
+  ) where
+
+data GrowthStage =
+    SSeed
+  | SSapling
+  | SGrown
+
+data PlantType =
+    TFlower
+  | TCrop
+  | TTree
+
+data Plant = Plant
+  { plantName :: String
+  , plantType :: PlantType
+  , plantStage :: GrowthStage
+  }
+
+data Seed = Seed
+  { seedName :: String
+  , seedType :: PlantType }
+