Page 2 of 3 <123>
Topic Options
#182682 - 2007-11-15 03:41 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
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.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#182683 - 2007-11-15 05:04 AM Re: KiXgolf - Printer Queue - Public Round [Re: Gargoyle]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
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
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#182684 - 2007-11-15 06:39 AM Re: KiXgolf - Printer Queue - Public Round [Re: Benny69]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
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

Top
#182685 - 2007-11-15 06:53 AM Re: KiXgolf - Printer Queue - Public Round [Re: Allen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
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

Top
#182686 - 2007-11-15 07:19 AM Re: KiXgolf - Printer Queue - Public Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
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!

_________________________



Top
#182687 - 2007-11-15 08:54 AM Re: KiXgolf - Printer Queue - Public Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
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)


Edited by Jochen (2007-11-15 09:49 AM)
_________________________



Top
#182735 - 2007-11-16 01:26 PM Re: KiXgolf - Printer Queue - Public Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
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!

_________________________



Top
#182737 - 2007-11-16 02:10 PM Re: KiXgolf - Printer Queue - Public Round [Re: Jochen]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Nice one J
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#182745 - 2007-11-16 06:26 PM Re: KiXgolf - Printer Queue - Public Round [Re: Benny69]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Thanx,

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



Top
#182746 - 2007-11-16 08:52 PM Re: KiXgolf - Printer Queue - Public Round [Re: Jochen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I can see one...
but can't test&post on this machine.
_________________________
!

download KiXnet

Top
#182747 - 2007-11-16 08:57 PM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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...
_________________________
!

download KiXnet

Top
#182749 - 2007-11-16 09:57 PM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
I hadn't even noticed this little change.... gahhh! Dumb me.

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

Top
#182754 - 2007-11-16 11:31 PM Re: KiXgolf - Printer Queue - Public Round [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, if it comforts you, I didn't see that either \:\)
wasn't really looking either, though...
_________________________
!

download KiXnet

Top
#182756 - 2007-11-17 12:49 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Jooel you Dawg! Your like one of the Savants,...
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#182760 - 2007-11-17 08:33 PM Re: KiXgolf - Printer Queue - Public Round [Re: Benny69]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
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 \:\)


Edited by Jochen (2007-11-17 08:33 PM)
_________________________



Top
#182764 - 2007-11-18 12:09 AM Re: KiXgolf - Printer Queue - Public Round [Re: Jochen]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Why did you put in a GOTO to begin with? Bad practice \:\)
_________________________
There are two types of vessels, submarines and targets.

Top
#182765 - 2007-11-18 02:17 AM Re: KiXgolf - Printer Queue - Public Round [Re: Sealeopard]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#182766 - 2007-11-18 03:32 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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
_________________________
!

download KiXnet

Top
#182767 - 2007-11-18 03:44 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
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?

Top
#182768 - 2007-11-18 03:52 AM Re: KiXgolf - Printer Queue - Public Round [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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
_________________________
!

download KiXnet

Top
Page 2 of 3 <123>


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.076 seconds in which 0.026 seconds were spent on a total of 14 queries. Zlib compression enabled.

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