diff options
author | Griffin Smith <root@gws.fyi> | 2019-09-07T18·49-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-09-07T18·52-0400 |
commit | f03ad6bbd60b6ccdd329fc6740bcea2b554980dd (patch) | |
tree | eba7d803e5468ae12edf133acf21a2e227ef1f6c /src/Xanthous/Data.hs | |
parent | 73a52e531d940858f0ac334d8b2ccda479ea7b5e (diff) |
Add cellular-automata cave generator
Add a cellular-automata-based cave level generator, plus an optparse-applicative-based CLI for invoking level generators in general.
Diffstat (limited to 'src/Xanthous/Data.hs')
-rw-r--r-- | src/Xanthous/Data.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Xanthous/Data.hs b/src/Xanthous/Data.hs index e891a8e9e0d6..6e779a450525 100644 --- a/src/Xanthous/Data.hs +++ b/src/Xanthous/Data.hs @@ -17,6 +17,12 @@ module Xanthous.Data , loc -- * + , Dimensions'(..) + , Dimensions + , HasWidth(..) + , HasHeight(..) + + -- * , Direction(..) , opposite , move @@ -88,6 +94,21 @@ loc = iso hither yon -------------------------------------------------------------------------------- +data Dimensions' a = Dimensions + { _width :: a + , _height :: a + } + deriving stock (Show, Eq, Functor, Generic) + deriving anyclass (CoArbitrary, Function) +makeFieldsNoPrefix ''Dimensions' + +instance Arbitrary a => Arbitrary (Dimensions' a) where + arbitrary = Dimensions <$> arbitrary <*> arbitrary + +type Dimensions = Dimensions' Word + +-------------------------------------------------------------------------------- + data Direction where Up :: Direction Down :: Direction |