Page 3 of 6 <12345>Last »
Topic Options
#199472 - 2010-08-10 06:09 PM Re: KixGolf: Luhn's Mod - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
WTF!!!!
122 out of mine.

 Code:
Function A($)
Dim $t,$x

For $t=0 to 15-($<4)
 $a=Right($,1)
 $x=1 & $t *(($a>4)+$a)+$a+$x
 $a=(2<$a & 7>$ & $x mod 10=)*$a
 $=Left($,~)
EndFunction
_________________________
!

download KiXnet

Top
#199473 - 2010-08-10 06:35 PM Re: KixGolf: Luhn's Mod - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
119 out of drills code!
 Code:
Function A($)
Dim $c, $t

	For $c=0 to 15-($<4)
		$A = 0 + right($, 1)
		$t = 1 & $c * ($A / 5 + $A) + $A + $t
		$ = left($,~)
		If $t mod 10 + $ | 4&$A + 5
			$A = 0
Endfunction
_________________________
!

download KiXnet

Top
#199475 - 2010-08-11 12:05 AM Re: KixGolf: Luhn's Mod - Public Round [Re: Lonkero]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4510
Loc: USA
I just can't wrap my mind around the following line...
Can you put this into words?

If $t mod 10 + $ | 4&$A + 5

"If it fails the Luhn check..."

Top
#199476 - 2010-08-11 12:25 AM Re: KixGolf: Luhn's Mod - Public Round [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
driller explained the 4&$A + 5, $t mod 10 makes sense too, right?
$ is any value left of the original value.
so:
if reminder + anyvalue_left or current_value smaller than 3 or greater than 6

the anyvalue_left reverts back to the for loop.
the loop goes 16 times (or 15, if left(input,1)=3)
if after that, any value is left to be processed => over length of input.

ok, hope that made any sense.
_________________________
!

download KiXnet

Top
#199477 - 2010-08-11 12:27 AM Re: KixGolf: Luhn's Mod - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
oh, and in your words.
if it fails the check + is too long or is not acceptable card

I guess I could have used | instead of +
never even considered though.
_________________________
!

download KiXnet

Top
#199478 - 2010-08-11 12:33 AM Re: KixGolf: Luhn's Mod - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
same tweak is sneaky in my code too, where:
$a=(2<$a & 7>$ ...

if currentvalue is more than 2 and currentval PLUS any reminder values is less than 7...
_________________________
!

download KiXnet

Top
#199479 - 2010-08-11 12:38 AM Re: KixGolf: Luhn's Mod - Public Round [Re: Lonkero]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4510
Loc: USA
Thanks... truly amazing.

My mind just doesn't think that way. Is it any wonder I never really compete with you guys?

Top
#199480 - 2010-08-11 01:36 AM Re: KixGolf: Luhn's Mod - Public Round [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
well, I still don't fully crasp the kixtart binary logic. way too fuzzy.
kudos to drill about that. iirc hobie was one of those binary boys too.

but playing with numbers and making them dance for you... that I would consider my field \:\)
_________________________
!

download KiXnet

Top
#199482 - 2010-08-11 09:46 AM Re: KixGolf: Luhn's Mod - Public Round [Re: Lonkero]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
I think that I've discovered the secret of the way Lonk's brain works:
 Originally Posted By: Jukka "Yucca" Korpela
I will conclude with a proof that Finnish has an infinite number of words. In Finnish, there is a derived word for any numeral, corresponding in meaning the words in the sequence simple, double, triple, etc. You take the numeral, make it one word, and append the word -kertainen possibly after some changes to the stem. Thus from tuhat viisi 1005 we get tuhatviisikertainen. And generally, there is the sequence of numerals yksinkertainen, kaksinkertainen, kolminkertainen and so on literally ad infinitum.


Taken from http://www.cs.tut.fi/~jkorpela/lang/vocab.html

Top
#199483 - 2010-08-11 12:04 PM Re: KixGolf: Luhn's Mod - Public Round [Re: Richard H.]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 683
Loc: Maryland, USA
I can't even understand that! \:\)
Top
#199484 - 2010-08-11 12:59 PM Re: KixGolf: Luhn's Mod - Public Round [Re: Lonkero]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
 Originally Posted By: Lonkero
119 out of drills code!
 Code:
Function A($)
Dim $c, $t

	For $c=0 to 15-($<4)
		$A = 0 + right($, 1)
		$t = 1 & $c * ($A / 5 + $A) + $A + $t
		$ = left($,~)
		If $t mod 10 + $ | 4&$A + 5
			$A = 0
Endfunction


Damn! I don't think I even tried a for-next loop because I didn't believe it would be shorter.

Thanx for proving me wrong, you damn basta! ;-)
_________________________
The Code is out there

Top
#199485 - 2010-08-11 01:14 PM Re: KixGolf: Luhn's Mod - Public Round [Re: DrillSergeant]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
I'm not sure why it works, but... 114!

 Code:
