Page 6 of 8 « First<45678>
Topic Options
#167938 - 2006-09-20 08:30 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
am I the only golfer around?

672...
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
$k=$k+($>$k)
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
$k=$k-(-$<$k)
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
$k=$k-(-$<$k)
For $j = -$k to $
$a = c($j,$a)
$s = d($s,$a)
Next
Next
EndIf
$s=Split($s,a)
EndFunction

Function c($,$a)
dim $!
$! = AScan($a,$)
$a[AScan($a,0)]=$
$a[$!]=0
$c = $a
EndFunction

Function d($s,$)
If $s
$d = $s + a
EndIf

For Each $ In $
$d= $d + substr("W B",1+($=0)+2*($>),1)
EndFunction


Top
#167939 - 2006-09-20 08:42 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
650

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
$k=$k+($>$k)
For $j = -1 to -$k step -1
$a = c($j,$a)
$s = d($s,$a)
Next
Next
If $ MOD 2
For $k = 1 to $
For $j = $k to $
$a = c($j,$a)
$s = d($s,$a)
Next
$k=$k+($>$k)
If $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 $
For $j = -$k to -$ step -1
$a = c($j,$a)
$s = d($s,$a)
Next
$k=$k+($>$k)
For $j = $k to $
$a = c($j,$a)
$s = d($s,$a)
Next
Next
EndIf
$s=Split($s,a)
EndFunction

Function c($,$a)
dim $!
$! = AScan($a,$)
$a[AScan($a,0)]=$
$a[$!]=0
$c = $a
EndFunction

Function d($s,$)
If $s
$d = $s + a
EndIf

For Each $ In $
$d= $d + substr("W B",1+($=0)+2*($>),1)
EndFunction


Top
#167940 - 2006-09-20 09:24 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Sorry Jooel,
It has been crazy around here, hopefuly i can work on things tonight.
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#167941 - 2006-09-21 01:02 AM Re: KiXgolf: Shuttle Puzzle - Public Round
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Jooel
I admire your skills as golfer (barber?). You shave them quite short.
646
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
$k=$k+($>$k)
For $j = -1 to -$k step -1
$a = c($j,$a)
$s = d($s,$a)
Next
Next
If $ MOD 2
For $k = 1 to $
For $j = $k to $
$a = c($j,$a)
$s = d($s,$a)
Next
$k=$k+($>$k)
If $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 $
For $j = -$k to -$ step -1
$a = c($j,$a)
$s = d($s,$a)
Next
$k=$k+($>$k)
For $j = $k to $
$a = c($j,$a)
$s = d($s,$a)
Next
Next
EndIf
$s=Split($s,a)
EndFunction

Function c($a,$)
Dim $!
$! = AScan($,$a)
$[AScan($,0)]=$a
$[$!]=0
$c = $
EndFunction

Function d($,$s)
If $
$d = $ + a
EndIf

For Each $ In $s
$d= $d + SubStr("W B",1+($=0)+2*($>),1)
EndFunction


Top
#167942 - 2006-09-21 02:28 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Witto,
638
Code:

Function s($x)
Dim $j,$
Dim $a[$x+$x]
For $j = 0 to $x+$x
$a[$j] = $j-$x
Next

$s = d($s,$a)

For $ = 1 to $x
For $j = 1 to $
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
For $j = -1 to -$ step -1
$a = c($j,$a)
$s = d($s,$a)
Next
Next
If $x MOD 2
For $ = 1 to $x
For $j = $ to $x
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
If $ < $x
For $j = -$ to -$x step -1
$a = c($j,$a)
$s = d($s,$a)
Next
EndIf
Next
Else
For $j = 1 to $x
$a = c($j,$a)
$s = d($s,$a)
Next
For $ = 1 to $x
For $j = -$ to -$x step -1
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
For $j = $ to $x
$a = c($j,$a)
$s = d($s,$a)
Next
Next
EndIf
$s=Split($s,a)
EndFunction

Function c($a,$)
Dim $!
$! = AScan($,$a)
$[AScan($,0)]=$a
$[$!]=0
$c = $
EndFunction

Function d($,$s)
If $
$d = $ + a
EndIf
For Each $ in $s
$d= $d + SubStr("W B",1+($=)+2*($>),1)
EndFunction

