Fernando Madruga
Starting to like KiXtart
Registered: 2002-08-21
Posts: 149
Loc: Coimbra.Portugal.Europe.Earth....
|
Updated test.kix for Game24.
Too many changes to list, but I think this one has a clear output, and it's a lot easier to add new test conditions...
Please *DO* test it and post any required fixes: haven't tested it enough...
code:
BREAK ON
Global $Target
$Target = 24
$rc=SETOPTION('Explicit','ON') $rc=SETOPTION('NoVarsInString','ON') $rc=SRND(@MSECS)
? 'Game24 KiXtart Golf running under KiXtart v'@KIX ? ''
test24(1,2,3,4,1) test24(2,2,6,8,1) test24(4,4,6,6,2) test24(3,3,8,8,2) test24(RND(9),RND(9),RND(9),RND(9),3) test24(3,4,7,7,1) test24(1,2,8,9,1) ? ""
; Inputs: $i1..$i4 => 4 numbers to pass to game24 ; $behaviour = 1 -> Expected result ; $behaviour = 2 -> Expected to fail ; $behaviour = 3 -> Don't know (random) function test24($i1,$i2,$i3,$i4,$behaviour) DIM $rc, $out, $result, $error, $str $str = 'In => '+$i1+', '+$i2+', '+$i3+', '+$i4+'; Out => ' $out=Game24($i1,$i2,$i3,$i4) $error=trim(Execute("$$result=("+$out+")")) if $result = $Target $str = $str + $out + " = " + $result else $str = $str + $out + " = " + $result endif if ( ($behaviour=1) and ($result=$Target) ) or ( ($behaviour=2) and ($result='') ) $str = $str + " => Correct!!" else if ( $behaviour = 3 ) $str = $str + " => Not sure..." else $str = $str + " => WRONG!!" endif endif ? $str endfunction
Dim $shellcommand $shellcommand='kix32 Kixgolf3.kix $f='+@scriptname ? $shellcommand Shell $shellcommand
;! function game24($a,$b,$c,$d) $game24="9*3-2-1";$a+$b+$c+$d endfunction ;! ;!
P.S. As sugested, I'll post the updated KixGolf script in the proper place. [ 16. September 2002, 17:51: Message edited by: Fernando Madruga ]
_________________________
Later,
[b]Mad[/b]ruga
|