; begin Luhns Mod
;
;!
Function A($)
Dim $c, $t

	For $c=0 to 15-($<4)
		$A = 0 + right($, 1)
		$t = 1 & $c * ($A / 5 + $A) + $A + $t
		$ = left($,~)
		If $t + $ | 4&$A + 5
			$A = 0
Endfunction


;!
;!
; end Luhns Mod
_________________________
The Code is out there

Top
#199487 - 2010-08-11 02:57 PM Re: KixGolf: Luhn's Mod - Public Round [Re: DrillSergeant]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4510
Loc: USA
Maybe I'm wrong, but isn't $t supposed to be the sum total? Because it appears that $T is returning nothing but 0s and 1s... which just happen to always return the proper value for the luhn check in the end...

So are we missing a test or is this a Jedi Mind trick?


Edited by Allen (2010-08-11 03:04 PM)

Top
#199488 - 2010-08-11 03:17 PM Re: KixGolf: Luhn's Mod - Public Round [Re: Allen]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
It is dark voodoo indeed...

If you put 1 & $c between round brackets and put the mod 10 back where it was you'll see that $T does indeed contain the total...

I noticed that when I removed the brackets I lost the value of $T but because the tests still came up as valid I went with it... and today I found out that it doesn't even need the mod 10 to work...


$T as expected:
 Code:
; begin Luhns Mod
;
;!
Function A($)
Dim $c, $t
	?
	For $c=0 to 15-($<4)
		$A = 0 + right($, 1)
		$t = (1 & $c) * ($A / 5 + $A) + $A + $t
		$ = left($,~)
		$t " "
		If $t mod 10 + $ | 4&$A + 5
			$A = 0
Endfunction


;!
;!
; end Luhns Mod


Voodoo $T:
 Code:
; begin Luhns Mod
;
;!
Function A($)
Dim $c, $t
	?
	For $c=0 to 15-($<4)
		$A = 0 + right($, 1)
		$t = 1 & $c * ($A / 5 + $A) + $A + $t
		$ = left($,~)
		$t " "
		If $t + $ | 4&$A + 5
			$A = 0
Endfunction


;!
;!
; end Luhns Mod


Or maybe I just sold my soul to the devil to win ;-)
_________________________
The Code is out there

Top
#199489 - 2010-08-11 03:48 PM Re: KixGolf: Luhn's Mod - Public Round [Re: DrillSergeant]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4510
Loc: USA
I can completely see why the mod 10 check is unnecessary when you are getting the proper 0 or 1 value in $t... but how its doing this without a true total is a complete mystery to me.

So how hot is it down there? ;\)

Top
#199490 - 2010-08-11 05:04 PM Re: KixGolf: Luhn's Mod - Public Round [Re: Lonkero]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
 Originally Posted By: Lonkero
well, I still don't fully crasp the kixtart binary logic. way too fuzzy.
kudos to drill about that. iirc hobie was one of those binary boys too.

but playing with numbers and making them dance for you... that I would consider my field \:\)



Well, there are 10 guys who really understand KiXtart binary logic (Ruud not included), and these are Rogier and Howard M)

edit: on second thought make that 11 and add Richard to the list.
maybe even 100 including Remco


Edited by Jochen (2010-08-11 06:24 PM)
_________________________



Top
#199491 - 2010-08-11 07:14 PM Re: KixGolf: Luhn's Mod - Public Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
what?

 Code:
;pseudo:
if $t + $ | whateva
    $a = 0


I can't get why $t should be 0 in any case

edit: Maybe I don't want to know this.. there be dragons \:o


Edited by Jochen (2010-08-11 07:19 PM)
Edit Reason: *shivers*
_________________________



Top
#199492 - 2010-08-11 07:48 PM Re: KixGolf: Luhn's Mod - Public Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
oh, I see .. Operator Precedence

1. ($a / 5 + $a)
2. + $a
3. + $t
4. * $c
5. 1 & (result of 1. - 4.)

Now that I just realized what might going on... how much time is left until the '19th Hole' ?

btw. Rogier: 4&$a+5 ... breathtaking move as well!
_________________________



Top
#199493 - 2010-08-11 08:44 PM Re: KixGolf: Luhn's Mod - Public Round [Re: Jochen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
nothing to do with voodoo.
the line:
$t = 1 & $c * ($A / 5 + $A) + $A + $t

is just the same as:
$t = 1 & ($c * ($A / 5 + $A) + $A + $t)

still trying to figure out what it does, but some day I will get to it ;\)
_________________________
!

download KiXnet

Top
#199495 - 2010-08-11 09:30 PM Re: KixGolf: Luhn's Mod - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
somebody please comment but it actually looks like a "mod 2" statement.
but it is not. (tested it :))

anyhow... something is not cool in there.
_________________________
!

download KiXnet

Top
Page 3 of 6 <12345>Last »


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 197 anonymous users online.
Newest Members
dimi575, Drecksnacken, Nlill, webtools321, multiman
17734 Registered Users

Generated in 0.045 seconds in which 0.012 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org