Add new weapons

This commit is contained in:
2022-02-16 08:50:19 +00:00
parent 4f0f8cb4c2
commit 505e4123d7
13 changed files with 208 additions and 72 deletions
+3 -3
View File
@@ -14,6 +14,7 @@ import System.Random
treePath :: Int -> Tree ()
treePath 0 = Node () []
treePath x = Node () [treePath (x-1)]
{- Adds a branch at a certain point down a trunk. -}
addBranchAt
:: Int -- ^ Depth to add branch at
@@ -24,6 +25,7 @@ addBranchAt 0 b (Node () xs) = Node () (xs ++ [b])
addBranchAt i b (Node () (x:xs))
= Node () (addBranchAt (i-1) b x : xs)
addBranchAt _ _ _ = error "Trying to add a branch too far along a tree"
{- Randomly generate a tree containing a maximum of three nodes. -}
smallBranch :: RandomGen g => State g (Tree ())
smallBranch = takeOne
@@ -33,9 +35,7 @@ smallBranch = takeOne
, addBranchAt 0 (treePath 0) (treePath 1)
]
{-
Randomly generate a small tree.
-}
{- Randomly generate a small tree. -}
aTreeStrut :: RandomGen g => State g (Tree ())
aTreeStrut = do
d <- state $ randomR (9,11:: Int)