_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#167943 - 2006-09-21 02:31 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
633 then.
Code:

Function s($x)
Dim $j,$
Dim $a[$x+$x]
For $j = 0 to $x+$x
$a[$j] = $j-$x
Next

$s = d($s,$a)

For $ = 1 to $x
For $j = 1 to $
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
For $j = -1 to -$ step -1
$a = c($j,$a)
$s = d($s,$a)
Next
Next
If $x MOD 2
For $ = 1 to $x
For $j = $ to $x
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
If $ < $x
For $j = -$ to -$x step -1
$a = c($j,$a)
$s = d($s,$a)
Next
EndIf
Next
Else
For $j = 1 to $x
$a = c($j,$a)
$s = d($s,$a)
Next
For $ = 1 to $x
For $j = -$ to -$x step -1
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
For $j = $ to $x
$a = c($j,$a)
$s = d($s,$a)
Next
Next
EndIf
$s=Split($s,a)
EndFunction

Function c($a,$)
$c = AScan($,$a)
$[AScan($,0)]=$a
$[$c]=0
$c = $
EndFunction

Function d($,$s)
If $
$d = $ + a
EndIf
For Each $ in $s
$d= $d + SubStr("W B",1+($=)+2*($>),1)
EndFunction


Top
#167944 - 2006-09-21 03:04 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
postpump post ....

631

Code:

Function s($x)
Dim $j,$
Dim $a[2*$x]
For $j = 0 to 2*$x
$a[$j] = $j-$x
Next

$s = d($s,$a)

For $ = 1 to $x
For $j = 1 to $
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
For $j = -1 to -$ step -1
$a = c($j,$a)
$s = d($s,$a)
Next
Next
If $x MOD 2
For $ = 1 to $x
For $j = $ to $x
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
If $ < $x
For $j = -$ to -$x step -1
$a = c($j,$a)
$s = d($s,$a)
Next
EndIf
Next
Else
For $j = 1 to $x
$a = c($j,$a)
$s = d($s,$a)
Next
For $ = 1 to $x
For $j = -$ to -$x step -1
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
For $j = $ to $x
$a = c($j,$a)
$s = d($s,$a)
Next
Next
EndIf
$s=Split($s,a)
EndFunction

Function c($a,$)
$c = AScan($,$a)
$[AScan($,0)]=$a
$[$c]=0
$c = $
EndFunction

Function d($,$s)
If $
$d = $ + a
EndIf
For Each $ in $s
$d= $d + SubStr("W B",1+($=)+2*($>),1)
EndFunction

_________________________



Top
#167945 - 2006-09-21 05:26 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
628, I think.
Code:

Function s($x)
Dim $j,$,$a[2*$x]
For $j = 0 to 2*$x
$a[$j] = $j-$x
Next

$s = d(0,$a)

For $ = 1 to $x
For $j = 1 to $
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
For $j = -1 to -$ step -1
$a = c($j,$a)
$s = d($s,$a)
Next
Next
If $x MOD 2
For $ = 1 to $x
For $j = $ to $x
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
If $ < $x
For $j = -$ to -$x step -1
$a = c($j,$a)
$s = d($s,$a)
Next
EndIf
Next
Else
For $j = 1 to $x
$a = c($j,$a)
$s = d($s,$a)
Next
For $ = 1 to $x
For $j = -$ to -$x step -1
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
For $j = $ to $x
$a = c($j,$a)
$s = d($s,$a)
Next
Next
EndIf
$s=Split($s,a)
EndFunction

Function c($a,$)
$c = AScan($,$a)
$[AScan($,0)]=$a
$[$c]=0
$c = $
EndFunction

Function d($,$s)
If $
$d = $ + a
EndIf
For Each $ in $s
$d= $d + SubStr("W B",1+($=)+2*($>),1)
EndFunction


Top
#167946 - 2006-09-21 06:21 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
You think correct!
_________________________



Top
#167947 - 2006-09-21 07:25 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, lets start golfing boys.
595
Code:

Function s($x)
Dim $j,$,$a[2*$x]
For $j = 0 to 2*$x
$a[$j] = $j-$x
Next

$s = d(0,$a)

