Page 2 of 2 <12
Topic Options
#191652 - 2009-01-06 01:13 AM Re: KiXgolf: Latin Squares - public round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and once again, the simplest answer...
I never tried that before as I didn't think it was worth it.

go figure.
_________________________
!

download KiXnet

Top
#191653 - 2009-01-06 01:16 AM Re: KiXgolf: Latin Squares - public round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

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

 Code:
; begin KiXgolfUDF
;
;!
Function S($o)
  Dim $i, $, $k, $t, $x, $v, $p
  
  For $x = 0 to 16
    ReDim $r[3], $c[3], $q[3], $s[3, 3, $x]
    
    For $ = 0 to 7
      For $i = 0 to 3
        $v = $o[$ mod 4, $i]
        $k = 3-2*($ mod 4 <2)-($i<2)
        If $ < 4
          $r[$i] = $r[$i] + $v
          $c[$] = $c[$] + $v
          $q[$k] = $q[$k] + $v
          $s[$, $i, $x] = $v
        Else
          If 0 > AScan($r,x,,,1)
            Exit
          Else
            $p = @
            For $t = 1 to 4
              If 0 = InStr($c[$-4]+$r[$i]+$q[$k],$t) + $v
                $p = $p + $t
              EndIf
            Next
    
            If 1=($p^)
              $o[$-4,$i] = $p
              $ = 7
              $i = 3
EndFunction

;!
;!
; end KiXgolfUDF
_________________________
!

download KiXnet

Top
#191654 - 2009-01-06 01:16 AM Re: KiXgolf: Latin Squares - public round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
huh...
almost gave someone another present.
_________________________
!

download KiXnet

Top
#191657 - 2009-01-06 02:02 AM Re: KiXgolf: Latin Squares - public round [Re: Lonkero]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Dang! I was looking at that but just could not see it!
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#191658 - 2009-01-06 02:30 AM Re: KiXgolf: Latin Squares - public round [Re: Benny69]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yeah. now it went the right way ;\)
_________________________
!

download KiXnet

Top
#191659 - 2009-01-06 03:02 AM Re: KiXgolf: Latin Squares - public round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
to be fair...
I was playing with that long expression line before for hours.
I have no idea, why I didn't try this approach any sooner.
_________________________
!

download KiXnet

Top
#191693 - 2009-01-07 03:19 PM Re: KiXgolf: Latin Squares - public round [Re: Lonkero]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
Let's continue...338 \:D

 Code:
Your solution passed all tests

KiXtart
KiXtart Version  = 4.60
KiXGolf Script   = kixgolf_ls.KIX

Computer
OS               = Windows XP Professional
CPU              = Intel(R) Pentium(R) D CPU 2.80GHz
Speed            = 2793 MHz
Memory           = 1008 MB

KiXGolf Scoring Engine
Scoring Engine   = 3.3

KiXtart Golf Score
Tournament       = Latin Squares
Processing Start = 2009/01/07 15:16:38.304
Processing End   = 2009/01/07 15:16:38.508
Duration         = 0000/00/00 00:00:00.204
KiXGolf Score    = 338

Thank you for participating in KiXtart Golf!


 Code:
; begin KiXgolfUDF
;
;!
Function S($o)
  Dim $i, $, $k, $t, $x, $v, $p
  
  For $x = 0 to 16
    ReDim $s[3, 3, $x], $r[11]
    
    For $ = 0 to 7
      For $i = 0 to 3
        $v = $o[$ mod 4, $i]
        $k = 3-2*($ mod 4 <2)-($i<2)
        If $ < 4
          $r[$i] = $r[$i] + $v
          $r[4+$] = $r[4+$] + $v
          $r[8+$k] = $r[8+$k] + $v
          $s[$, $i, $x] = $v
        Else
          If 0 > AScan($r,x,,,1)
            Exit
          Else
            $p = @
            For $t = 1 to 4
              If 0 = InStr($r[$]+$r[$i]+$r[8+$k],$t) + $v
                $p = $p + $t
              EndIf
            Next
    
            If 1=($p^)
              $o[$-4,$i] = $p
              $ = 7
              $i = 3
EndFunction

;!
;!
; end KiXgolfUDF
_________________________
The Code is out there

Top
#191694 - 2009-01-07 03:22 PM Re: KiXgolf: Latin Squares - public round [Re: DrillSergeant]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
333
 Code:
