~chiefnoah/spellbook

fd9dac826799ab0eb3b296cbc9e4003de42aa020 — Noah Pederson 1 year, 3 months ago ea83b30
Adds tests, fixes free-reaches
2 files changed, 9 insertions(+), 4 deletions(-)

M magic.fs
A test-magic.fs
M magic.fs => magic.fs +4 -4
@@ 78,7 78,7 @@ end-struct mage-struct
    
;

: calculate-free-reach ( mage 
: calculate-free-reach ( mage ) ;

\ spell-difficulty is the difference of <mage dots in arcanum> and <spell arcanum dots>
: calculate-paradox ( reaches free-reach mage-gnosis -- w )


@@ 105,9 105,9 @@ end-struct mage-struct
    begin
        roll-dice ( #dice successes roll ) ." roll: " dup . cr
        \ reuse 8-again to check for successes, as it's the same check
        dup 8-again ( #dice successes roll success? )
        rot + swap ( #dice successes roll )
        10-again rot + ( successes #dice )
        dup 8-again
        rot + swap
        10-again rot +
        1- dup -rot 0=
    until swap drop ;


A test-magic.fs => test-magic.fs +5 -0
@@ 0,0 1,5 @@
require magic.fs

: test-roll-10again 10 roll-10again ;
test-roll-10again ." Successes: " .
bye