#199431 - 2010-08-08 06:49 PM
Re: KixGolf: Luhn's Mod - Public Round
[Re: DrillSergeant]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4549
Loc: USA
|
@Drill... Pure encryption... I love it It'll take a while for me to figure out that one.
|
Top
|
|
|
|
#199435 - 2010-08-08 07:46 PM
Re: KixGolf: Luhn's Mod - Public Round
[Re: DrillSergeant]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
here is my 185 code:
Function A($)
Dim $y,$x,$v
$x = Left($,1)
For $y = ($^) to 1 step -2
$a = 2 * SubStr($,$y-1,1)
$v = IIf($a > 9,$a / -10 + $a,$a) + $v + SubStr($,$y,1)
$a = IIf(~ $v mod 10 & (($^) = 15 & $x = 3) | (($^) = 16 & $x > 3 & $x < 7),$x,0)
;Next
EndFunction
Edited by Benny69 (2010-08-08 07:56 PM)
|
Top
|
|
|
|
#199437 - 2010-08-08 07:49 PM
Re: KixGolf: Luhn's Mod - Public Round
[Re: Benny69]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
here is Eric's code at 135:
Function A($)
Dim $s,$f
$a = 0
If $ > 3&$ < 7&($^)+($ < 4) = 16
While $
$a = Right($,1)
$s = $s+$f*(-9*(4 < $a)+$a)+$a
$ = Left($,-1)
$f = 1-$f
If $s mod 10 $a = 0
EndFunction
Edited by Benny69 (2010-08-08 07:56 PM)
|
Top
|
|
|
|
#199438 - 2010-08-08 07:57 PM
Re: KixGolf: Luhn's Mod - Public Round
[Re: Benny69]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
here is my other 185 code:
Function A($)
Dim $z,$x,$v
$z = Left($,1)
$v = ($^)
While $
$a = 2 * SubStr($,($^)-1,1)
$x = IIf($a > 9,$a / -10 + $a,$a) + Right($,1) + $x
$ = Left($,-2)
$a = IIf(~ $x mod 10 & ($v = 15 & $z = 3) | ($v = 16 & $z > 3 & $z < 7),$z,0)
; Loop
EndFunction
Edited by Benny69 (2010-08-08 07:57 PM)
|
Top
|
|
|
|
#199440 - 2010-08-08 08:06 PM
Re: KixGolf: Luhn's Mod - Public Round
[Re: Lonkero]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Eric's at 134
Function A($)
Dim $s,$f
$a = 0
If $ > 3&$ < 7&($^)+($<4) = 16
While $
$a = Right($,1)
$s = $s+$f*(-9*(4 < $a)+$a)+$a
$ = Left($,~)
$f = 1-$f
If $s mod 10 $a = 0
EndFunction
Edited by Benny69 (2010-08-08 08:07 PM)
|
Top
|
|
|
|
#199443 - 2010-08-08 10:28 PM
Re: KixGolf: Luhn's Mod - Public Round
[Re: maciep]
|
BradV
Seasoned Scripter
Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
|
OK, I knew I was missing something! I'm embarrased to even post this.
Function A($)
dim $l, $i, $b, $c, $x, $d
$l = Len($)
$d = Left($, 1)
If ($d = 3 and $l = 15) or ($d > 3 and $d < 7 and $l = 16)
$x = 0
For $i = $l - 1 to 0 Step -1
$b = Substr($, $i + 1, 1)
If ($l - $i) mod 2 = 0
$c = 2 * $b
$b = IIF($c > 9, 0 + Left($c, 1) + Right($c, 1), $c)
EndIf
$x = $x + $b
Next
$d = IIF($x mod 10, 0, $d)
Else
$d = 0
EndIf
$A = $d
EndFunction
|
Top
|
|
|
|
#199445 - 2010-08-08 11:08 PM
Re: KixGolf: Luhn's Mod - Public Round
[Re: BradV]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4549
Loc: USA
|
Almost forgot... here is Jochen's 146
function a($)
dim $b, $c, $d
$b = 0^$
while $
$c = (($b-($^) & 1)+1) * right($,1)
$d = $d + $c-9*($c>9)
$a = ($d mod 10 =) * (($b=15&$=3)|$b=16&$>3&$<7) * $
$ = left($,~)
endfunction
|
Top
|
|
|
|
#199446 - 2010-08-09 12:51 AM
Re: KixGolf: Luhn's Mod - Public Round
[Re: Allen]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Brad, Don't feel embarrased, you should feel proud, most can't even put somthing together that works, that is a BIG hurtle. I say well done, now lets see what we can do to shorten that code.
|
Top
|
|
|
|
#199447 - 2010-08-09 01:02 AM
Re: KixGolf: Luhn's Mod - Public Round
[Re: Benny69]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Brad's code at 240:
Function A($)
Dim $l,$i,$b,$c,$x,$d
$l = ($^);Len($)
$d = Left($,1)
;If($d = 3 And $l = 15) Or ( $d > 3 And $d < 7 And $l = 16 )
If($d = 3 & $l = 15) | ( $d > 3 & $d < 7 & $l = 16 ); use Bitwise Operators to do the same tasks as 'And' and 'Or'
$x = 0
For $i = $l-1 to 0 Step-1
$b = SubStr($,$i+1,1)
If($l-$i) mod 2 = 0
$c = 2*$b
;$b = IIf($c > 9,0+Left($c,1)+Right($c,1),$c)
$b = IIf($c > 9,$c / 10 + $c - 10,$c); use a calulator to see that Kix drops the decimal for $c
EndIf
$x = $x + $b
Next
$d = IIf($x mod 10,0,$d)
Else
$d = 0
EndIf
$A = $d
EndFunction
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
2023-09-28 [Arend_]
Wow even the shouts are old ;-)
2023-11-17 [Dr_Rick]
I love Kixforms!
2023-11-21 [Dave_Melczer]
Getting DB errors again opening posts...anyone else?
2023-11-24 [Flavien]
DB errors confirmed. This forum is showing its age... UBB 7.2.2 is from 2007
2023-11-27 [Sealeopard]
And there goes the forum :-(
2023-11-30 [NTDOC]
Yes, so old no good easy update path
2023-12-01 [mole]
Posts back. No DB errors. Thanks!
2023-12-29 [BradV]
Happy new year!
2024-02-09 [RSLHA]
No access possible!
2024-02-09 [RSLHA]
Database Error!
2024-02-18 [Dr_Rick]
What happened to Bruno
2024-03-08 [mole]
Thanks for getting the posts back again.
2024-04-18 [MarineV]
will the db errors get fixed????
2024-04-26 [Tonny]
database error, please!
2024-05-09 [NTDOC]
I'm not seeing any errors
2024-05-31 [chojin]
DB is down again
2024-06-04 [selsner]
Still no access, please help!
2024-06-07 [mole]
Looks like DB is back again. Thanks.
2024-06-17 [It_took_my_meds]
We encountered a problem. The reason reported was Database error only visible to forum administrators Please click back to return to the previous page.
2024-07-04 [Armin73]
There is still a database error 🤷♂️
2024-07-09 [0neZero]
There is still a database error 🤷♂️
2024-07-10 [Allen]
DB working a few times in between the messages above. Working again as of 7/10. Thanks Doc
2024-08-31 [NetGnostic]
Bummer, the Database error is back.
2024-09-04 [NTDOC]
Fourms are back up without error for the moment
2024-10-02 [Arend_]
Wll still have database errors ;-)
2024-10-03 [Allen]
Thanks to Doc... it's back.
2024-12-09 [chojin]
could we move kixtart to a new place in order to keep it living ? maybe create a github page and a subreddit?
2024-12-10 [Allen]
do know about moving it, but I know Doc is aware of the DB issue. Should be back online soon.
2024-12-10 [Allen]
don't know...
|
|
0 registered
and 463 anonymous users online.
|
|
|