Simplify layout Annotations

This commit is contained in:
2025-08-21 17:57:02 +01:00
parent befe24e038
commit e7b52f4487
10 changed files with 109 additions and 73 deletions
+22 -3
View File
@@ -11,14 +11,33 @@ import System.Random
type MTRS = MetaTree Room String
data LayoutVars = LayVars
{ _lyGen :: StdGen
, _lyCounter :: Int
}
data Annotation
= OnwardList [Annotation]
| IntAnno (Int -> Annotation)
-- | IntAnno (Int -> Annotation)
-- | AnRoom (State StdGen Room)
| AnTree (State StdGen (MetaTree Room String))
| AnTree (State LayoutVars (MetaTree Room String))
| PassthroughLockKeyLists
[(Int -> State StdGen (MetaTree Room String), State StdGen ItemType)]
[(ItemType, State StdGen (MetaTree Room String))]
Int
-- Int
makeLenses ''Annotation
makeLenses ''LayoutVars
instance RandomGen LayoutVars where
genWord32 x = let (y,g) = genWord32 (x ^. lyGen)
in (y,x & lyGen .~ g)
genWord64 x = let (y,g) = genWord64 (x ^. lyGen)
in (y,x & lyGen .~ g)
split x = let (g,h) = split (x ^. lyGen) in (x & lyGen .~ g, x & lyGen .~ h)
nextLayoutInt :: State LayoutVars Int
nextLayoutInt = do
LayVars g i <- get
put $ LayVars g (i + 1)
return i