├── resources └── README.md ├── .gitignore ├── .mailmap ├── boot.properties ├── CHANGELOG ├── jitpack.yml ├── LICENSE ├── test └── irresponsible │ └── anarchy_test.cljc ├── .travis.yml ├── src └── irresponsible │ └── anarchy.cljc ├── gilded_rose.clj └── README.md /resources/README.md: -------------------------------------------------------------------------------- 1 | ../README.md -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | .nrepl-* 3 | *~ 4 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | # git help shortlog 2 | 3 | -------------------------------------------------------------------------------- /boot.properties: -------------------------------------------------------------------------------- 1 | BOOT_CLOJURE_VERSION=1.9.0-alpha16 2 | BOOT_VERSION=2.7.1 3 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | v0.2.0 - 11 May 2017 2 | - Documentation significantly improved 3 | - Now guards against predicates that return nil on failure 4 | 5 | v0.1.0 - 6 Apr 2017 6 | - First release 7 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - curl -fsSLo init.sh http://irresponsible.github.io/tools.travis.jdk-installer/init.sh 3 | - source init.sh 4 | - jdk-installer install "zulu8" 5 | - boot-driver install-boot 6 | - boot-driver setup-env 7 | - java -version 8 | - boot-driver install-deps 9 | install: 10 | - boot-driver jitpack-deploy 11 | 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT LICENSE 2 | 3 | Copyright (c) 2017 James Laver 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /test/irresponsible/anarchy_test.cljc: -------------------------------------------------------------------------------- 1 | (ns irresponsible.anarchy-test 2 | (:require [#?(:clj clojure.test :cljs cljs.test) :as t] 3 | [irresponsible.anarchy :as a])) 4 | 5 | (def conds [#(= (:a %) 0) 6 | #(> (:b %) 5) 7 | #(= (:a %) (:c %))]) 8 | (def c1 9 | [[:a true nil true] 10 | [:b true nil false] 11 | [:c nil true true] 12 | [:d nil true false] 13 | [:e nil nil true] 14 | [:f nil nil false]]) 15 | 16 | (def c2 17 | [[:a true nil nil] 18 | [:b false true nil] 19 | [:c nil nil true]]) 20 | 21 | (def a1 22 | [[0 #{:a :b}] 23 | [1 #{:c :d}] 24 | [2 #{:a :c :e}]]) 25 | 26 | (def a2 27 | [[0 #{:a}] 28 | [1 #{:b}] 29 | [2 #{:c}]]) 30 | 31 | (t/deftest anarchy-test 32 | (t/testing :first-table 33 | (t/testing :match-conds-test 34 | (t/is (= [:a :c :e] (a/match-conds c1 conds {:a 0 :b 6 :c 0})))) 35 | (t/testing :match-actions-test 36 | (t/is (= [0 2] (a/match-actions a1 [:a]))))) 37 | (t/testing :all-table 38 | (t/testing :match-conds-test) 39 | (t/is (= [:a :c] (a/match-conds c2 conds {:a 0 :b 6 :c 0})))) 40 | (t/testing :match-actions-test) 41 | (t/is (= [0 2] (a/match-actions a2 [:a :c])))) 42 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: generic 2 | sudo: false 3 | script: boot-driver test 4 | branches: 5 | only: 6 | - master 7 | - releng 8 | before_cache: 9 | - rm -rf $HOME/.boot/cache/tmp/ 10 | cache: 11 | directories: 12 | - $HOME/.m2 13 | - $HOME/.boot 14 | matrix: 15 | include: 16 | - env: JDK=zulu7 17 | - env: JDK=zulu8 18 | - env: JDK=zulu8 CLOJURE=1.8 19 | - env: JDK=zulu9 20 | allow_failures: 21 | - env: JDK=zulu7 22 | - env: JDK=zulu9 23 | 24 | before_install: 25 | - curl -fsSLo init.sh http://irresponsible.github.io/tools.travis.jdk-installer/init.sh 26 | - source init.sh 27 | - jdk-installer install "${JDK}" 28 | - boot-driver install-boot 29 | - boot-driver setup-env 30 | - java -version 31 | install: 32 | - boot-driver install-deps 33 | 34 | notifications: 35 | irc: 36 | channels: 37 | - "irc://chat.freenode.net:6665/#irresponsible-ci" 38 | skip_join: true 39 | template: 40 | - "build %{build_number} \x037%{result}\x03: %{repository_slug}/%{branch} @ \x037%{commit}\x03 - \x037%{commit_subject}\x03 by \x033%{author}\x03" 41 | - " - elapsed: %{elapsed_time}, duration: %{duration}" 42 | - " - changed: %{compare_url}" 43 | - " - build : %{build_url}" 44 | -------------------------------------------------------------------------------- /src/irresponsible/anarchy.cljc: -------------------------------------------------------------------------------- 1 | (ns irresponsible.anarchy) 2 | 3 | (defn match-conds 4 | "Matches condition predicates against a matrix of answers for the given data 5 | args: [conditions matrix data] 6 | conditions: seq of predicates that receive data as an argument 7 | matrix: seq/vector of cols 8 | col: seq/vector of [identifier & answers] 9 | identifier: some sort of tag (e.g. a group name) 10 | answer: true, false or nil (don't care) 11 | data: whatever data to pass to the conditions 12 | returns: lazy seq of matching identifiers" 13 | [matrix conditions data] 14 | (let [test (fn [[exp got]] (or (nil? exp) (= exp got))) 15 | results (map #(or (% data) false) conditions)] 16 | (for [[id & col] matrix :when (every? test (map vector col results))] 17 | id))) 18 | 19 | (defn match-actions 20 | "Returns matching actions from an actions matrix. Each row in the matrix has an action 21 | and a collection of the identifiers for which it is valid (preferably a set but we are lenient) 22 | Actions may be any sort of data you wish to be returned, like a keyword or a function. 23 | args: [actions matches] 24 | actions: a seq/vector of rows 25 | row: vector of [action ok] 26 | action: the data (a fn? some identifier?) that will be returned if ok contains one of matches 27 | ok: a collection of acceptable identifiers, preferably a set 28 | matches: a collection of acceptable identifiers (e.g. from match-conds) 29 | returns: a lazy seq of matching actions" 30 | [actions matches] 31 | (for [[a ok] actions :when (some #(contains? ok %) matches)] 32 | a)) 33 | -------------------------------------------------------------------------------- /gilded_rose.clj: -------------------------------------------------------------------------------- 1 | (ns gilded-rose.core 2 | (:require [irresponsible.anarchy :as a])) 3 | 4 | ;; predicates for special properties 5 | (def legendary? (comp :legendary :special)) 6 | (def matures? (comp :matures :special)) 7 | (def exciting? (comp :exciting :special)) 8 | ;; predicates for time remaining to sell something 9 | ;; these are run before we have decremented anything, so they're 1 off what you'd expect 10 | (def expired? (comp (partial >= 0) :sell-in)) 11 | (def last-day? (comp (partial = 1) :sell-in)) 12 | (def last-five? (comp (partial >= 6) :sell-in)) 13 | (def last-ten? (comp (partial >= 11) :sell-in)) 14 | 15 | ;; math utilities for ranged arithmetic 16 | (defn -- 17 | "- , but locked to arity 2 and never goes below zero" 18 | [a b] 19 | (int (max (- a b) 0))) 20 | 21 | (defn ++ 22 | "+, but locked to arity 2 and never goes above 50" 23 | [a b] 24 | (int (min (+ a b) 50))) 25 | 26 | (defn perish 27 | "Updates a perishable item's quality by applying its age rate and the given factor 28 | args: [item] 29 | returns: item" 30 | [{:keys [age-rate] :as item} factor] 31 | (update item :quality -- (* factor age-rate))) 32 | 33 | (defn mature 34 | "Increases an item's quality by applying its age rate and the given factor 35 | args: [item] 36 | returns: item" 37 | [{:keys [age-rate] :as item} factor] 38 | (update item :quality ++ (* factor age-rate))) 39 | 40 | ;; define our conditions and conditions matrix 41 | (def conds #_name [legendary? matures? exciting? expired? last-day? last-five? last-ten?]) 42 | (def cond-matrix [[:non-legendary false nil nil nil nil nil nil] 43 | [:perishable false false false false nil nil nil] 44 | [:expired-perishable false false false true nil nil nil] 45 | [:mature false true false false nil nil nil] 46 | [:expired-mature false true false true nil nil nil] 47 | [:exciting false false true false false false false] 48 | [:exciting-10 false false true false false false true] 49 | [:exciting-5 false false true false false true false] 50 | [:exciting-done false false true false true false false]]) 51 | 52 | ;; map actions to our conditions 53 | (def action-matrix 54 | [[:deduct-day #{:non-legendary}] 55 | [:perish #{:perishable}] 56 | [:double-perish #{:expired-perishable}] 57 | [:mature #{:mature :exciting}] 58 | [:double-mature #{:expired-mature}] 59 | [:exciting-10 #{:exciting-10}] 60 | [:exciting-5 #{:exciting-5}] 61 | [:worthless #{:exciting-done}]]) 62 | 63 | ;; define the actions 64 | (def actions 65 | {:deduct-day #(update % :sell-in dec) 66 | :perish #(perish % 1) 67 | :double-perish #(perish % 2) 68 | :mature #(mature % 1) 69 | :double-mature #(mature % 2) 70 | :exciting-10 #(update % :quality ++ 2) 71 | :exciting-5 #(update % :quality ++ 3) 72 | :worthless #(assoc % :quality 0)}) 73 | 74 | (defn item-updates 75 | "Gets the updates to be applied by the logic ruleset for one item 76 | args: [item] 77 | returns: item" 78 | [item] 79 | (->> (a/match-conds cond-matrix conds item) 80 | (a/match-actions action-matrix))) 81 | 82 | (defn update-item 83 | "Updates an item after a day's trade. Specifically days-in and quality 84 | Applies custom rules 85 | args: [item] 86 | returns: item" 87 | [item] 88 | (->> item item-updates 89 | (reduce #((actions %2) %1) item))) 90 | 91 | ;; WARNING: `item` is LEGACY CODE. we have been arbitrarily forbidden from modifying this function, 92 | ;; thus eliminating the neatest solution i won't even give it a docstring and i'll leave a 93 | ;; respectful blank line after this comment 94 | 95 | (defn item [item-name, sell-in, quality] 96 | {:name item-name, :sell-in sell-in, :quality quality}) 97 | 98 | ;; the easiest way around the anti-teamwork goblin is a simple wrapper function 99 | (defn item++ 100 | "Creates an item map with more information than the arbitrarily off-limits `item` function 101 | args: [item-name sell-in quality age-rate & special] 102 | item-name: string naming the item 103 | sell-in: integer, days left to sell the item 104 | quality: integer 105 | age-rate: integer, the amount that quality diminishes per day 106 | special: keywords naming special calculation properties: 107 | :legendary - for sulfuras, quality never changes, days to sell never changes 108 | :matures - for brie, whose quality increases over time 109 | :exciting - for backstage passes, increases value as event nears, zeroes after 110 | returns: map with keys: 111 | :item-name string 112 | :sell-in integer 113 | :quality integer 114 | :age-rate integer 115 | :special set of keyword" 116 | [item-name sell-in quality age-rate & special] 117 | (-> (item item-name sell-in quality) 118 | (merge {:special (set special) :age-rate age-rate}))) 119 | 120 | ;; separate this out for hygiene 121 | (def inventory 122 | [(item++ "+5 Dexterity Vest" 10 20 2) 123 | (item++ "Aged Brie" 2 0 1 :matures) 124 | (item++ "Elixir of the Mongoose" 5 7 2) 125 | (item++ "Sulfuras, Hand Of Ragnaros" 0 80 0 :legendary) 126 | (item++ "Backstage passes to a TAFKAL80ETC concert" 15 20 1 :exciting) 127 | (item++ "Conjured Elixir of the Mongoose" 5 0 4)]) 128 | 129 | (defn update-current-inventory 130 | "Updates the inventory after a day's trading 131 | args: [] 132 | returns: new inventory" 133 | [] 134 | (into [] (map update-item) inventory)) 135 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Clojars Project](https://img.shields.io/clojars/v/irresponsible/anarchy.svg)](https://clojars.org/irresponsible/anarchy) 2 | [![cljdoc badge](https://cljdoc.org/badge/irresponsible/anarchy)](https://cljdoc.org/d/irresponsible/anarchy) 3 | [![CircleCI](https://circleci.com/gh/clj-commons/anarchy.svg?style=svg)](https://circleci.com/gh/clj-commons/anarchy) 4 | 5 | The irresponsible clojure guild presents... 6 | 7 | # Anarchy - logic without rules. 8 | 9 | A "logic engine" for end-users that encodes logic into decision 10 | tables. Anarchy gives you a model you can build a UI around that 11 | programmers and non-programmers alike can grok. I wrote it to support 12 | user-editable pricing rules for a site where the users are not very 13 | technical. 14 | 15 | ## Introduction 16 | 17 | Let's encode some pricing rules for an imaginary hotel: 18 | 19 | Conditions | 1 | 2 | 3 20 | ------------------------------|---|---|--- 21 | Season is peak | Y | | N 22 | Booking starts on a monday | | Y | 23 | Booking is for 7 days or more | | Y | N 24 | **Actions** | **1** | **2** | **3** 25 | Price * 1.5 | X | | 26 | Price * 0.9 | | X | 27 | Price * 0.8 | | | X 28 | 29 | For space reasons, we've just given numeric names to the matrix 30 | columns. Here are better names: 31 | 32 | 1. Peak season premium 33 | 2. Monday-aligned bookings discount 34 | 3. Off-peak short-stay incentive 35 | 36 | The table is logically split into four quarters: 37 | 38 | ``` 39 | | Conditions | Conditions Matrix | 40 | +------------+-------------------+ 41 | | Actions | Actions Matrix | 42 | ``` 43 | 44 | The matrix columns are what associates the conditions and actions 45 | together, in a two stage process: 46 | 47 | 1. Condition matching 48 | 2. Action matching 49 | 50 | ## Condition matching 51 | 52 | Here is the conditions part of our table: 53 | 54 | Conditions | 1 | 2 | 3 55 | ------------------------------|---|---|--- 56 | Season is peak | Y | | N 57 | Booking starts on a monday | | Y | 58 | Booking is for 7 days or more | | Y | N 59 | 60 | Here again are our matrix column names: 61 | 62 | 1. Peak season premium 63 | 2. Monday-aligned bookings discount 64 | 3. Off-peak short-stay incentive 65 | 66 | Matrix columns are considered from left to right, one at a time. 67 | 68 | For our column 1 (peak season premium), we have indicated that it 69 | should match when the season is peak. The blanks against the other 70 | conditions mean that we do not care whether they are true or false 71 | 72 | For our column 2 (monday-aligned bookings discount), we have indicated 73 | that should match when both the booking is for 7 days or more and 74 | starts on a monday. This is irrespective of whether the season is peak. 75 | 76 | For our column 3 (off-peak short stay discount), we indicate that it 77 | matches only when the season is *not* peak and the booking is *not* 78 | for 7 days or more. 79 | 80 | Let us work through a couple example booking to see how this works: 81 | 82 | * A 7-day peak season booking starting on a monday: 83 | * Matches column 1 (season is peak) 84 | * Matches column 2 (booking starts on a monday, is for 7 days) 85 | * Does not match column 3 (season is peak, booking is for 7 days) 86 | * Result: Columns 1 and 2 match 87 | * A 2-day off-peak booking starting on a monday: 88 | * Does not match column 1 (season is off-peak) 89 | * Does not match column 2 (booking is only two days) 90 | * Matches column 3 (season is off-peak, booking is two days) 91 | * Result: Column 3 matches 92 | 93 | ## Action matching 94 | 95 | Once we have our matched columns, we can define actions to perform. 96 | 97 | Here is the actions part of the table from earlier: 98 | 99 | Actions | 1 | 2 | 3 100 | ------------|---|---|--- 101 | Price * 1.5 | X | | 102 | Price * 0.9 | | X | 103 | Price * 0.8 | | | X 104 | 105 | Here again are our matrix column names: 106 | 107 | 1. Peak season premium 108 | 2. Monday-aligned bookings discount 109 | 3. Off-peak short-stay incentive 110 | 111 | * The peak season premium adds 50% 112 | * The monday-aligned bookings discount discounts 10% 113 | * The off-peak short-stay incentive discounts 20% 114 | 115 | In contrast to earlier where we picked Y(es), N(o) and neutral, this 116 | time it is just yes or no, which we symbolise with Xs. The process is 117 | thus a simplification of the condition matching. 118 | 119 | ## Code 120 | 121 | *Without* anarchy: 122 | 123 | ```clojure 124 | (defn price-rules [{:keys [season start-day length price] :as booking}] 125 | (cond-> booking 126 | (= :peak season) (update :price * 1.5) 127 | (and 128 | (= :monday start) 129 | (>= length 7)) (update :price * 0.9) 130 | (and 131 | (not= :peak season) 132 | (< length 7)) (update :price * 0.8))) 133 | ``` 134 | 135 | With anarchy (and a lot of comments!): 136 | 137 | ```clojure 138 | (ns my.ns 139 | (:require [irresponsible.anarchy :refer [match-conds match-actions]])) 140 | 141 | ;; Here is a sample piece of booking data. It needn't be a map 142 | (def data {:season :peak :price 500 :start :monday :length 7}) 143 | ;; Now we define our conditions 144 | (def conds [#(= :peak (:season %)) 145 | #(= :monday (:start %)) 146 | #(>= (:length %) 7)]) 147 | ;; For our condition matrix, each column is represented by a vector. 148 | ;; To each column, we prepend an identifier. Here we use a keyword, but 149 | ;; you may use any data you like, so long as it may be put in a clojure set. 150 | (def cond-matrix 151 | [[:a true nil nil] 152 | [:b nil true true] 153 | [:c false nil false]]) 154 | ;; Our actions matrix consists of 2-vectors. The first is the value 155 | ;; that will be returned on successful match (we are just using 156 | ;; functions). The second is a set of column names for which it will match. 157 | (def action-matrix 158 | [[#(update % :price * 1.5) #{:a}] 159 | [#(update % :price * 0.9) #{:b}] 160 | [#(update % :price * 0.8) #{:c}]]) 161 | 162 | (->> (a/match-conds cond-matrix conds data) ;; match conditions 163 | (a/match-actions action-matrix) ;; match actions 164 | (reduce #(%2 %1) data)) ;; apply actions 165 | ``` 166 | 167 | Now that the actual matching logic is all data, hopefully you can see 168 | how it might be generated from a web interface or similar. 169 | 170 | ## First-match-wins logic 171 | 172 | Up until now, we have been using an 'all matches' logic. It is also 173 | sometimes useful to implement a 'first match wins' logic. Here is a 174 | translation of the above table to the first-match-wins logic: 175 | 176 | Conditions | 1 | 2 | 3 | 4 177 | ------------------------------|---|---|---|--- 178 | Season is peak | Y | N | N | Y 179 | Booking starts on a monday | Y | Y | | 180 | Booking is for 7 days or more | Y | Y | N | 181 | **Actions** | **1** | **2** | **3** | **4** 182 | Price * 1.5 | X | | | X 183 | Price * 0.9 | X | X | | 184 | Price * 0.8 | | | X | 185 | 186 | This is equivalent to the previous table, but uses the first-match 187 | wins logic. Here are some names for our matrix columns: 188 | 189 | 1. Peak long booking starting monday 190 | 2. Off-peak long booking starting monday 191 | 3. Off-peak short-booking 192 | 4. Peak booking (generic) 193 | 194 | Some worked examples: 195 | 196 | * A 7-day peak season booking starting on a monday: 197 | * Matches column 1 (season is peak) 198 | * Result: Column 1 matches 199 | * A 2-day off-peak booking starting on a monday: 200 | * Does not match column 1 (season is off-peak, booking is two days) 201 | * Does not match column 2 (booking is only two days) 202 | * Matches column 3 (season is off-peak, booking is two days) 203 | * Result: Column 3 matches 204 | 205 | You'll notice that for first-match wins tables, we are more specific 206 | in the leftmost columns of the condition and less specific in the 207 | rightmost columns. This is the simplest way to encode the logic. 208 | 209 | We consider that for this particular problem, all-matches logic 210 | encodes the problem more simply, but this is not always the case. If 211 | you can find an example that works more clearly in first-match-wins 212 | logic, we'd love to feature it on this README. 213 | 214 | And a code example: 215 | 216 | ```clojure 217 | (ns my.ns 218 | (:require [irresponsible.anarchy :refer [match-conds match-actions]])) 219 | 220 | ;; data and conds are identical to above 221 | (def data {:season :peak :price 500 :start :monday :length 7}) 222 | (def conds [#(= :peak (:season %)) 223 | #(= :monday (:start %)) 224 | #(>= (:length %) 7)]) 225 | 226 | ;; cond-matrix and action-matrix differ 227 | (def cond-matrix 228 | [[:a true true false] 229 | [:b false true false] 230 | [:c false false true] 231 | [:d true false false]]) 232 | (def action-matrix 233 | [[#(update % :price * 1.5) #{:a :d}] 234 | [#(update % :price * 0.9) #{:a :b}] 235 | [#(update % :price * 0.8) #{:c}]]) 236 | 237 | (->> (a/match-conds cond-matrix conds data) ;; match conditions 238 | (take 1) ;; first match wins 239 | (a/match-actions action-matrix) ;; match actions 240 | (reduce #(%2 %) data)) ;; apply actions 241 | ``` 242 | 243 | There is also the 'gilded rose kata' technical example available in `gilded-rose.clj`, 244 | which I submitted as a technical test to a clojure-using company who turned out to suck. 245 | 246 | ## Suggestions 247 | 248 | * Use identifiers for actions and maintain a map of ident -> function 249 | * Use with fairly small rulesets for good performance 250 | 251 | ## Acknowledgements 252 | 253 | This library is a minimalist port of [DTRules](http://www.dtrules.com/). 254 | Hats off to the DTRules team for their work and research. 255 | 256 | ## Copyright and License 257 | 258 | MIT LICENSE 259 | 260 | Copyright (c) 2017 James Laver 261 | 262 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 263 | 264 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 265 | 266 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 267 | 268 | --------------------------------------------------------------------------------