<commit_before>(ns house.rooms.garden
  (:require [advenjure.rooms :as room]
            [advenjure.items :as item]
            [advenjure.utils :as utils]))

(def garden (->
              (room/make "Garden"
                         "The garden ended on a long wall, partially covered by a creeping fig."
                         :initial-description "I made sure that no one was looking, and climbed up the fig.\nI got down on the other side of the wall, in a garden.")
              (room/add-item (item/make "wall" "A plastered brick wall, about twice my height." :climb-up "The fig wasn't strong enough to climb up on this side of the wall.") "")
              (room/add-item (item/make ["creeping fig" "fig"] "It was a bit more under control than on the other side." :climb-up "The fig wasn't strong enough to climb up on this side of the wall.") "")
              (room/add-item (item/make ["path" "stone path"] "It led back to the house.") "A stone path led south to the back entrance of the house.")
              (room/add-item (item/make ["shed" "wooden shed"] "It looked a bit neglected." :enter :shed) "There was an old wooden shed on the east corner.")))


(defn crow-pre
  "If trying to open the back door do it, otherwise default message."
  [gs item]
  (if (some #{"back door"} (:names item))
    true
    "I didn't want to break into that."))

(defn crow-post
  "Open the door and connect the rooms."
  [old gs]
  (let [door (utils/find-first gs "door")
        new-door (item/make ["back door" "door"]
                            "You could hardly tell that I, um, \"unlocked\" it."
                            :open true
                            :enter :back-hall3)
        new-map (room/connect (:room-map gs) :house-back :south :back-hall3)]
    (-> gs
      (assoc :room-map new-map)
      (utils/replace-item door new-door))))

; FIXME need to cover case use with screw and use with hammer, screwdriver
; FIXME unlock with crowbar is sort of funny, but open with isn't, it should work! --> probably best to separate verbs
(def back-door (item/make ["door" "back door"]
                          "It didn't look particularly tough."
                          :break "Perhaps with the proper tooling."
                          :enter "It was locked."
                          :unlock {:say "Sure. I unlocked the hell out of it. The door was now open."
                                   :post `crow-post} ; FIXME so far not working
                          :locked true))

(def crowbar (item/make "crowbar" "satisfy all your breaking-into-places needs."
                        :take true
                        :unlocks back-door
                        :use-with {:pre `crow-pre
                                   :say "Easy job for the crowbar. The door was now open."<commit_msg>improve crowbar puzzle<commit_after>(ns house.rooms.garden
  (:require [advenjure.rooms :as room]
            [advenjure.items :as item]
            [advenjure.utils :as utils]))

(def garden (->
              (room/make "Garden"
                         "The garden ended on a long wall, partially covered by a creeping fig."
                         :initial-description "I made sure that no one was looking, and climbed up the fig.\nI got down on the other side of the wall, in a garden.")
              (room/add-item (item/make "wall" "A plastered brick wall, about twice my height." :climb-up "The fig wasn't strong enough to climb up on this side of the wall.") "")
              (room/add-item (item/make ["creeping fig" "fig"] "It was a bit more under control than on the other side." :climb-up "The fig wasn't strong enough to climb up on this side of the wall.") "")
              (room/add-item (item/make ["path" "stone path"] "It led back to the house.") "A stone path led south to the back entrance of the house.")
              (room/add-item (item/make ["shed" "wooden shed"] "It looked a bit neglected." :enter :shed) "There was an old wooden shed on the east corner.")))


(defn crow-pre
  "If trying to open the back door do it, otherwise default message."
  [gs item]
  (if (some #{"back door"} (:names item))
    true
    "I didn't want to break into that."))

(defn crow-post
  "Open the door and connect the rooms."
  [old gs]
  (let [door (utils/find-first gs "door")
        new-door (item/make ["back door" "door"]
                            "You could hardly tell that I, um, \"unlocked\" it."
                            :open true
                            :enter :back-hall3)
        new-map (room/connect (:room-map gs) :house-back :south :back-hall3)]
    (if-not (:locked door)
      (-> gs
        (assoc :room-map new-map)
        (utils/replace-item door new-door)))))

(def back-door (item/make ["door" "back door"]
                          "It didn't look particularly tough."
                          :break "Perhaps with the proper tooling."
                          :enter "It was locked."
                          :unlock {:say "Sure. I unlocked the hell out of it. The door was now open."
                                   :post `crow-post}
                          :open-with {:say "Easy job for the crowbar. The door was now open."
                                      :post `crow-post}
                          :locked true))

(def crowbar (item/make "crowbar" "satisfy all your breaking-into-places needs."
                        :take true
                        :unlocks back-door
                        :use-with {:pre `crow-pre
                                   :say "Easy job for the crowbar. The door was now open."
{'fraction_non_alphanumeric': 0.10704074338813438, 'fraction_numerical': 0.0007147962830593281, 'mean_word_length': 1.761223482979773, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3683643', 'n_tokens_mistral': 1574, 'n_tokens_neox': 1513, 'n_words': 662}