advenjure
advenjure copied to clipboard
refactor basic API to favor a declarative/data-oriented style
This:
(def living (-> (room/make "Living Room"
"A living room with a nailed shut window"
:initial-description "The living room was as smelly as the bedroom..."
:synonyms ["living" "livingroom"])
(room/add-item drawer "There was a chest drawer by the door.")
(room/add-item door "")
(room/add-item glass-door "")
(room/add-item portrait "A portrait ocuppied a very prominent place on one of the walls.")
(room/add-item (item/make ["window"] "It was nailed shut." :closed true :open "It was nailed shut.") "")))
Should turn into this
(def living (room/make {:name "Living Room"
:description "A living room with a nailed shut window"
:initial-description "The living room was as smelly as the bedroom..."
:synonyms ["living" "livingroom"]
:items [drawer door glass-door portrait
(item/make {:names ["window"]
:description "It was nailed shut."
:closed true
:open "It was nailed shut."})]}
:item-descriptions {"drawer" "There was a chest drawer by the door."
"portrait" "A portrait ocuppied a very prominent place on one of the walls."}))