Add new weapons
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user