#199564 - 2010-08-14 09:43 PM
Re: KixGolf: Luhn's Mod - Public Round
[Re: Lonkero]
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
yeah... removing the need for array is the next step and then it becomes pretty close already to the other ones. 177.
Function A($)
$a = $^0
dim $i, $x, $b,$s
for $i = -$a to -1
$x = substr($,-$i,1)
$b = $b+'+'+($s*((4<$x)+$x)+$x)
$s=$s^1
next
$i = execute("$X="+$b)
$a = ($>3 & $<7 & $a=16-($<4) & $x mod 10=)*left($,1)
Endfunction
then execution becomes pointless... 151
Function A($)
$a = $^0
dim $i, $x, $b,$s
for $i = -$a to -1
$x = substr($,-$i,1)
$b = $b+$s*((4<$x)+$x)+$x
$s=$s^1
next
$a = ($>3 & $<7 & $a=16-($<4) & $b mod 10=)*left($,1)
Endfunction
_________________________
!download KiXnet
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 710 anonymous users online.
|
|
|