#66610 - 2002-06-11 05:56 AM
Re: Round 2: KiXtart Golf Tournament Part III
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Sorry, missed that one.
$n=$b*$+$n
I missed the $n on the right side of the equation and took this line for a proper initialization.
$n=0
added +4 strokes.
|
Top
|
|
|
|
#66611 - 2002-06-11 05:59 AM
Re: Round 2: KiXtart Golf Tournament Part III
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
Hey, reuse the single $ in the second part ?
code:
Function BaseConverter($v,$f,$t) $i = len($v) $=1. Do $x = substr($v,$i,1) if $x > 9 $x = ASC(ucase($x)) - 55 endif $n=$*$x+$n $=$*$f $i=$i-1 Until $i=0
$c="" While $n $ = INT($n - (INT($n/$t) * $t)) $n = ($n-$)/$t IF $ > 9 $ = CHR($ + 55) ENDIF $c = ""+$+"$c" Loop $BaseConverter = $c Endfunction ;! BaseConverter('44680832201',10,36) ? BaseConverter('52',10,2) ? BaseConverter('Kixtart',36,10) ?
242
plus, this:
$c = ""+$+$c
might shave two more ? haven't tested too fully. [ 11 June 2002, 06:01: Message edited by: Shawn ]
|
Top
|
|
|
|
#66612 - 2002-06-11 06:04 AM
Re: Round 2: KiXtart Golf Tournament Part III
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Shawn, look a couple post above yours @ posted 11 June 2002 05:28 . We also needed to read $n=0 [ 11 June 2002, 06:05: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#66613 - 2002-06-11 06:14 AM
Re: Round 2: KiXtart Golf Tournament Part III
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
k - Hey Howard, do you have that modified version of KiXgolf, the one that has the BETWEEN markers ? I just inflicted the "no break on at top of script logoff of death" on myself - for the second time in as many days
|
Top
|
|
|
|
#66614 - 2002-06-11 06:27 AM
Re: Round 2: KiXtart Golf Tournament Part III
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
New KixGolf for Shawn.
code:
; This function scores the specified file and returns ; the KixGolf score. That is the total number of key strokes ; used to build a script not counting comments, spaces, tabs, ; or any ascii character above 126. ; ; The script will start counting on "odd" (1,3,5,...) occurrances ; of ";!" and the script will not count after "even" (0,2,4,...) ; instances of ";!". ; ;Syntax: %tmp%\kix32 kixgolf.kix $A=Kixgolf.kix ;
Function KixGolf($A) if open (1,$A) = 0 $X=0 $Q="" $C=readLine(1) while @error=0 if instr($C, ";!")>0 $countem = $countem + 1 & 1 endif If $countem $j=len($C) ; Get length of the line for $h=1 to $j ; Loop through each character in line $D=asc(substr($C,$h,1)) if $D=34 or $D=39 if $Q="" $Q=$D else if $Q=$D $Q="" endif endif endif
if $D=59 ; Ignore comment lines $h=$j ; Terminate loop else if $Q<>"" $X=$X+1 ; Count the valid characters else if $D>32 and $D<127 $X=$X+1 ; Count the valid characters endif endif endif next endif $C=readLine(1) loop else ? "$A ??" ; Show bad file name endif if $Q<>"" ? "Mis-matched quotes. Probable score error." ? endif $KixGolf=$X EndFunction
;$A must be initialized on the command line. ;%tmp%\kix32 kixgolf.kix $A=Kixgolf.kix
? "KixGolf score = " + KixGolf($A)
[ 11 June 2002, 06:32: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#66616 - 2002-06-11 07:29 AM
Re: Round 2: KiXtart Golf Tournament Part III
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
When performing what Jens wanted Base10 to base36 with KIXTART as the answer it works. Going backward it failed.
You have a private message waiting. [ 11 June 2002, 07:32: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#66619 - 2002-06-11 03:08 PM
Re: Round 2: KiXtart Golf Tournament Part III
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
The script was modified to look for ;! to start and stop counting.
So:
Break on BaseConverter('Kixtart',36,10) ?
;! Start counting on next line Function ...
EndFunction ;! Stop counting More code not counted...
|
Top
|
|
|
|
#66623 - 2002-06-11 04:00 PM
Re: Round 2: KiXtart Golf Tournament Part III
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Jens, I believe in evolution with regard to KixGolf, divine creation seems to be out of the question. [ 11 June 2002, 16:01: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#66626 - 2002-06-11 05:02 PM
Re: Round 2: KiXtart Golf Tournament Part III
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Is this simpler?
code:
$A=ASC($X) $A=$A-48-($A>64)*7
{EDIT} Nope {/EDIT} [ 11 June 2002, 17:05: Message edited by: Richard Howarth ]
|
Top
|
|
|
|
#66627 - 2002-06-11 05:08 PM
Re: Round 2: KiXtart Golf Tournament Part III
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Hmm. think we can break the 220 mark? Uh-oh.. formula isn't 100% accurate..darnit... have to rework it again.. Weird.. it looks like it works correctly..hmmm.... but my answers don't come out right.
Brian [ 11 June 2002, 17:14: Message edited by: BrianTX ]
|
Top
|
|
|
|
#66628 - 2002-06-11 06:26 PM
Re: Round 2: KiXtart Golf Tournament Part III
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
I got it down to 235 now...
I'll post it eventually.. lol
Brian
{edit} make that 233... {edit} make that 232... {edit} make that 231... [ 11 June 2002, 18:37: Message edited by: BrianTX ]
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 239 anonymous users online.
|
|
|