LonkeroAdministrator
(KiX Master Guru)
2007-11-15 12:39 AM
KiXgolf - Printer Queue - Public Round

Gentlemen, post your codes and let the public battle begin!

LonkeroAdministrator
(KiX Master Guru)
2007-11-15 12:40 AM
Re: KiXgolf - Printer Queue - Public Round


Your solution passed all tests

KiXtart
KiXtart Version = 4.60 Beta 1
KiXGolf Script = kixgolf_pq.kix

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = Printer Queue
Processing Start = 2007/11/15 01:09:54.169
Processing End = 2007/11/15 01:09:54.606
Duration = 0000/00/00 00:00:00.436
KiXGolf Score = 138

; begin Printer Queue
;
;!
Function a($,$p)
dim $l
$l=9
while ~$p
if instr($,$l)
$p=$p-1
if $l>$
if 0>$p $p=($^)/2 endif
$=$+!+1*$
else
$a=$a+1
endif
$=substr($,3)
else
$l=$l-1
EndFunction
;!
;!
; end Printer Queue


DrillSergeant
(MM club member)
2007-11-15 12:44 AM
Re: KiXgolf - Printer Queue - Public Round

well... here's my 136... after the closing of the private round...

Jooel just pointed out to me that $c = val($) (for the first numeric val) can also be written as $c = 0 + $, this change gives a 136 instead of a 139...

Yep, I'm a bit sad...

 Code:
; begin Printer Queue
;
;!
Function a($,$p)
Dim $c, $i

	While ~$p
		$a = $a +($c<>X)
		$p = $p - 1
		$c = 0+$
		$ = substr($,3)
		For each $i in split($)
			If $c<$i
				$  = $ + ' ' + $c
				$c = X
				if $p < 0
					$p = ($^) / 2
EndFunction
;!
;!
; end Printer Queue


LonkeroAdministrator
(KiX Master Guru)
2007-11-15 12:53 AM
Re: KiXgolf - Printer Queue - Public Round

another stab...
sarge's code reduced to 135
 Code:
Function a($,$p)
Dim $c, $i

	While ~$p
		$a = $a + (x>$c)
		$p = $p - 1
		$c = 0+$
		$ = substr($,3)
		For each $i in split($)
			If $c<$i
				$  = $ + ' ' + $c
				$c = x
				if $p < 0
					$p = ($^) / 2
EndFunction


ShawnAdministrator
(KiX Supporter)
2007-11-15 01:08 AM
Re: KiXgolf - Printer Queue - Public Round

The deadline kinda caughtup with me. Was working on 157 code - but since I posted after deadline doesn't count:

 Code:
Function a($,$c)

 dim $i,$j

 $= split($)
 $i = -1

 while 1

  $i = ($i + 1) * ($i < ubound($))

  for $j = $[$i] to 8
   if ascan($,$j+1) > -1
    $j = 9
   endif
  next

  if $j = 9
   $[$i] = 0
   $a = $a + 1
   if $i = $c
    return
;  endif
; endif
;loop

EndFunction


AllenAdministrator
(KiX Supporter)
2007-11-15 01:13 AM
Re: KiXgolf - Printer Queue - Public Round

Here is my 155
function a($,$p)
  dim $i
  for $i=9 to 1 step -1
    while instr($,$i) | $p=0 & $i=split($)[$p]
      $p=iif($p=0,($^)/2,$p-1)
      $a=$a+($>=$i)
      $=right($,-2) + iif($i>$," " + 1*$,"")
    ;loop 
  ;next 
endfunction


LonkeroAdministrator
(KiX Master Guru)
2007-11-15 01:13 AM
Re: KiXgolf - Printer Queue - Public Round

you got the return to work?
failed for me always... dunno why...


ShawnAdministrator
(KiX Supporter)
2007-11-15 01:14 AM
Re: KiXgolf - Printer Queue - Public Round

Nice, Allen wins "the fewest dims" ! (so far)

LonkeroAdministrator
(KiX Master Guru)
2007-11-15 01:15 AM
Re: KiXgolf - Printer Queue - Public Round

same with you.
didn't wonder, why it works with WHILE but not with DO?


ShawnAdministrator
(KiX Supporter)
2007-11-15 01:18 AM
Re: KiXgolf - Printer Queue - Public Round

I wondered that yes. Maybe because UNTIL takes a parm ?

What you saying about RETURN ?


LonkeroAdministrator
(KiX Master Guru)
2007-11-15 01:20 AM
Re: KiXgolf - Printer Queue - Public Round

