Add tree structure generation
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
{-
|
||||
Annotating tree structures with desired properties for rooms.
|
||||
-}
|
||||
module Dodge.Layout.Tree.Annotate
|
||||
where
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.Layout.Tree.Polymorphic
|
||||
|
||||
import Data.Tree
|
||||
import Control.Monad.State
|
||||
import System.Random
|
||||
|
||||
data Annotation
|
||||
= Lock Int
|
||||
| Key Int
|
||||
|
||||
addLock :: RandomGen g => Int -> Tree [Annotation] -> State g (Tree [Annotation])
|
||||
addLock i t = do
|
||||
(beforeLock, afterLock) <- splitTrunk t
|
||||
newBefore <- applyToRandomNode (Key i :) beforeLock
|
||||
return $ addToTrunk newBefore [Node [Lock i] afterLock]
|
||||
|
||||
--annoToRoom :: RandomGen g => [Annotation] -> State g (Either Room Room)
|
||||
--annoToRoom as = undefined
|
||||
Reference in New Issue
Block a user