For $ = 1 to $x
For $j = 1 to $
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
For $j = -1 to -$ step -1
$a = c($j,$a)
$s = d($s,$a)
Next
Next
If 0= $x MOD 2
For $j = 1 to $x
$a = c($j,$a)
$s = d($s,$a)
Next
endif
For $ = 1 to $x
If $x MOD 2
For $j = $ to $x
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
endif
If $ < $x
For $j = -$ to -$x step -1
$a = c($j,$a)
$s = d($s,$a)
Next
endif
If 0= $x MOD 2
$=$+($x>$)
For $j = $ to $x
$a = c($j,$a)
$s = d($s,$a)
Next
endif
Next
$s=Split($s,a)
EndFunction

Function c($a,$)
$c = AScan($,$a)
$[AScan($,0)]=$a
$[$c]=0
$c = $
EndFunction

Function d($,$s)
If $
$d = $ + a
EndIf
For Each $ in $s
$d= $d + SubStr("W B",1+($=)+2*($>),1)
EndFunction


Top
#167948 - 2006-09-21 08:10 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
266 out of remco's code:
Code:

Function s($d)
Dim $a,$b,$c,$,$e,$f,$g
$=" "
For $b=1 to $d
$=W+$+B
$a=$a+$d+2
Next
Redim $s[$a]
$d=2

For $c=0 to $a
$s[$c]=$
$=Join(Split($),SubStr($,$b-1,1))
$=Left($,$b-2)+" "+Substr($,$b)
$b=$b+$d
$e=2*($a/2>$c+1)-1
If 1/$d
$d=-2*$e*$d
Else
If $f
$f=$f-1
Else
$d=$d*$e/2
$g=$g+$e
$f=$g
EndFunction


Top
#167949 - 2006-09-21 09:11 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hehee...

554 out of witto's code
Code:

Function s($x)
Dim $j,$,$a[2*$x]
For $j = 0 to 2*$x
$a[$j] = $j-$x
Next

$s = d(0,$a)

For $ = 1 to $x
For $j = 1 to $
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
For $j = -1 to -$ step -1
$a = c($j,$a)
$s = d($s,$a)
Next
Next
If 0= $x MOD 2
$=1
gosub n
endif
For $ = 1 to $x
If $x MOD 2
gosub n
$=$+($x>$)
endif
If $ < $x
For $j = -$ to -$x step -1
$a = c($j,$a)
$s = d($s,$a)
Next
endif
If 0= $x MOD 2
$=$+($x>$)
gosub n
endif
Next
$s=Split($s,a)
exit
:n
For $j = $ to $x
$a = c($j,$a)
$s = d($s,$a)
Next
return
EndFunction

Function c($a,$)
$c = AScan($,$a)
$[AScan($,0)]=$a
$[$c]=0
$c = $
EndFunction

Function d($,$s)
If $
$d = $ + a
EndIf
For Each $ in $s
$d= $d + SubStr("W B",1+($=)+2*($>),1)
EndFunction


Top
#167950 - 2006-09-21 09:17 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
540
Code:

Function s($x)
Dim $j,$,$a[2*$x]
For $j = 0 to 2*$x
$a[$j] = $j-$x
Next

$s = d(0,$a)

For $ = 1 to $x
For $j = 1 to $
$a = c($j,$a)
$s = d($s,$a)
Next
$=$+($x>$)
For $j = 1 to $
$a = c(-$j,$a)
$s = d($s,$a)
Next
Next
If 0= $x MOD 2
$=1
gosub n
endif
For $ = 1 to $x
If $x MOD 2
gosub n
$=$+($x>$)
endif
If $ < $x
For $j = $ to $x
$a = c(-$j,$a)
$s = d($s,$a)
Next
endif
If 0= $x MOD 2
$=$+($x>$)
gosub n
endif
Next
$s=Split($s,a)
exit
:n
For $j = $ to $x
$a = c($j,$a)
$s = d($s,$a)
next
return
EndFunction

Function c($a,$)
$c = AScan($,$a)
$[AScan($,0)]=$a
$[$c]=0
$c = $
EndFunction

Function d($,$s)
If $
$d = $ + a
EndIf
For Each $ in $s
$d= $d + SubStr("W B",1+($=)+2*($>),1)
EndFunction


Top
#167951 - 2006-09-21 10:22 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
512
Code:

