Stories
Slash Boxes
Comments
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • by chromatic (983) on 2003.10.23 0:23 (#25082) Homepage Journal

    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/AllowPlayersToAttackICE.t (working copy)
    @@ -69,6 +69,6 @@
    $computer->ice( 1 );
    $deck->power( 10 );
    $result = $deck->attack( $computer );
    -is( $computer->ice(), 49, '... taking into account damage per attack' );
    +is( $computer->ice(), 41, '... taking into account damage per attack' );
    isnt( $computer->data( $result ), 'more secrets',
    '... regenerating before taking damage' );
    • 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