Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

chaoticset (2105)

  (email not shown publicly)
AOL IM: chaoticset23 (Add Buddy, Send Message)
Yahoo! ID: illuminatus_foil (Add User, Send Message)

JAPH. (That's right -- I'm not Really Inexperienced any more.)

I'm not just here, I'm here [], and here [] too, I ramble randomly in my philosophical blog [] and my other blog []. Soon I'll come in a convenient six-pack.

Journal of chaoticset (2105)

Wednesday October 22, 2003
09:34 PM

So Close

[ #15333 ]
I still think I should be working on the CSG that chromatic is trying to do as an example project, so I spent a few hours today writing code to make almost all of the ice-attacking customer tests pass. Almost being the emphasis -- it feels like some sort of logic problem, honestly, because it wants a result in the test that seems impossible.

The (forgive the wrong terminology, but this will be more accessible) computer has 1 hit point. It's going to regenerate 50 this turn. The attack is going to do 10 points of damage.

Somehow, the computer's supposed to come out of that with 49 hit points left.

Now, it sounds sensible -- you can only do as much damage as there were hit points at the start of the attack -- but it seems to directly contradict some other tests. (Which is to say, every time I implement something that would allow this, something else breaks and makes the test fail before it reaches the test I'm trying to pass.) One of the tests wants to limit the amount of damage possible to zero, and in doing so, makes it impossible for the damage-limited-by-hit-points thing to be true because it's asking for 75 points of damage to a 25 hit point target. It should either expect a value of 50 ( the regen value) or else not expect limits on the amount of damage. Assuming that both the damage and the regeneration are essentially "simultaneous", there shouldn't be a limit -- 10 points of damage plus 20 points of regen plus current 5 hit points should equal 15, dammit. Not 20.


I don't know what to do. I don't really know how to do this stuff, I'm just guessing. I'm too tired to ask for help on the wiki coherently. I'm going to bed.

Hell, someone probably already implemented what I did anyway, and it's just waiting to be committed or whatever the term is, I don't know. I didn't claim the story, just wanted to see what tests I could pass.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • One day, a novice approached the master.

    "Master," he said, "there are contradictions in the Tao. To achieve enlightenment, you must clear your mind. To achieve enlightenment, you must be mindful of the Universe."

    "Yes," replied the master. "Off by one error."

    At this, the novice was enlightened.

    Index: t/customertests/AllowPlayersToAttackICE.t
    --- t/customertests/AllowPlayersToAttackICE.t (revision 20)
    +++ t/customertests/AllowPlaye

    • You still look backwards to me.

      You either add regen first and then subtract damage (without going below zero) which gives the 41 result you're testing for; or subtract damage first (without going below zero) and then add regen which gives a result of 50. The second is implied by your problem statement (no more damage can be applied than the hit points at the START of the period). A conceivable third approach would be to apply the damage in the middle of te regen: add half of regen value, subtract damage