Version 0.1.1
This commit is contained in:
parent
7e76600f59
commit
811a28315c
46 changed files with 434 additions and 415 deletions
|
|
@ -134,337 +134,337 @@
|
|||
043
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
044 ##### Locations:
|
||||
044 By implication, the character values passed should include *all* the
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
045 information the giver knows about the character; that can then be degraded
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
046 as the receiver stores only that segment which the receiver finds
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
047 interesting.
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
045
|
||||
048
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
046 A 'location' value is a list comprising at most the x/y coordinate location
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
047 and the ids of the settlement and region (possibly hierarchically) that contain
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
048 the location. If the x/y is not local to the home of the receiving agent, they
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
049 won't remember it and won't pass it on; if any of the ids are not interesting
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
050 So location information will degrade progressively as the item is passed along.
|
||||
049 ##### Locations:
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
051
|
||||
050
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
052 It is assumed that the `:home` of a character is a location in this sense.
|
||||
051 A 'location' value is a list comprising at most the x/y coordinate location
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
052 and the ids of the settlement and region (possibly hierarchically) that contain
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
053 the location. If the x/y is not local to the home of the receiving agent, they
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
054 won't remember it and won't pass it on; if any of the ids are not interesting
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
055 So location information will degrade progressively as the item is passed along.
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
053
|
||||
056
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
054 ##### Inferences:
|
||||
057 It is assumed that the `:home` of a character is a location in this sense.
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
055
|
||||
058
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
056 If an agent learns that Adam has married Betty, they can infer that Betty has
|
||||
059 ##### Inferences:
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
060
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
057 married Adam; if they learn that Charles killed Dorothy, that Dorothy has died.
|
||||
061 If an agent learns that Adam has married Betty, they can infer that Betty has
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
058 I'm not convinced that my representation of inferences here is ideal.
|
||||
062 married Adam; if they learn that Charles killed Dorothy, that Dorothy has died.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
059 "
|
||||
063 I'm not convinced that my representation of inferences here is ideal.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
064 "
|
||||
</span><br/>
|
||||
<span class="covered" title="13 out of 13 forms covered">
|
||||
060 { ;; A significant attack is interesting whether or not it leads to deaths
|
||||
065 { ;; A significant attack is interesting whether or not it leads to deaths
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
061 :attack {:verb :attack :keys [:actor :other :location]}
|
||||
066 :attack {:verb :attack :keys [:actor :other :location]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
062 ;; Deaths of characters may be interesting
|
||||
067 ;; Deaths of characters may be interesting
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
063 :die {:verb :attack :keys [:actor :location]}
|
||||
068 :die {:verb :die :keys [:actor :location]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
064 ;; Deliberate killings are interesting.
|
||||
069 ;; Deliberate killings are interesting.
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
065 :kill {:verb :kill :keys [:actor :other :location]
|
||||
070 :kill {:verb :kill :keys [:actor :other :location]
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
066 :inferences [{:verb :die :actor :other :other :nil}]}
|
||||
071 :inferences [{:verb :die :actor :other :other :nil}]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
067 ;; Marriages may be interesting
|
||||
072 ;; Marriages may be interesting
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
068 :marry {:verb :marry :keys [:actor :other :location]
|
||||
073 :marry {:verb :marry :keys [:actor :other :location]
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
069 :inferences [{:verb :marry :actor :other :other :actor}]}
|
||||
074 :inferences [{:verb :marry :actor :other :other :actor}]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
070 ;; The end of ongoing open conflict between to characters may be interesting
|
||||
075 ;; The end of ongoing open conflict between to characters may be interesting
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
071 :peace {:verb :peace :keys [:actor :other :location]
|
||||
076 :peace {:verb :peace :keys [:actor :other :location]
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
072 :inferences [{:verb :peace :actor :other :other :actor}]}
|
||||
077 :inferences [{:verb :peace :actor :other :other :actor}]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
073 ;; Things related to the plot are interesting, but will require special
|
||||
078 ;; Things related to the plot are interesting, but will require special
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
074 ;; handling. Extra keys may be required by particular plot events.
|
||||
079 ;; handling. Extra keys may be required by particular plot events.
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
075 :plot {:verb :plot :keys [:actor :other :object :location]}
|
||||
080 :plot {:verb :plot :keys [:actor :other :object :location]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
076 ;; Rapes are interesting.
|
||||
081 ;; Rapes are interesting.
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
077 :rape {:verb :rape :keys [:actor :other :location]
|
||||
082 :rape {:verb :rape :keys [:actor :other :location]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
078 ;; Should you also infer from rape that actor is male and adult?
|
||||
083 ;; Should you also infer from rape that actor is male and adult?
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
079 :inferences [{:verb :attack}
|
||||
084 :inferences [{:verb :attack}
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
080 {:verb :sex}
|
||||
085 {:verb :sex}
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
081 {:verb :sex :actor :other :other :actor}]}
|
||||
086 {:verb :sex :actor :other :other :actor}]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
082 ;; Merchants, especially, are interested in prices in other markets
|
||||
087 ;; Merchants, especially, are interested in prices in other markets
|
||||
</span><br/>
|
||||
<span class="covered" title="10 out of 10 forms covered">
|
||||
083 :sell {:verb :sell :keys [:actor :other :object :location :price]}
|
||||
088 :sell {:verb :sell :keys [:actor :other :object :location :price]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
084 ;; Sex can juicy gossip, although not normally if the participants are in an
|
||||
089 ;; Sex can juicy gossip, although not normally if the participants are in an
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
085 ;; established sexual relationship.
|
||||
090 ;; established sexual relationship.
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
086 :sex {:verb :sex :keys [:actor :other :location]
|
||||
091 :sex {:verb :sex :keys [:actor :other :location]
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
087 :inferences [{:verb :sex :actor :other :other :actor}]}
|
||||
092 :inferences [{:verb :sex :actor :other :other :actor}]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
088 ;; Thefts are interesting
|
||||
093 ;; Thefts are interesting
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
089 :steal {:verb :steal :keys [:actor :other :object :location]}
|
||||
094 :steal {:verb :steal :keys [:actor :other :object :location]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
090 ;; The succession of rulers is interesting; of respected craftsmen,
|
||||
095 ;; The succession of rulers is interesting; of respected craftsmen,
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
091 ;; potentially also interesting.
|
||||
096 ;; potentially also interesting.
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
092 :succession {:verb :succession :keys [:actor :other :location :rank]}
|
||||
097 :succession {:verb :succession :keys [:actor :other :location :rank]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
093 ;; The start of ongoing open conflict between to characters may be interesting
|
||||
098 ;; The start of ongoing open conflict between to characters may be interesting
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
094 :war {:verb :war :keys [:actor :other :location]
|
||||
099 :war {:verb :war :keys [:actor :other :location]
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
095 :inferences [{:verb :war :actor :other :other :actor}]}
|
||||
100 :inferences [{:verb :war :actor :other :other :actor}]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
096 })
|
||||
101 })
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
097
|
||||
102
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
098
|
||||
103
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
099 (defn interest-in-character
|
||||
104 (defn interest-in-character
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
100 "Integer representation of how interesting this `character` is to this
|
||||
105 "Integer representation of how interesting this `character` is to this
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
101 `gossip`.
|
||||
106 `gossip`.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
102 *TODO:* this assumes that characters are passed as keywords, but, as
|
||||
107 *TODO:* this assumes that characters are passed as keywords, but, as
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
103 documented above, they probably have to be maps, to allow for degradation."
|
||||
108 documented above, they probably have to be maps, to allow for degradation."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
104 [gossip character]
|
||||
109 [gossip character]
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
110 (count
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
105 (count
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
106 (concat
|
||||
111 (concat
|
||||
</span><br/>
|
||||
<span class="partial" title="6 out of 12 forms covered">
|
||||
107 (filter #(= (:actor % character)) (:knowledge gossip))
|
||||
112 (filter #(= (:actor % character)) (:knowledge gossip))
|
||||
</span><br/>
|
||||
<span class="partial" title="6 out of 12 forms covered">
|
||||
108 (filter #(= (:other % character)) (:knowledge gossip)))))
|
||||
113 (filter #(= (:other % character)) (:knowledge gossip)))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
109
|
||||
114
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
110 (defn interesting-character?
|
||||
115 (defn interesting-character?
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
111 "Boolean representation of whether this `character` is interesting to this
|
||||
116 "Boolean representation of whether this `character` is interesting to this
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
112 `gossip`."
|
||||
117 `gossip`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
113 [gossip character]
|
||||
118 [gossip character]
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
114 (> (interest-in-character gossip character) 0))
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
119 (> (interest-in-character gossip character) 0))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
115
|
||||
120
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
116 (defn interest-in-location
|
||||
121 (defn interest-in-location
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
117 "Integer representation of how interesting this `location` is to this
|
||||
122 "Integer representation of how interesting this `location` is to this
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
118 `gossip`."
|
||||
123 `gossip`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
119 [gossip location]
|
||||
124 [gossip location]
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
120 (cond
|
||||
125 (cond
|
||||
</span><br/>
|
||||
<span class="partial" title="20 out of 21 forms covered">
|
||||
121 (and (map? location) (number? (:x location)) (number? (:y location)))
|
||||
126 (and (map? location) (number? (:x location)) (number? (:y location)))
|
||||
</span><br/>
|
||||
<span class="partial" title="8 out of 9 forms covered">
|
||||
122 (if-let [home (:home gossip)]
|
||||
127 (if-let [home (:home gossip)]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
123 (let [d (distance-between location home)
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
124 i (/ 10000 d) ;; 10000 at metre scale is 10km; interest should
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
125 ;;fall of with distance from home, but possibly on a log scale
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
126 ]
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
127 (if (> i 1) i 0))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
128 0)
|
||||
128 (let [d (distance-between location home)
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
129 (coll? location)
|
||||
129 i (/ 10000 d) ;; 10000 at metre scale is 10km; interest should
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
130 ;;fall off with distance from home, but possibly on a log scale
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
131 ]
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
132 (if (> i 1) i 0))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
133 0)
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
134 (coll? location)
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
130 (reduce
|
||||
135 (reduce
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
131 +
|
||||
136 +
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
132 (map
|
||||
137 (map
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
133 #(interest-in-location gossip %)
|
||||
138 #(interest-in-location gossip %)
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
134 location))
|
||||
139 location))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
135 :else
|
||||
140 :else
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
136 (count
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
141 (count
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
137 (filter
|
||||
</span><br/>
|
||||
<span class="covered" title="10 out of 10 forms covered">
|
||||
138 #(some (fn [x] (= x location)) (:location %))
|
||||
</span><br/>
|
||||
<span class="covered" title="10 out of 10 forms covered">
|
||||
139 (cons {:location (:home gossip)} (:knowledge gossip))))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
140
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
141 ;; (interest-in-location {:home [{0, 0} :test-home] :knowledge []} [:test-home])
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
142
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
143 (defn interesting-location?
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
144 "True if the location of this news `item` is interesting to this `gossip`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
145 [gossip item]
|
||||
142 (filter
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
146 (> (interest-in-location gossip (:location item)) 0))
|
||||
143 #(some (fn [x] (= x location)) (:location %))
|
||||
</span><br/>
|
||||
<span class="covered" title="10 out of 10 forms covered">
|
||||
144 (cons {:location (:home gossip)} (:knowledge gossip))))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
145
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
146 ;; (interest-in-location {:home [{0, 0} :test-home] :knowledge []} [:test-home])
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
147
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
148 (defn interesting-object?
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
148 (defn interesting-location?
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
149 [gossip object]
|
||||
149 "True if the location of this news `item` is interesting to this `gossip`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
150 ;; TODO: Not yet (really) implemented
|
||||
150 [gossip item]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
151 true)
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
151 (> (interest-in-location gossip (:location item)) 0))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
152
|
||||
</span><br/>
|
||||
<span class="partial" title="1 out of 2 forms covered">
|
||||
153 (defn interesting-topic?
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
153 (defn interesting-object?
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
154 [gossip topic]
|
||||
154 [gossip object]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
155 ;; TODO: Not yet (really) implemented
|
||||
|
|
@ -475,272 +475,302 @@
|
|||
<span class="blank" title="0 out of 0 forms covered">
|
||||
157
|
||||
</span><br/>
|
||||
<span class="partial" title="1 out of 2 forms covered">
|
||||
158 (defn interesting-topic?
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
159 [gossip topic]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
160 ;; TODO: Not yet (really) implemented
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
161 true)
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
162
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
158 (defn interesting-item?
|
||||
163 (defn interesting-item?
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
159 "True if anything about this news `item` is interesting to this `gossip`."
|
||||
164 "True if anything about this news `item` is interesting to this `gossip`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
160 [gossip item]
|
||||
165 [gossip item]
|
||||
</span><br/>
|
||||
<span class="partial" title="13 out of 17 forms covered">
|
||||
161 (or
|
||||
166 (or
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
162 (interesting-character? gossip (:actor item))
|
||||
167 (interesting-character? gossip (:actor item))
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
163 (interesting-character? gossip (:other item))
|
||||
168 (interesting-character? gossip (:other item))
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
164 (interesting-location? gossip (:location item))
|
||||
169 (interesting-location? gossip (:location item))
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
165 (interesting-object? gossip (:object item))
|
||||
170 (interesting-object? gossip (:object item))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
166 (interesting-topic? gossip (:verb item))))
|
||||
171 (interesting-topic? gossip (:verb item))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
167
|
||||
172
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
168 (defn infer
|
||||
173 (defn infer
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
169 "Infer a new knowledge item from this `item`, following this `rule`"
|
||||
174 "Infer a new knowledge item from this `item`, following this `rule`"
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
170 [item rule]
|
||||
175 [item rule]
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
171 (reduce merge
|
||||
176 (reduce merge
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
172 item
|
||||
177 item
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
173 (cons
|
||||
178 (cons
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
174 {:verb (:verb rule)}
|
||||
179 {:verb (:verb rule)}
|
||||
</span><br/>
|
||||
<span class="covered" title="13 out of 13 forms covered">
|
||||
175 (map (fn [k] {k (apply (k rule) (list item))})
|
||||
180 (map (fn [k] {k (apply (k rule) (list item))})
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
176 (remove
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
177 #(= % :verb)
|
||||
181 (remove
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
178 (keys rule))))))
|
||||
182 #(= % :verb)
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
183 (keys rule))))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
179
|
||||
184
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
180 (declare learn-news-item)
|
||||
185 (declare learn-news-item)
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
181
|
||||
186
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
182 (defn make-all-inferences
|
||||
187 (defn make-all-inferences
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
183 "Return a list of knowledge entries inferred from this news `item` by this
|
||||
188 "Return a list of knowledge entries that can be inferred from this news
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
184 `gossip`."
|
||||
189 `item`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
185 [item]
|
||||
190 [item]
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
186 (set
|
||||
191 (set
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
187 (reduce
|
||||
192 (reduce
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
188 concat
|
||||
193 concat
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
189 (map
|
||||
194 (map
|
||||
</span><br/>
|
||||
<span class="covered" title="10 out of 10 forms covered">
|
||||
190 #(:knowledge (learn-news-item {} (infer item %) false))
|
||||
195 #(:knowledge (learn-news-item {} (infer item %) false))
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
191 (:inferences (news-topics (:verb item)))))))
|
||||
196 (:inferences (news-topics (:verb item)))))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
192
|
||||
197
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
193 (defn degrade-character
|
||||
198 (defn degrade-character
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
194 "Return a character specification like this `character`, but comprising
|
||||
199 "Return a character specification like this `character`, but comprising
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
195 only those properties this `gossip` is interested in."
|
||||
200 only those properties this `gossip` is interested in."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
196 [gossip character]
|
||||
201 [gossip character]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
197 ;; TODO: Not yet (really) implemented
|
||||
202 ;; TODO: Not yet (really) implemented
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
198 character)
|
||||
203 character)
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
199
|
||||
204
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
200 (defn degrade-location
|
||||
205 (defn degrade-location
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
201 "Return a location specification like this `location`, but comprising
|
||||
206 "Return a location specification like this `location`, but comprising
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
202 only those elements this `gossip` is interested in. If none, return
|
||||
207 only those elements this `gossip` is interested in. If none, return
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
203 `nil`."
|
||||
208 `nil`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
204 [gossip location]
|
||||
209 [gossip location]
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
205 (let [l (if
|
||||
210 (let [l (if
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
206 (coll? location)
|
||||
211 (coll? location)
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
207 (filter
|
||||
212 (filter
|
||||
</span><br/>
|
||||
<span class="partial" title="5 out of 7 forms covered">
|
||||
208 #(when (interesting-location? gossip %) %)
|
||||
213 #(when (interesting-location? gossip %) %)
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
209 location))]
|
||||
214 location))]
|
||||
</span><br/>
|
||||
<span class="partial" title="5 out of 7 forms covered">
|
||||
210 (when-not (empty? l) l)))
|
||||
215 (when-not (empty? l) l)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
211
|
||||
216
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
212 (defn learn-news-item
|
||||
217 (defn learn-news-item
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
213 "Return a gossip like this `gossip`, which has learned this news `item` if
|
||||
218 "Return a gossip like this `gossip`, which has learned this news `item` if
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
214 it is of interest to them."
|
||||
219 it is of interest to them."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
215 ;; TODO: Not yet implemented
|
||||
220 ;; TODO: Not yet implemented
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
216 ([gossip item]
|
||||
221 ([gossip item]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
217 (learn-news-item gossip item true))
|
||||
222 (learn-news-item gossip item true))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
218 ([gossip item follow-inferences?]
|
||||
223 ([gossip item follow-inferences?]
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
219 (if
|
||||
224 (if
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
220 (interesting-item? gossip item)
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
221 (let [g (assoc gossip :knowledge
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
222 (cons
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
223 (assoc
|
||||
225 (interesting-item? gossip item)
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
224 item
|
||||
226 (let
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
225 :nth-hand (if
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
227 [g (assoc
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
226 (number? (:nth-hand item))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
227 (inc (:nth-hand item))
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
228 gossip
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
228 1)
|
||||
229 :knowledge
|
||||
</span><br/>
|
||||
<span class="partial" title="8 out of 11 forms covered">
|
||||
229 :date (if (number? (:date item)) (:date item) (game-time))
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
230 (cons
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
231 (assoc
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
232 item
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
233 :nth-hand (if
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
234 (number? (:nth-hand item))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
235 (inc (:nth-hand item))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
236 1)
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
237 :time-stamp (if
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
238 (number? (:time-stamp item))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
239 (:time-stamp item)
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
240 (game-time))
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
230 :location (degrade-location gossip (:location item))
|
||||
241 :location (degrade-location gossip (:location item))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
231 ;; ought to degratde the location
|
||||
242 ;; TODO: ought to maybe-degrade characters we're not yet interested in
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
232 ;; ought to maybe-degrade characters we're not yet interested in
|
||||
243 )
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
233 )
|
||||
244 ;; TODO: ought not to add knowledge items we already have, except
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
234 ;; ought not to add knowledge items we already have, except
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
235 ;; to replace if new item is of increased specificity
|
||||
245 ;; to replace if new item is of increased specificity
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
236 (:knowledge gossip)))]
|
||||
246 (:knowledge gossip)))]
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
237 (if follow-inferences?
|
||||
247 (if follow-inferences?
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
238 (assoc
|
||||
248 (assoc
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
239 g
|
||||
249 g
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
240 :knowledge
|
||||
250 :knowledge
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
241 (concat (:knowledge g) (make-all-inferences item)))
|
||||
251 (concat (:knowledge g) (make-all-inferences item)))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
242 g))
|
||||
252 g))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
243 gossip)))
|
||||
253 gossip)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
244
|
||||
254
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
245
|
||||
255
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
246
|
||||
256
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue