#167899 - 2006-09-18 07:18 AM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Well, if you say so. Code:
Function s($) Dim $_, $0, $1 ReDim $s[($+1)*$+$] $s[0] = " " For $_ = 1 to $ $s[0] = W + $s[0] + B Next For $_ = 1 to Ubound($s) $ = Split($s[$_-1]," ") $0 = Right($[0],1) $1 = Left($[1],1) Select Case InStr($[1],B)=2 AND $1 = W ;^B $s[$_] = $[0] + B + $1 + " " + Right($[1],-2) Case ($0 = B AND $1 = B AND InStr($[0],W)) OR ($0 = B AND InStr($[1],B) = 0) ;W^ $s[$_] = Left($[0],-2) + " " + $0 + W + $[1] Case $0 = W AND ( InStr($[0],B)=0 OR InStr($[1],B)=0) ;W-> $s[$_] = Left($[0],~) + " W" + $[1] Case 1 ;<-B $s[$_] = $[0] + "B " + Right($[1],~) ;EndSelect ;Next EndFunction
Code:
Shuttle Puzzle passed all 10 tests (100% correct)
KiXtart KiXtart Version = 4.53 KiXforms Version = KiXGolf Script = kixgolf_shuttle.kix
Computer OS = Windows XP Professional CPU = Intel(R) Pentium(R) 4 CPU 3.00GHz Speed = 2992 MHz Memory = 512 MB
KiXGolf Scoring Engine Scoring Engine = 3.2
KiXtart Golf Score Tournament = KiXtart Golf: Shuttle Puzzle Processing Start = 2006/09/18 07:13:36.218 Processing End = 2006/09/18 07:13:36.296 Duration = 0000/00/00 00:00:00.077 KiXGolf Score = 430 Thank you for participating in KiXtart Golf!
It is just that these things were so easy.
|
Top
|
|
|
|
#167902 - 2006-09-18 08:44 AM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
Right, if you say so, here's 414 of mine
Code:
function s($) dim $_, $0, $1, $2 redim $s[$*($+2)] $s[0] = " " for $_ = 1 to $ $s[0] = W+$s[0]+B next for $_ = 1 to ubound($s) $ = split($s[$_-1]," ") $0 = right($[0],1) $1 = left($[1],1) $2 = instr($[1],B) select case $2=2 and $1=W ;^B $s[$_] = $[0]+B+$1+" "+right($[1],-2) case ($0=B and $1=B and instr($[0],W)) or ($0=B and $2=0) ;W^ $s[$_] = left($[0],-2)+" "+$0+W+$[1] case $0=W and (instr($[0],B)=0 or $2=0) ;W-> $s[$_] = left($[0],~)+" W"+$[1] case 1 ;<-B $s[$_] = $[0]+"B "+right($[1],~) ;endselect ;next endfunction
Code:
Shuttle Puzzle passed all 10 tests (100% correct)
KiXtart KiXtart Version = 4.53 KiXforms Version = KiXGolf Script = KIXGOL~1.KIX
Computer OS = Windows 2000 Professional CPU = Intel(R) Pentium(R) 4 CPU 2.80GHz Speed = 2793 MHz Memory = 504 MB
KiXGolf Scoring Engine Scoring Engine = 3.2
KiXtart Golf Score Tournament = KiXtart Golf: Shuttle Puzzle Processing Start = 2006/09/18 08:40:50.296 Processing End = 2006/09/18 08:40:50.609 Duration = 0000/00/00 00:00:00.313 KiXGolf Score = 414 Thank you for participating in KiXtart Golf!
_________________________
|
Top
|
|
|
|
#167904 - 2006-09-18 09:44 AM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
410
should RTFM from time to time
Code:
function s($) dim $_, $0, $1, $2 redim $s[$*($+2)] $s[0] = " " for $_ = 1 to $ $s[0] = W+$s[0]+B next for $_ = 1 to ubound($s) $ = split($s[$_-1]) $0 = right($[0],1) $1 = left($[1],1) $2 = instr($[1],B) select case $2=2 and $1=W ;^B $s[$_] = $[0]+B+$1+" "+right($[1],-2) case ($0=B and $1=B and instr($[0],W)) or ($0=B and $2=0) ;W^ $s[$_] = left($[0],-2)+" "+$0+W+$[1] case $0=W and (instr($[0],B)=0 or $2=0) ;W-> $s[$_] = left($[0],~)+" W"+$[1] case 1 ;<-B $s[$_] = $[0]+"B "+right($[1],~) ;endselect ;next endfunction
_________________________
|
Top
|
|
|
|
#167907 - 2006-09-18 11:30 AM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
remco, your score actually was the reason why I started thinking about it. I know you were coding with the same base code as I and you didn't just copycat my modifications, thus, I think you should have that score. anyways... if someone takes the leading code and takes another approach with it and that adds to the score, he still has almost leading score with his code. it shouldn't be accepted though. so, think this comes to trust in the end. if allowing higher scores, one has to be able to trust that no misbehavior occurs.
someone might remember way back when some nameless regular posted very low score with: Code:
function blaah($input) $blaah = readprofilestring("kixgolf.ini",$input,"correct answer") endfunction
|
Top
|
|
|
|
#167908 - 2006-09-18 12:10 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
RemcovC
Starting to like KiXtart
Registered: 2006-09-13
Posts: 174
Loc: Holland
|
Shaved 3 of you're code Code:
function s($) dim $_, $0, $1, $2 redim $s[$*($+2)] $s[0] = " " for $_ = 1 to $ $s[0] = W+$s[0]+B next for $_ = 1 to $*($+2) ; = ubound($s) $ = Split($s[$_-1]) $0 = right($[0],1) $1 = left($[1],1) $2 = instr($[1],B) select case $2=2 and $1=W ;^B $s[$_] = $[0]+B+$1+" "+right($[1],-2) case ($0=B and $1=B and instr($[0],W)) or ($0=B and $2=0) ;W^ $s[$_] = left($[0],-2)+" "+$0+W+$[1] case $0=W and (instr($[0],B)=0 or $2=0) ;W-> $s[$_] = left($[0],~)+" W"+$[1] case 1 ;<-B $s[$_] = $[0]+"B "+right($[1],~) ;endselect ;next endfunction
_________________________
It's better to have scripted and died, then to never have scripted at all
|
Top
|
|
|
|
#167909 - 2006-09-18 01:01 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
yay, obviously
2 more makes 405 :
Code:
function s($) dim $_, $0, $1, $2 redim $s[$*($+2)] $s[0] = " " for $_ = 1 to $ $s[0] = W+$s[0]+B next for $_ = 1 to $*($+2) $ = split($s[$_-1]) $0 = right($[0],1) $1 = left($[1],1) $2 = instr($[1],B) select case $2 and $1=W ;^B $s[$_] = $[0]+B+$1+" "+right($[1],-2) case ($0=B and $1=B and instr($[0],W)) or ($0=B and $2=0) ;W^ $s[$_] = left($[0],-2)+" "+$0+W+$[1] case $0=W and (instr($[0],B)=0 or $2=0) ;W-> $s[$_] = left($[0],~)+" W"+$[1] case 1 ;<-B $s[$_] = $[0]+"B "+right($[1],~) ;endselect ;next endfunction
Code:
Shuttle Puzzle passed all 10 tests (100% correct)
KiXtart KiXtart Version = 4.53 KiXforms Version = KiXGolf Script = KIXGOL~1.KIX
Computer OS = Windows 2000 Professional CPU = Intel(R) Pentium(R) 4 CPU 2.80GHz Speed = 2793 MHz Memory = 504 MB
KiXGolf Scoring Engine Scoring Engine = 3.2
KiXtart Golf Score Tournament = KiXtart Golf: Shuttle Puzzle Processing Start = 2006/09/18 13:07:51.812 Processing End = 2006/09/18 13:07:52.265 Duration = 0000/00/00 00:00:00.453 KiXGolf Score = 405 Thank you for participating in KiXtart Golf!
Edited by Jochen (2006-09-18 01:10 PM)
_________________________
|
Top
|
|
|
|
#167910 - 2006-09-18 01:26 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
402
Code:
function s($) dim $_, $0, $1, $2 redim $s[$*($+2)] $s[0] = " " for $_ = 1 to $ $s[0] = W+$s[0]+B next for $_ = 1 to $*($+2) $ = split($s[$_-1]) $0 = right($[0],1) $1 = left($[1],1) $2 = instr($[1],B) select case $2 and $1=W ;^B $s[$_] = $[0]+B+$1+" "+right($[1],-2) case (BB=$0+$1 and instr($[0],W)) or ($0=B and $2=0) ;W^ $s[$_] = left($[0],-2)+" "+$0+W+$[1] case $0=W and (instr($[0],B)=0 or $2=0) ;W-> $s[$_] = left($[0],~)+" W"+$[1] case 1 ;<-B $s[$_] = $[0]+"B "+right($[1],~) ;endselect ;next endfunction
Code:
Shuttle Puzzle passed all 10 tests (100% correct)
KiXtart KiXtart Version = 4.53 KiXforms Version = KiXGolf Script = KIXGOL~1.KIX
Computer OS = Windows 2000 Professional CPU = Intel(R) Pentium(R) 4 CPU 2.80GHz Speed = 2793 MHz Memory = 504 MB
KiXGolf Scoring Engine Scoring Engine = 3.2
KiXtart Golf Score Tournament = KiXtart Golf: Shuttle Puzzle Processing Start = 2006/09/18 13:23:22.359 Processing End = 2006/09/18 13:23:22.796 Duration = 0000/00/00 00:00:00.437 KiXGolf Score = 402 Thank you for participating in KiXtart Golf!
_________________________
|
Top
|
|
|
|
#167911 - 2006-09-18 01:59 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
thanks Jochen, 345 Code:
Function s($z) Dim $,$a,$b,$c,$d,$e ReDim $s[$z*($z+2)] $=' ' For $a=1 to $z $=W+$+B Next For $a=0 to $z*($z+2) $s[$a]=$ $=Split($) $b=$[0] ;Left $c=$[1] ;Right $d=Right($b,2) ;Right chrs of Left Half $e=Left($c,2) ;Left chrs of Right Half Select Case $d=WB $=Left($b,Len($b)-2)+' BW'+$c Case $e=WB $=$b+'BW '+Right($c,Len($c)-2) Case Not($d=W Or $d=WW) And Left($e,1)=B $=$b+'B '+Right($c,Len($c)-1) Case 1 $=Left($b,Len($b)-1)+' W'+$c ;EndSelect ;Next EndFunction
|
Top
|
|
|
|
#167913 - 2006-09-18 02:21 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
RemcovC
Starting to like KiXtart
Registered: 2006-09-13
Posts: 174
Loc: Holland
|
341 for you benny
Code:
Function s($z) Dim $,$a,$b,$c,$d,$e $=' ' 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 $e=Left($c,2) ;Left chrs of Right Half Select Case $d=WB $=Left($b,Len($b)-2)+' BW'+$c Case $e=WB $=$b+'BW '+Right($c,Len($c)-2) Case Not($d=W Or $d=WW) And Left($e,1)=B $=$b+'B '+Right($c,Len($c)-1) Case 1 $=Left($b,Len($b)-1)+' W'+$c ;EndSelect ;Next EndFunction/Code:
_________________________
It's better to have scripted and died, then to never have scripted at all
|
Top
|
|
|
|
#167915 - 2006-09-18 02:44 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
RemcovC
Starting to like KiXtart
Registered: 2006-09-13
Posts: 174
Loc: Holland
|
And kicking a var brings benny's code down to 338
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,Len($b)-2)+' BW'+$c Case $z=WB $=$b+'BW '+Right($c,Len($c)-2) Case Not($d=W Or $d=WW) And Left($z,1)=B $=$b+'B '+Right($c,Len($c)-1) Case 1 $=Left($b,Len($b)-1)+' W'+$c ;EndSelect ;Next EndFunction
_________________________
It's better to have scripted and died, then to never have scripted at all
|
Top
|
|
|
|
#167917 - 2006-09-18 03:18 PM
Re: KiXgolf: Shuttle Puzzle - Public Round
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 896 anonymous users online.
|
|
|