Add seagull sounds, remove random generator paramatricity for level gen
This commit is contained in:
@@ -14,22 +14,22 @@ import System.Random
|
||||
--import Control.Lens
|
||||
import Data.Maybe
|
||||
|
||||
addLock :: RandomGen g => Int -> Tree [Annotation g] -> State g (Tree [Annotation g])
|
||||
addLock :: Int -> Tree [Annotation] -> State StdGen (Tree [Annotation])
|
||||
addLock i t = do
|
||||
(beforeLock, afterLock) <- splitTrunk t
|
||||
newBefore <- applyToRandomNode (Key i :) beforeLock
|
||||
return $ addToTrunk newBefore [Node [Lock i] afterLock]
|
||||
{- | Add one corridor between each parent-child link of a tree of annotations. -}
|
||||
padWithCorridors :: Tree [Annotation g] -> Tree [Annotation g]
|
||||
padWithCorridors :: Tree [Annotation] -> Tree [Annotation]
|
||||
padWithCorridors = padWithAno [Corridor]
|
||||
|
||||
padWithAno :: [Annotation g] -> Tree [Annotation g] -> Tree [Annotation g]
|
||||
padWithAno :: [Annotation] -> Tree [Annotation] -> Tree [Annotation]
|
||||
padWithAno ano (Node x xs) = Node ano [Node x (map (padWithAno ano) xs)]
|
||||
|
||||
padSucWithCorridors :: Tree [Annotation g] -> Tree [Annotation g]
|
||||
padSucWithCorridors :: Tree [Annotation] -> Tree [Annotation]
|
||||
padSucWithCorridors (Node x xs) = Node x (map padWithCorridors xs)
|
||||
|
||||
padSucWithDoors :: RandomGen g => Tree [Annotation g] -> Tree [Annotation g]
|
||||
padSucWithDoors :: Tree [Annotation] -> Tree [Annotation]
|
||||
padSucWithDoors (Node x xs) = Node x (map (padWithAno [SpecificRoom thetree]) xs)
|
||||
where
|
||||
thetree = do
|
||||
@@ -40,7 +40,7 @@ padSucWithDoors (Node x xs) = Node x (map (padWithAno [SpecificRoom thetree]) xs
|
||||
]
|
||||
|
||||
{- Add one to three corridors between each parent-child link of a tree of annotations. -}
|
||||
randomPadCorridors :: RandomGen g => Tree [Annotation g] -> State g (Tree [Annotation g])
|
||||
randomPadCorridors :: Tree [Annotation] -> State StdGen (Tree [Annotation])
|
||||
randomPadCorridors (Node x xs) = do
|
||||
n <- state $ randomR (1, 3)
|
||||
xs' <- mapM randomPadCorridors xs
|
||||
@@ -52,7 +52,7 @@ roomThenCorridor theRoom = fmap
|
||||
(shuffleLinks corridor)
|
||||
|
||||
{- | Create a random room tree structure from a list of annotations. -}
|
||||
anoToRoomTree :: RandomGen g => [Annotation g] -> State g (SubCompTree Room)
|
||||
anoToRoomTree :: [Annotation] -> State StdGen (SubCompTree Room)
|
||||
anoToRoomTree anos = case anos of
|
||||
[AnoApplyInt i f] -> f i
|
||||
[ChainAnos ass] -> do
|
||||
|
||||
Reference in New Issue
Block a user