;begin KiXgolfUDF
;
;!
Function S($o)
  Dim $i, $, $k, $t, $x, $v, $p
  
  For $x = 0 to 16
    ReDim $s[3, 3, $x], $r[11]
    
    For $ = 0 to 7
      For $i = 0 to 3
        $v = $o[$ mod 4, $i]
        $k = 11-2*($ mod 4 <2)-($i<2)
        If $ < 4
          $r[$i] = $r[$i] + $v
          $r[4+$] = $r[4+$] + $v
          $r[$k] = $r[$k] + $v
          $s[$, $i, $x] = $v
        Else
          If 0 > AScan($r,x,,,1)
            Exit
          Else
            $p = @
            For $t = 1 to 4
              If 0 = InStr($r[$]+$r[$i]+$r[$k],$t) + $v
                $p = $p + $t
              EndIf
            Next
    
            If 1=($p^)
              $o[$-4,$i] = $p
              $ = 7
              $i = 3
EndFunction

;!
;!
; end KiXgolfUDF
_________________________
The Code is out there

Top
#191697 - 2009-01-07 04:30 PM Re: KiXgolf: Latin Squares - public round [Re: DrillSergeant]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Dang! I am just too slow, I have been looking at those vars for 2 days trying to come up with a way to reduce them, you Dawg! ;\)
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#191698 - 2009-01-07 05:22 PM Re: KiXgolf: Latin Squares - public round [Re: Benny69]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
I was trying to completely rewrite the function to solve it another way. The rewrite didn't work but this was a byproduct
_________________________
The Code is out there

Top
#191699 - 2009-01-07 06:27 PM Re: KiXgolf: Latin Squares - public round [Re: DrillSergeant]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
grr...
now I need to start coding again.
_________________________
!

download KiXnet

Top
#191702 - 2009-01-07 07:15 PM Re: KiXgolf: Latin Squares - public round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
not that easy to cut anymore...
_________________________
!

download KiXnet

Top
#191711 - 2009-01-07 10:53 PM Re: KiXgolf: Latin Squares - public round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
YEHAA!

332!

 Code:
Function S($o)
  Dim $i, $, $k, $t, $x, $v, $p,$r
  
  For $x = 0 to 16
    If instr(join($),x) | $x=0
    ReDim $s[3, 3, $x],	$[11]
    
    For $r = 0 to 7
      For $i = 0 to 3
        $v = $o[$r mod 4, $i]
        $k = 11-2*($r mod 4 <2)-($i<2)
        If $r < 4
          $[$i] = $[$i] + $v
          $[4+$r] = $[4+$r] + $v
          $[$k] = $[$k] + $v
          $s[$r, $i, $x] = $v
        Else
            $p = @
            For $t = 1 to 4
              If 0 = InStr($[$r]+$[$i]+$[$k],$t) + $v
                $p = $p + $t
              EndIf
            Next
    
            If 1=($p^)
              $o[$r-4,$i] = $p
              $r = 7
              $i = 3
EndFunction


that move of the x-check doesn't benefit. I just hated seeing that darn exit command in there \:\)
_________________________
!

download KiXnet

Top
#191715 - 2009-01-07 11:03 PM Re: KiXgolf: Latin Squares - public round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, I quess it did help, as it allowed me to save the stroke, but originally, it didn't...
_________________________
!

download KiXnet

Top
#191716 - 2009-01-08 12:21 AM Re: KiXgolf: Latin Squares - public round [Re: Lonkero]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
Very nice on the removal of the exit statement, jooel! It bothered me too, but I couldn't find a way around it.

I'm leaving for Aarhus, Denmark for a couple of days in about 8 hours, so I don't have any time to golf it down any more, so, again, this battle is yours... but do you know how the saying 'you don't have to win every battle to win the war'? ;\)
_________________________
The Code is out there

Top
#191721 - 2009-01-08 11:02 AM Re: KiXgolf: Latin Squares - public round [Re: DrillSergeant]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
lol.
on the other hand, you can win every battle you take part in, but still loose the war ;\)
_________________________
!

download KiXnet

Top
#191747 - 2009-01-10 05:32 AM Re: KiXgolf: Latin Squares - public round [Re: Lonkero]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA

Private Round

Player

Score

Points

DrillSergeant

405

5

Public Round

Player

Score

Points

Lonkero

332

5

DrillSergeant 333

4

Benny69 348

3

Totals

Player

Score

Participation

Private

Public

Grand

Private

Public

Bonus

Bonus

Points

Points

Totals

DrillSergeant

405 333 1 1 5 4 11
Lonkero

N/A

332 1 0 0 5 6
Benny69 N/A 348 1 0 0 3 4
  • 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)
_________________________
There are two types of vessels, submarines and targets.

Top
Page 2 of 2 <12


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

Who's Online
0 registered and 492 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.073 seconds in which 0.026 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