Function s($x)
Dim $j,$,$a[2*$x]
For $j = 0 to 2*$x
$a[$j] = $j-$x
Next

gosub d

For $ = 1 to $x
For $j = 1 to $
$a = c($j,$a)
gosub d
Next
$=$+($x>$)
For $j = 1 to $
$a = c(-$j,$a)
gosub d
Next
Next
If 0= $x MOD 2
$=1
gosub n
endif
For $ = 1 to $x
If $x MOD 2
gosub n
$=$+($x>$)
endif
If $ < $x
For $j = $ to $x
$a = c(-$j,$a)
gosub d
Next
endif
If 0= $x MOD 2
$=$+($x>$)
gosub n
endif
Next
$s=Split($s,a)
exit
:n
For $j = $ to $x
$a = c($j,$a)
gosub d
next
return
:d
dim $_
If $s
$s = $s + a
EndIf
For Each $_ in $a
$s= $s + SubStr("W B",1+($_=)+2*($_>),1)
next
return
EndFunction

Function c($a,$)
$c = AScan($,$a)
$[AScan($,0)]=$a
$[$c]=0
$c = $
EndFunction


Top
#167952 - 2006-09-21 10:24 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
eh?
what was gosub again??

_________________________



Top
#167953 - 2006-09-21 10:28 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
465
Code:

Function s($x)
Dim $j,$,$a[2*$x],$p,$_
For $j = 0 to 2*$x
$a[$j] = $j-$x
Next

gosub d
For $ = 1 to $x
For $j = 1 to $
$p=1
gosub d
Next
$=$+($x>$)
For $j = 1 to $
$p=-1
gosub d
Next
Next
If 0= $x MOD 2
$=1
gosub n
endif
For $ = 1 to $x
If $x MOD 2
gosub n
$=$+($x>$)
endif
If $ < $x
For $j = $ to $x
$p=-1
gosub d
Next
endif
If 0= $x MOD 2
$=$+($x>$)
gosub n
endif
Next
$s=Split($s,a)
exit
:n
For $j = $ to $x
$p=1
gosub d
next
return
:d
If $s
$_ = AScan($a,$j*$p)
$a[AScan($a,0)]=$j*$p
$a[$_]=0
$s = $s + a
EndIf
For Each $_ in $a
$s= $s + SubStr("W B",1+($_=)+2*($_>),1)
next
return
EndFunction


Top
#167954 - 2006-09-21 10:32 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
gosub what?

it's not goto, that's for sure

Top
#167955 - 2006-09-21 10:39 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Hey Jooel. Thanks for golfing my code. I had tried these gosubs in the private round, but I presume I did something wrong and made two functions.
Top
#167956 - 2006-09-21 10:49 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
458.
is there any code that I haven't yet golfed?
Code:

Function s($x)
Dim $j,$,$a[2*$x],$p,$_
For $j = 0 to 2*$x
$a[$j] = $j-$x
Next

gosub d
For $ = 1 to $x
For $j = 1 to $
$p=1
gosub d
Next
$=$+($x>$)
For $j = 1 to $
$p=-1
gosub d
Next
Next
If 0= $x MOD 2
$=1
$p=1
gosub n
endif
For $ = 1 to $x
If $x MOD 2
$p=1
gosub n
$=$+($x>$)
endif
If $ < $x
$p=-1
gosub n
endif
If 0= $x MOD 2
$=$+($x>$)
$p=1
gosub n
endif
Next
$s=Split($s,a)
exit
:n
For $j = $ to $x
gosub d
next
return
:d
If $s
$_ = AScan($a,$j*$p)
$a[AScan($a,0)]=$j*$p
$a[$_]=0
$s = $s + a
EndIf
For Each $_ in $a
$s= $s + SubStr("W B",1+($_=)+2*($_>),1)
next
return
EndFunction


Top
#167957 - 2006-09-21 10:52 PM Re: KiXgolf: Shuttle Puzzle - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
think I don't have benny's or jochen's golf done yet, but imho, they were the same, so didn't see no point golfing them both.

maciep's 210
remco's 266
jochen's/benny's 275
mine 308
witto's 458

anyone care to challenge?

Top
Page 6 of 8 « First<45678>


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

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.073 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

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