Random tree structure generation of rooms
This commit is contained in:
@@ -3,6 +3,8 @@ Combining and composing trees with 'Either' nodes.
|
||||
-}
|
||||
module Dodge.Layout.Tree.Either
|
||||
( expandTreeBy
|
||||
, connectRoom
|
||||
, deadRoom
|
||||
) where
|
||||
import Data.Tree
|
||||
|
||||
@@ -20,3 +22,15 @@ expandTreeBy f (Node x xs) = appendAndRemove $ f x
|
||||
|
||||
removeEither (Left y) = y
|
||||
removeEither (Right y) = y
|
||||
|
||||
{-
|
||||
Make a singleton connection of an Either Tree.
|
||||
-}
|
||||
connectRoom :: a -> Tree (Either a a)
|
||||
connectRoom r = Node (Right r) []
|
||||
|
||||
{-
|
||||
Make a singleton dead end of an Either Tree.
|
||||
-}
|
||||
deadRoom :: a -> Tree (Either a a)
|
||||
deadRoom r = Node (Left r) []
|
||||
|
||||
Reference in New Issue
Block a user