anyhow, here is 155 of Shawn's code:
 Code:
Function a($,$c)

 dim $i,$j

 $= split($)
 $i = -1

 while $j<>9 | $i<>$c

  $i = ($i + 1) * ($i < ubound($))

  for $j = $[$i] to 8
   if ascan($,$j+1) > -1
    $j = 9
   endif
  next

  if $j = 9
   $[$i] = 0
   $a = $a + 1

EndFunction


LonkeroAdministrator
(KiX Master Guru)
2007-11-15 01:20 AM
Re: KiXgolf - Printer Queue - Public Round

HEY!
my code had only 1 dim as well!


ShawnAdministrator
(KiX Supporter)
2007-11-15 01:22 AM
Re: KiXgolf - Printer Queue - Public Round

ah k your right - saw you second code not the first one. my boo.

AllenAdministrator
(KiX Supporter)
2007-11-15 01:36 AM
Re: KiXgolf - Printer Queue - Public Round

Jooel, you've got some really sick code. So sick in fact, that when I tried to change something, this really unusual sound started coming out of my tower. I swear I think it is the processor. Hit ctrl c and it quits. No lie.

LonkeroAdministrator
(KiX Master Guru)
2007-11-15 01:37 AM
Re: KiXgolf - Printer Queue - Public Round

allen, could you explain...
why this works:
while instr($,$i) | $p=0 & $i=split($)[$p]

but assumingly the same stuff:
while instr($,$i) | $p=0 & $i=$

suddenly doesn't???


AllenAdministrator
(KiX Supporter)
2007-11-15 01:39 AM
Re: KiXgolf - Printer Queue - Public Round

split($)[$p] = value of the position

LonkeroAdministrator
(KiX Master Guru)
2007-11-15 01:43 AM
Re: KiXgolf - Printer Queue - Public Round

indeed.
and if $p=0, the value of the position is same val($), right?

don't say this is one of those binary comparison thingies again...


AllenAdministrator
(KiX Supporter)
2007-11-15 01:44 AM
Re: KiXgolf - Printer Queue - Public Round

hmmm... you've got a point (I think)... looking

Sealeopard
(KiX Master)
2007-11-15 01:54 AM
Re: KiXgolf - Printer Queue - Public Round

Jooel: Thanks for opening up the public round.

Some nice code out there.


LonkeroAdministrator
(KiX Master Guru)
2007-11-15 01:56 AM
Re: KiXgolf - Printer Queue - Public Round

allen, here is 154 of your code.
that means, I've shortened everyones code and clock is 3AM.
guys, it's your turn ;\)

 Code:
function a($,$p)
  dim $i
  for $i=9 to 1 step -1
    while instr($,$i) | $p=0 & $i=split($)[$p]
      $p=iif($p=0,($^)/2,$p-1)
      $a=$a+1*$/$i
      $=right($,-2) + iif($i>$," " + 1*$,"")
endfunction


and Jens, np.


Gargoyle
(MM club member)
2007-11-15 03:41 AM
Re: KiXgolf - Printer Queue - Public Round

Not that it makes much difference since I never got a working version, but here are the two that I was working with.

Code Sample 1
 Code:
; begin Printer Queue
;
;!
Function a($b,$c)
Dim $array,$,$3,$2,$t[Len($b)],$l,$r

$a = $c
$array = Split($b)
$l = Ubound($array)

For $ = 9 to 1 step -1
	For $3 = 0 to $l 
	  	While $array[$3] < $
			For $2 = $3 to $l
				If $2 = $l
	              		$t[$2] = $array[$2]
				Else
					$t[$2] = $array[$2+1]
				EndIf
			Next
			$array = $t
			$b = Join($array)
			? $b ?
		Loop
	Next
Next

EndFunction
;!
;!
; end Printer Queue


Code Sample 2
 Code:
; begin Printer Queue
;
;!
Function a($b,$c)


Dim $, $2, $3
$b = Split($b)

For $ = 9 to 1 Step -1
  for $2 = 0 to Ubound($b)
	If $b[$2] = $ 
		If $2 = $C 
			$A = $3 + 1
		EndIf
		$3 = $3 + 1
	Endif
  Next
Next

EndFunction
;!
;!
; end Printer Queue



Feel free to tell me where I made the wrong assumptions.


Benny69
(MM club member)
2007-11-15 05:04 AM
Re: KiXgolf - Printer Queue - Public Round

Dang Nice Code guys, here is my 148

 Code:
