From 4db3a68efec079bdb8723f377929bfa05860bdc2 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 20 Sep 2019 13:14:55 -0400 Subject: Add doors and an open command Add a Door entity and an Open command, which necessitated supporting the direction prompt. Currently nothing actually puts doors on the map, which puts a slight damper on actually testing this out. --- src/Xanthous/Data.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Xanthous/Data.hs') diff --git a/src/Xanthous/Data.hs b/src/Xanthous/Data.hs index 704b3c6e74c4..afba273005f8 100644 --- a/src/Xanthous/Data.hs +++ b/src/Xanthous/Data.hs @@ -135,6 +135,7 @@ data Direction where UpRight :: Direction DownLeft :: Direction DownRight :: Direction + Here :: Direction deriving stock (Show, Eq, Generic) instance Arbitrary Direction where @@ -150,6 +151,7 @@ opposite UpLeft = DownRight opposite UpRight = DownLeft opposite DownLeft = UpRight opposite DownRight = UpLeft +opposite Here = Here move :: Direction -> Position -> Position move Up = y -~ 1 @@ -160,6 +162,7 @@ move UpLeft = move Up . move Left move UpRight = move Up . move Right move DownLeft = move Down . move Left move DownRight = move Down . move Right +move Here = id asPosition :: Direction -> Position asPosition dir = move dir mempty -- cgit 1.4.1