#167918 - 2006-09-18 05:35 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
RemcovC
Starting to like KiXtart
Registered: 2006-09-13
Posts: 174
Loc: Holland
|
Hit myself against my head for missing this:
Left($b,Len($b)-2) = Left ($b,-2)
So bringing the total down to 308
Code:
Function s($z) Dim $,$a,$b,$c,$d $=' ' For $a=1 to $z $=W+$+B $b=$b+$z+2 Next ReDim $s[$b] For $a=0 to $b $s[$a]=$ $=Split($) $b=$[0] ;Left $c=$[1] ;Right $d=Right($b,2) ;Right chrs of Left Half $z=Left($c,2) ;Left chrs of Right Half Select Case $d=WB $=Left($b,-2)+' BW'+$c Case $z=WB $=$b+'BW '+Right($c,-2) Case Not($d=W Or $d=WW) And Left($z,1)=B $=$b+'B '+Right($c,~) Case 1 $=Left($b,~)+' W'+$c ;EndSelect ;Next EndFunction
Code:
Shuttle Puzzle passed all 10 tests (100% correct)
KiXtart KiXtart Version = 4.51 KiXforms Version = KiXGolf Script = kixgolf_shuttle.kix
Computer OS = Windows Server 2003 CPU = AMD Athlon(tm) XP 2000+ Speed = 1670 MHz Memory = 1024 MB
KiXGolf Scoring Engine Scoring Engine = 3.2
KiXtart Golf Score Tournament = KiXtart Golf: Shuttle Puzzle Processing Start = 2006/09/18 17:34:04.064 Processing End = 2006/09/18 17:34:04.486 Duration = 0000/00/00 00:00:00.421 KiXGolf Score = 308
Thank you for participating in KiXtart Golf!
Edited by RemcovC (2006-09-18 05:38 PM)
_________________________
It's better to have scripted and died, then to never have scripted at all
|
Top
|
|
|
|
#167920 - 2006-09-18 06:01 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
267 of remco's code: Code:
Function s($) Dim $a,$b,$c,$d,$e,$f,$g $d=" " For $b=1 to $ $d=W+$d+B $a=$a+$+2 Next Redim $s[$a] $=2 For $c=0 to $a $s[$c]=$d $d=Join(Split($d),SubStr($d,$b-1,1)) $d=Left($d,$b-2)+" "+Substr($d,$b) $b=$b+$ $e=2*($a/2>$c+1)-1 If 1/$ $=-2*$e*$ Else If $f $f=$f-1 Else $=$*$e/2 $g=$g+$e $f=$g EndFunction
|
Top
|
|
|
|
#167921 - 2006-09-18 06:19 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
RemcovC
Starting to like KiXtart
Registered: 2006-09-13
Posts: 174
Loc: Holland
|
Go Jooel Go
|
Top
|
|
|
|
#167923 - 2006-09-19 08:45 AM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
RemcovC
Starting to like KiXtart
Registered: 2006-09-13
Posts: 174
Loc: Holland
|
Benny down to 302 by rewriting the 3rd case statement: Code:
Function s($z) Dim $,$a,$b,$c,$d $=' ' For $a=1 to $z $=W+$+B $b=$b+$z+2 Next ReDim $s[$b] For $a=0 to $b $s[$a]=$ $=Split($) $b=$[0] ;Left $c=$[1] ;Right $d=Right($b,2) ;Right chrs of Left Half $z=Left($c,2) ;Left chrs of Right Half Select Case $d=WB $=Left($b,-2)+' BW'+$c Case $z=WB $=$b+'BW '+Right($c,-2) Case $d<>W & $d<>WW & Left($z,1)=B $=$b+'B '+Right($c,~) Case 1 $=Left($b,~)+' W'+$c ;EndSelect ;Next EndFunction
_________________________
It's better to have scripted and died, then to never have scripted at all
|
Top
|
|
|
|
#167924 - 2006-09-19 11:19 AM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
well, here is 294: Code:
Function s($z) Dim $,$a,$b,$c,$d $=' ' For $a=1 to $z $=W+$+B $b=$b+$z+2 Next ReDim $s[$b] For $a=0 to $b $s[$a]=$ $=Split($) $b=$[0] ;Left $c=$[1] ;Right $d=Right($b,2) ;Right chrs of Left Half $z=Left($c,2) ;Left chrs of Right Half Select Case $d=WB $=Left($b,-2)+' BW'+$c Case $z=WB $=$b+'BW '+Right($c,-2) Case $d<W & Left($z,1)=B $=$b+'B '+Right($c,~) Case 1 $=Left($b,~)+' W'+$c EndFunction
|
Top
|
|
|
|
#167926 - 2006-09-19 03:01 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
RemcovC
Starting to like KiXtart
Registered: 2006-09-13
Posts: 174
Loc: Holland
|
Quote:
$d < w
It won't win a beauty contest, but it gets the job done. Nice one
|
Top
|
|
|
|
#167927 - 2006-09-19 05:35 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
286. Code:
Function s($a) Dim $,$b,$d,$c $=' ' For $d=1 to $a $=W+$+B $b=$b+$a+2 Next ReDim $s[$b] For $a=0 to $b $s[$a]=$ $=Split($) $b=$[0] ;Left $c=$[1] $d=Right($b,2) ;Right chrs of Left Half Select Case $d=WB $=Left($b,-2)+' BW'+$c Case Left($c,2)=WB $=$b+'BW '+Right($c,-2) Case $d<W & Left($c,1)=B $=$b+'B '+Right($c,~) Case 1 $=Left($b,~)+' W'+$c EndFunction
|
Top
|
|
|
|
#167930 - 2006-09-19 07:21 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
LOL! 275.
Code:
Function s($a) Dim $,$d,$c,$x $=' ' For $d=1 to $a $=W+$+B $c=$c+$a+2 Next ReDim $s[$c] For $a=0 to $c $s[$a]=$ $=Split($) $c=$[0] $=$[1] $d=Right($c,2) ;Right chrs of Left Half Select Case $d=WB $=Left($c,-2)+' BW'+$ Case Left($,2)=WB $=$c+'BW '+Right($,-2) Case $d<W & W>$ & $>a $=$c+'B '+Right($,~) Case 1 $=Left($c,~)+' W'+$ EndFunction
|
Top
|
|
|
|
#167932 - 2006-09-19 10:39 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
38 more strokes to shave and you will have had the best appoach. I envy you.
|
Top
|
|
|
|
#167933 - 2006-09-19 11:02 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
I still don't like the select case thingie... even though it's pretty short, it looks long
|
Top
|
|
|
|
#167934 - 2006-09-20 12:14 AM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Apparently I will end up as tailender. I just continue shaving my script 738 Code:
Function s($) Dim $j, $k, $b, $v Dim $a[$+$] For $j = 0 to $+$ $a[$j] = $j-$ Next
$s = d($s,$a) For $k = 1 to $ For $j = 1 to $k $a = c($j,$a) $s = d($s,$a) Next If $ > $k $k=$k+1 EndIf For $j = -1 to -$k step -1 $a = c($j,$a) $s = d($s,$a) Next Next If NOT $ MOD 2 For $j = 1 to $ $a = c($j,$a) $s = d($s,$a) Next EndIf If $ MOD 2 For $k = -1 to -$ step -1 For $j = -$k to $ $a = c($j,$a) $s = d($s,$a) Next If -$ < $k $k=$k-1 EndIf If NOT $k = -$ For $j = $k to -$ step -1 $a = c($j,$a) $s = d($s,$a) Next EndIf Next Else For $k = -1 to -$ step -1 For $j = $k to -$ step -1 $a = c($j,$a) $s = d($s,$a) Next If -$ < $k $k=$k-1 EndIf For $j = -$k to $ $a = c($j,$a) $s = d($s,$a) Next Next EndIf $s=Split($s,a) EndFunction
Function c($j,$a) Dim $b,$v $b = AScan($a,0) $v = AScan($a,$j) $a[$b]=$j $a[$v]=0 $c = $a EndFunction
Function d($s,$a) Dim $j If $s $d = $s + a EndIf For Each $j In $a Select Case $j < 0 $d = $d + W Case $j = 0 $d = $d + " " Case 1;$j > 0 $d = $d + B ;EndSelect ;Next EndFunction
|
Top
|
|
|
|
#167936 - 2006-09-20 09:10 AM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Jeeeee, supporters. Thx.
|
Top
|
|
|
|
#167937 - 2006-09-20 12:01 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
well, here is updated witto's code. 723 Code:
Function s($) Dim $j, $k, $b, $v Dim $a[$+$] For $j = 0 to $+$ $a[$j] = $j-$ Next
$s = d($s,$a) For $k = 1 to $ For $j = 1 to $k $a = c($j,$a) $s = d($s,$a) Next If $ > $k $k=$k+1 EndIf For $j = -1 to -$k step -1 $a = c($j,$a) $s = d($s,$a) Next Next If $ MOD 2 For $k = -1 to -$ step -1 For $j = -$k to $ $a = c($j,$a) $s = d($s,$a) Next If -$ < $k $k=$k-1 EndIf If NOT $k = -$ For $j = $k to -$ step -1 $a = c($j,$a) $s = d($s,$a) Next EndIf Next Else For $j = 1 to $ $a = c($j,$a) $s = d($s,$a) Next For $k = -1 to -$ step -1 For $j = $k to -$ step -1 $a = c($j,$a) $s = d($s,$a) Next If -$ < $k $k=$k-1 EndIf For $j = -$k to $ $a = c($j,$a) $s = d($s,$a) Next Next EndIf $s=Split($s,a) EndFunction
Function c($j,$a) Dim $b,$v $b = AScan($a,0) $v = AScan($a,$j) $a[$b]=$j $a[$v]=0 $c = $a EndFunction
Function d($s,$a) Dim $j If $s $d = $s + a EndIf For Each $j In $a Select Case $j < 0 $d = $d + W Case $j = 0 $d = $d + " " Case 1;$j > 0 $d = $d + B ;EndSelect ;Next EndFunction
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 920 anonymous users online.
|
|
|