Function a($,$b)
  Dim $c,$d
  
  For $c = -9 to 0
    While InStr($,-$c)
      $b=$b-1
      $d=Right($,-2)
      If -$c > $
        $=$d+_+Val($)
        If $b<0
          $b=($^)/2
        EndIf
      Else
        $=$d
        $a=$a+1
        If $b<0
          $c=0
;        EndIf
;      EndIf
;    Loop
;  Next
EndFunction


AllenAdministrator
(KiX Supporter)
2007-11-15 06:39 AM
Re: KiXgolf - Printer Queue - Public Round

Benny 145

 Code:
Function a($,$b)
  Dim $c,$d
  
  For $c = -9 to 0
    While InStr($,-$c)
      $b=$b-1
      $d=Right($,-2)
      If -$c > $
        $=$d+_+1*$
        If $b<0
          $b=($^)/2
        EndIf
      Else
        $=$d
        $a=$a+1
        If $b<0
          $c=0
;        EndIf
;      EndIf
;    Loop
;  Next
EndFunction


AllenAdministrator
(KiX Supporter)
2007-11-15 06:53 AM
Re: KiXgolf - Printer Queue - Public Round

Mine down to 151

 Code:
function a($,$p)
  dim $i,$t
  for $i=9 to 1 step -1
    while instr($,$i) & $t=0
      $t=$p=0 & $i=$
      $p=iif($p=0,($^)/2,$p-1)
      $a=$a+1*$/$i
      $=right($,-2) + iif($i>$,_ + 1*$,"")
    ;loop 
  ;next 
endfunction


JochenAdministrator
(KiX Supporter)
2007-11-15 07:19 AM
Re: KiXgolf - Printer Queue - Public Round

Good morning my golfing fellas, here's my 161: looking very different to Allens \:\) Oh, the things I haven't thought of , and still there is a GOTO \:o )


function a($,$b)
    dim $c
    $=split($)
    $[$b]=$[$b]+#
    while 2>$c
        $b=$[0]
        for each $c in $
            if 0+$c>$b
                goto 1
            endif
        next
        $c=0^$b
        $b=0
        $a=$a+1
        :1
        $[0]=''
        $=split(trim(join($)+' '+$b))
endfunction



Your solution passed all tests

KiXtart
KiXtart Version  = 4.53
KiXGolf Script   = kixgolf_pq.kix

KiXGolf Scoring Engine
Scoring Engine   = 3.3

KiXtart Golf Score
Tournament       = Printer Queue
Processing Start = 2007/11/15 07:13:51.734
Processing End   = 2007/11/15 07:13:54.546
Duration         = 0000/00/00 00:00:02.811
KiXGolf Score    = 161

Thank you for participating in KiXtart Golf!



JochenAdministrator
(KiX Supporter)
2007-11-15 08:54 AM
Re: KiXgolf - Printer Queue - Public Round

Whoa,

I bow before those who created shorter code \:o

namely Jooel, Rogier, Dale and Allen (count Shawn also, as he shortened his own in public already)


JochenAdministrator
(KiX Supporter)
2007-11-16 01:26 PM
Re: KiXgolf - Printer Queue - Public Round

Man, I already thought I wouldn't find anything to improve \:o

149 of Allens code:


function a($,$p)
  dim $i,$t
  for $i=9 to 1 step -1
    while instr($,$i) & $t=0
      $t=$p=0 & $i=$
      $p=iif($p,$p-1,($^)/2)
      $a=$a+1*$/$i
      $=right($,-2) + left(_+$,($i>$)*2)
endfunction



Your solution passed all tests

KiXtart
KiXtart Version  = 4.53
KiXGolf Script   = kixgolf_pq.kix

KiXGolf Scoring Engine
Scoring Engine   = 3.3

KiXtart Golf Score
Tournament       = Printer Queue
Processing Start = 2007/11/16 13:25:35.515
Processing End   = 2007/11/16 13:25:36.109
Duration         = 0000/00/00 00:00:00.593
KiXGolf Score    = 149

Thank you for participating in KiXtart Golf!



Benny69
(MM club member)
2007-11-16 02:10 PM
Re: KiXgolf - Printer Queue - Public Round

Nice one J

JochenAdministrator
(KiX Supporter)
2007-11-16 06:26 PM
Re: KiXgolf - Printer Queue - Public Round

Thanx,

I can't see any improvement atm.
I feel just like a part of your script ... this: +_+


LonkeroAdministrator
(KiX Master Guru)
2007-11-16 08:52 PM
Re: KiXgolf - Printer Queue - Public Round

