#199534 - 2010-08-14 10:31 AM
Re: KixGolf: Luhn's Mod - Public Round
[Re: Lonkero]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
damn, I love bryce's code! awesome!
didn't dare to do too much, just removed the if's. score: 250
Function A($)
dim $i, $x, $b, $l
$l = len($)
redim $b[$l-1]
for $i = 0 to $l-1
$b[$i] = substr($,$i+1,1)
next
for $i = $l-2 to 0 step -2
$x = 2*$b[$i]
$b[$i] = iif($x>9,0+left($x,1) + right($x,1),$x)
next
$i = execute("$X="+join($b,'+'))
$a = ($>3 & $<7 & $l=16-($<4) & $x mod 10=)*left($,1)
_________________________
!download KiXnet
|
Top
|
|
|
|
#199536 - 2010-08-14 10:45 AM
Re: KixGolf: Luhn's Mod - Public Round
[Re: Lonkero]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
another stap and bryce's code. commenting changes. 237
Function A($)
$a = $^0 ;no need for long keywords like len()
dim $i, $x, $b[$a-1] ;$l removed using $a instead
;redim $b[$a-1] ;no need to redim if doing right in the start ;)
for $i = 0 to $a-1
$b[$i] = substr($,$i+1,1)
next
for $i = $a-2 to 0 step -2
$x = 2*$b[$i]
$b[$i] = iif($x>9,0+left($x,1) + right($x,1),$x)
next
$i = execute("$X="+join($b,'+'))
$a = ($>3 & $<7 & $a=16-($<4) & $x mod 10=)*left($,1)
Endfunction
_________________________
!download KiXnet
|
Top
|
|
|
|
#199537 - 2010-08-14 10:57 AM
Re: KixGolf: Luhn's Mod - Public Round
[Re: Lonkero]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
yet another stap at bryce's code. commenting changes. 211
Function A($)
$a = $^0 ;no need for long keywords like len()
dim $i, $x, $b[$a-1] ;$l removed using $a instead
;redim $b[$a-1] ;no need to redim if doing right in the start ;)
for $i = 0 to $a-1
$b[$i] = substr($,$i+1,1)
next
for $i = $a-2 to 0 step -2
$x = 2*$b[$i]
; $b[$i] = iif($x>9,0+left($x,1) + right($x,1),$x) redone without lettercode (right replaced with mod).
;$b[$i] = iif($x>9,0+left($x,1) + $x mod 10,$x) x cannot be more than 18, so removing left(). also removing iif.
$b[$i] = $x-9*($x>9)
next
$i = execute("$X="+join($b,'+'))
$a = ($>3 & $<7 & $a=16-($<4) & $x mod 10=)*left($,1)
Endfunction
_________________________
!download KiXnet
|
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 500 anonymous users online.
|
|
|