Page 1 of 3 123>
Topic Options
#182661 - 2007-11-15 12:39 AM KiXgolf - Printer Queue - Public Round
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
Gentlemen, post your codes and let the public battle begin!
_________________________
!

download KiXnet

Top
#182662 - 2007-11-15 12:40 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK

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
_________________________
!

download KiXnet

Top
#182663 - 2007-11-15 12:44 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
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
_________________________
The Code is out there

Top
#182664 - 2007-11-15 12:53 AM Re: KiXgolf - Printer Queue - Public Round [Re: DrillSergeant]
Lonkero Administrator Offline
KiX Master Guru
*****

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

download KiXnet

Top
#182665 - 2007-11-15 01:08 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
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

Top
#182666 - 2007-11-15 01:13 AM Re: KiXgolf - Printer Queue - Public Round [Re: Shawn]
Allen Administrator Offline
KiX Supporter
*****

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

Top
#182667 - 2007-11-15 01:13 AM Re: KiXgolf - Printer Queue - Public Round [Re: Shawn]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
you got the return to work?
failed for me always... dunno why...
_________________________
!

download KiXnet

Top
#182668 - 2007-11-15 01:14 AM Re: KiXgolf - Printer Queue - Public Round [Re: Allen]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Nice, Allen wins "the fewest dims" ! (so far)
Top
#182669 - 2007-11-15 01:15 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
same with you.
didn't wonder, why it works with WHILE but not with DO?
_________________________
!

download KiXnet

Top
#182670 - 2007-11-15 01:18 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I wondered that yes. Maybe because UNTIL takes a parm ?

What you saying about RETURN ?

Top
#182671 - 2007-11-15 01:20 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

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

download KiXnet

Top
#182672 - 2007-11-15 01:20 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
HEY!
my code had only 1 dim as well!
_________________________
!

download KiXnet

Top
#182673 - 2007-11-15 01:22 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
ah k your right - saw you second code not the first one. my boo.
Top
#182674 - 2007-11-15 01:36 AM Re: KiXgolf - Printer Queue - Public Round [Re: Shawn]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4531
Loc: USA
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.
Top
#182675 - 2007-11-15 01:37 AM Re: KiXgolf - Printer Queue - Public Round [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
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???


Edited by Lonkero (2007-11-15 01:41 AM)
_________________________
!

download KiXnet

Top
#182676 - 2007-11-15 01:39 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4531
Loc: USA
split($)[$p] = value of the position
Top
#182677 - 2007-11-15 01:43 AM Re: KiXgolf - Printer Queue - Public Round [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

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

download KiXnet

Top
#182678 - 2007-11-15 01:44 AM Re: KiXgolf - Printer Queue - Public Round [Re: Lonkero]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4531
Loc: USA
hmmm... you've got a point (I think)... looking
Top
#182679 - 2007-11-15 01:54 AM Re: KiXgolf - Printer Queue - Public Round [Re: Allen]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11163
Loc: Boston, MA, USA
Jooel: Thanks for opening up the public round.

Some nice code out there.
_________________________
There are two types of vessels, submarines and targets.

Top
#182680 - 2007-11-15 01:56 AM Re: KiXgolf - Printer Queue - Public Round [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

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


Edited by Lonkero (2007-11-15 01:57 AM)
_________________________
!

download KiXnet

Top
Page 1 of 3 123>


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

Who's Online
0 registered and 310 anonymous users online.
Newest Members
Kelly001, MichaelK72, Janneman, standardbruker, maikoenig2001
17773 Registered Users

Generated in 0.046 seconds in which 0.013 seconds were spent on a total of 15 queries. Zlib compression enabled.

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