I can see one...
but can't test&post on this machine.


LonkeroAdministrator
(KiX Master Guru)
2007-11-16 08:57 PM
Re: KiXgolf - Printer Queue - Public Round

k, found another computer:

Your solution passed all tests

KiXtart
KiXtart Version = 4.60 Beta 1
KiXGolf Script = kixgolf_pq.kix

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = Printer Queue
Processing Start = 2007/11/16 21:56:22.385
Processing End = 2007/11/16 21:56:23.152
Duration = 0000/00/00 00:00:00.767
KiXGolf Score = 141

 Code:
function a($,$p)
  dim $i,$t
  for $i=9 to 1 step -1
    while instr($,$i) & $t=0
      $t=$p=0 & $i=$
      $p=iif($p,$p-1,($^)/2)
      $a=$a+1*$/$i
      $=right($,-2) +_+($i>$)*$
endfunction


ps. I'm bit pissed, as one green man used to say after drinking some...


AllenAdministrator
(KiX Supporter)
2007-11-16 09:57 PM
Re: KiXgolf - Printer Queue - Public Round

I hadn't even noticed this little change.... gahhh! Dumb me.

$p=iif($p,$p-1,($^)/2)


LonkeroAdministrator
(KiX Master Guru)
2007-11-16 11:31 PM
Re: KiXgolf - Printer Queue - Public Round

well, if it comforts you, I didn't see that either \:\)
wasn't really looking either, though...


Benny69
(MM club member)
2007-11-17 12:49 AM
Re: KiXgolf - Printer Queue - Public Round

Jooel you Dawg! Your like one of the Savants,...

JochenAdministrator
(KiX Supporter)
2007-11-17 08:33 PM
Re: KiXgolf - Printer Queue - Public Round

Nice one Jooel, and even obvious if one sees it
No one took a look at mine so far to get rid of the goto for me \:\)


Sealeopard
(KiX Master)
2007-11-18 12:09 AM
Re: KiXgolf - Printer Queue - Public Round

Why did you put in a GOTO to begin with? Bad practice \:\)

LonkeroAdministrator
(KiX Master Guru)
2007-11-18 02:17 AM
Re: KiXgolf - Printer Queue - Public Round

Jochen's design can't be that easily improved.
would require some redoing... maybe kicking the array code and such, and then it wouldn't be the same thing anymore.
nonetheless, I like the goto \:\)
nice touch.


LonkeroAdministrator
(KiX Master Guru)
2007-11-18 03:32 AM
Re: KiXgolf - Printer Queue - Public Round

well, this might cause me to lose, but I don't wanna stop playing, even though everyone else has.
so, here is the new leader, 133:

Your solution passed all tests

KiXtart
KiXtart Version = 4.60 Beta 1
KiXGolf Script = kixgolf_pq.kix

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = Printer Queue
Processing Start = 2007/11/18 04:31:51.325
Processing End = 2007/11/18 04:31:52.997
Duration = 0000/00/00 00:00:01.671
KiXGolf Score = 133

 Code:
Function a($,$p)
Dim $c, $i
	While ~$p
		$a = $a + (x>$c)
		$p = $p - 1
		$c = 0+$
		$ = substr($,3)
		For $i=1 to 8
			If instr($,$c+$i)
				$  = $ + ! + $c
				$c=x
				if $p < 0 $p = ($^) / 2
EndFunction


AllenAdministrator
(KiX Supporter)
2007-11-18 03:44 AM
Re: KiXgolf - Printer Queue - Public Round

Would someone mind explaining this?

while ~$p

I know in places ~ works as -1, but if that were the case while -$p would work... so what is this doing that the "-" cant?


LonkeroAdministrator
(KiX Master Guru)
2007-11-18 03:52 AM
Re: KiXgolf - Printer Queue - Public Round

true false, dude.

anything else than -1 will result in something else than 0 with that line.

so, once $p is -1, the while exits.
I found it clever, even though I wasn't the only one who used it in private round :P


Sealeopard
(KiX Master)
2007-11-19 12:28 AM
Re: KiXgolf - Printer Queue - Public Round

Thank you for participating. Public round is now closed. Final results will be posted within one day.

The next and final KiXgolf of 2007 will run from 2007-12-07 to 2007-12-16. I can guarantee you you'll have to crack a coconut for this one. Oh, and if you want to prepare it wouldn't hurt to brush up on some Monty Python; though going to the circus would probably not help.

