The thing with the afflictionsets is that you are guaranteed to have one affliction from each subset.
In the case of the broken limbs:
(<ll rl la ra>, <ll rl la ra>, <ll rl la ra>,)
We're saying that we currently have three skills affecting us, each of which could be afflicting any limb, so the possible actual afflictions (which we won't know until we diagnose) are:
1. (ll, rl, la) # no duplicates
2. (ll, rl, ra)
3. (ll, la, rl) # except these are sets, so this is identical to 1
4. (ll, la, ra)
5. (ll, ra, rl) # identical to 2
6. (ll, ra, la) # identical to 4
7. (rl, ll, la) # identical to 1
8. (rl, ll, ra) # identical to 2
9. (rl, la, ll) # identical to 1
10. (rl, la, ra)
11. (rl, ra, ll) # identical to 2
12. (rl, ra, la) # identical to 10
Now, we just spun out 12 possible choices from the original afflictionset and 8 of them were meaningless (and hence unnecessary work).
So the idea is to simplify the original afflictionset, preserving the 4 unique cases and reducing the number of duplicate possibilities.
If we look at: (<ll rl>, <la ra>, <ll, ra>) you'll notice the possibilities are:
1. (ll, la, ra)
2. (ll, ra ... can't choose from the last subset
3. (rl, la, ll)
4. (rl, la, ra)
5. (rl, ra, ll)
6. (rl, ra, ... can't choose again
We get the same 4 unique cases and do a bit less than half the work.
Now, knowing these are limbs and that three of four of them are broken we can enumerate the four unique cases by knowing that 4C3 is 4 and produce them by subtracting a limb from the set of four (that is the four unique cases are given by taking the set of four limbs and subtracting one limb in each) BUT Worstje is trying to make this as general as possible, so it doesn't know you have four limbs.
The problem is that expanding all possible choices is an O(NP) operation (factorial in fact, so worse than exponential order :( ). On the other hand, you have something like three billion cycles to play with.
Most skills apparently only give you a few possible afflictions, so you may need 20+ of them before the algorithm soaks up all of those cycles and is no longer useful. On the other hand there are some skills that can give you up to twenty possible afflictions and four skills like that make the algorithm useless (because it takes >10 seconds to come back with an answer, by which time the fight is nearly over).
... or at least that's the way I understand it.
Because this is trying to be an inference engine that can determine what afflictions you are certain to have from what afflictions you might have, and I think you need to specify which limb you are going to fix when curing, counting potentially broken limbs won't work :(
Though, having said that, I think being afflicted with (<ll, rl>, <ll, blind>, blind) might be a problem since (due to the arrival order) the possibilities are (rl, ll, blind) and (ll, blind). (I suppose a simpler example would be (<ra la>, ra) since you can't have your right arm doubly broken a second ra is a noop so your la isn't necessarily broken.) |