Oh, and plan for about one hour to just read the instructions and create a mental picture for the task, alcohol would probably help as well, so find a secluded spot to hide from the wife that weekend.


Gargoyle
(MM club member)
2007-11-19 02:17 AM
Re: KiXgolf - Printer Queue - Public Round

Not enough time to brew up a batch of strong scottish ale for that... Hmm will have to see what I have left from prior batches.

LonkeroAdministrator
(KiX Master Guru)
2007-11-19 08:10 AM
Re: KiXgolf - Printer Queue - Public Round

oh, hard one the last going to be is...

well, sadly we have christmas party on the start day, so most likely won't be the first to crack it.

but back to this one. I must wonder why ppl didn't improve on other's code.
maybe the reward of points and "publicity" is just not enough...


JochenAdministrator
(KiX Supporter)
2007-11-19 10:04 AM
Re: KiXgolf - Printer Queue - Public Round

So we can expect nothing but the spanish Inquisition ?
Oh, that Is from the circus.

Maybe we are asked to code half coconuts in order to ride for the holy grail? Maybe we soon code the counting after the pin of the holy handgrenade of Antioch has been pulled.. 1 .. 2 .. 5 ...errr 3!!!


Mart
(KiX Supporter)
2007-11-19 10:56 AM
Re: KiXgolf - Printer Queue - Public Round

So first we get this:
http://nl.youtube.com/watch?v=gldlyTjXk9A

When the private round, public round and the brain beating is done the smoke clears on the golf course and we get a cleanup:
http://nl.youtube.com/watch?v=grbSQ6O6kbs


JochenAdministrator
(KiX Supporter)
2007-11-20 10:05 AM
Re: KiXgolf - Printer Queue - Public Round

Yeah, cool!
This will be a weird round.

There is no official score yet for the last round, so before we continue to something completely different, can we have the score board updated ...
Jens?


Sealeopard
(KiX Master)
2007-11-21 04:16 AM
Re: KiXgolf - Printer Queue - Public Round

Final Results - Printer Queue

Private Round

Player Score Points
Jooel 138 5
DrillSergeant 139 4
Benny69 148 3
Allen 155 2
Jochen 161 1
Shawn 171 0
Gargoyle N/A 0

Public Round

Player Score Points
Jooel 133 5
DrillSergeant 136 4
Allen 145 3
Benny69 148 2
Jochen 149 1
Shawn 157 0
Gargoyle N/A 0

Memorable Moments

Allen: Jooel, you've got some really sick code. So sick in fact, that when I tried to change something, this really unusual sound started coming out of my tower. I swear I think it is the processor. Hit ctrl c and it quits. No lie.

Totals

Player Score Participation Private Public Grand
Private Public Bonus Bonus Points Points Totals
Jooel 138 133 1 1 5 5 12
DrillSergeant 139 136 1 1 4 4 10
Allen 155 145 1 1 2 3 7
Benny69 148 148 1 1 3 2 7
Jochen 161 149 1 1 1 1 4
Shawn 171 157 1 1 0 0 2
Gargoyle N/A N/A 0 1 0 0 1

  • 1 Point for each participant that posts a KiXgolf script during the public coding round (must be either a new solution or an improvement to an existing solution)
  • x Points for 1st to 5th place in either the private or public round in reverse order, thus 1st Place = 5 points down to 5th Place = 1 Point
  • 1 Point for all participants in the private coding round (results posted in private round and valid script posted in public round)



JochenAdministrator
(KiX Supporter)
2007-11-21 08:42 AM
Re: KiXgolf - Printer Queue - Public Round

Bah,

third in Tournament.. Hopefully Jooel is busy and Rogier is on vacation during the last task


DrillSergeant
(MM club member)
2007-11-21 09:44 AM
Re: KiXgolf - Printer Queue - Public Round

Not that it matters for the points, but the 136 can also be creditted to Jooel. We had a chat on MSN just before we posted our code, and he pointed out to me (very gleefully ;\) ) that $c = val($) is the same as $c = 0+$.

So my official lowest score should be 139, but as I said it doesn't have an impact on the scoring.

If I had found out in the private round, I would have had the leading score... Oh, well... live and learn


DrillSergeant
(MM club member)
2007-11-21 09:49 AM
Re: KiXgolf - Printer Queue - Public Round

 Originally Posted By: Jochen
Bah,

third in Tournament.. Hopefully Jooel is busy and Rogier is on vacation during the last task


If I can get Kix to work on my Windows Mobile PDA, I'll be golfing 24/7 where-ever I am \:\)