Page 1 of 1 1
Topic Options
#191435 - 2008-12-27 04:05 PM KiXgolf: Latin Squares
Sealeopard Offline
KiX Master
*****

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


The Sudoku numbers puzzles are a special form of Latin Squares. However, instead of the traditional 9x9 grid with 3x3 regions, we will focus on the simpler 4x4 grid with 2x2 regions.

The rules are simple: fill in the blanks in the grid, as marked by 'x', with the correct numbers such that each row, each column and the four 2x2 regions all contain the numbers 1-4. An example is given below, both the initial puzzle, and the final solution, the intermediate steps have been omitted:
 Code:
@-----@
|xx|x1|
|xx|23|
|--+--|
|41|32|
|32|14|
@-----@

@-----@
|23|41|
|14|23|
|--+--|
|41|32|
|32|14|
@-----@



A download is available at http://s91376351.onlinehome.us/kixtart/kixgolf_ls.zip


=============
Inputs & Outputs
=============


The input is a 4x4 [x,y]-array pre-filled with the numbers 1-4 or 'x' as a placeholder for an unknown number.

The output must be a [x,y,z]-array where z represents the steps of (partially) filled out grids leading to the final solution such that z=0 is the initial puzzle and z=MAX(z) is the final solved puzzle.

The solution tester will a) check that the UDF returns an array, b) that the correct number of turns (z) are being returned, and c) compare the solution against the solution provided in the .INI file.


=======
Scoring
=======



The solution must pass all tests in order for it's KiXgolf Score to be considered.

When posting KiXtart Golf Scores, please include the KIXGOLF_*.TXT file that is created in the script directory. It contains some basic information about the computer that the script is run on and the resulting scores.

============
Test program
============


Test cases are provided to help screen entries and to provide the Golf Score.
Any script that passes the test cases can be submitted. If you are surprised that your solution passed the test cases, please submit it anyway! That will help me identify bugs in the test program.

================================================================
KiXtart GOLF - How To Play
================================================================


Most importantly, anybody can play, no age restrictions, no penalties, no handicap!

The object in "real" golf is to hit the ball in the hole in the fewest strokes. The object in KiXtart Golf is to get from input (tee) to target (hole) in the fewest keystrokes.

Example: How many positive elements are in array $a?

Array $a could be of structure $a=[1, 2 ,-3, 4, -5, -7, 8, 9]

One approach:
 Code:
for $b=0 to ubound($a)
  if $a[$b]>0
    $c=$c+1
  endif
next

for a score of 45.

Another solution is:
 Code:
DO
  $b=$b+1
  if $a[$b]>0
    $c=$c+1
  endif
UNTIL $b>(UBOUND($a)+1)

for a score of 53.

Better approach: Code sample 1

================================================================
KiXtart GOLF - The Rules
================================================================


1) The goal of KiXtart Golf is to score the lowest strokes.
2) Strokes are all characters in a piece of code except whitespace characters, unless the whitespace character is necessary for the line of code to work. Therefore, carriage returns and line feeds do not count or spaces in between the '=' sign when assigning variables, e.g. '$a = $b' scores 5.
3) Code can be constructed any way you like, as long as it does not generate syntax or other errors when running the script in KiXtart.
4) The final solution MUST pass all test scripts that are part of the KiXtart golf challenge.
7) During the private coding phase, no code is allowed to be posted. Violations result in disqualification of said player.
8) During the public coding phase, code should be posted, reused, and borrowed from other players.
9) The test script contains the official KiXgolf scoring engine
10) Only the person posting a particular score will be recognized for the score, unless the KiXtart Golf Challenge organizer or another delegate posts code on behalf of a player
11) KiXtart Golf (a.k.a KiXgolf) codes must be written inside the KiXgolf UDF collection tags, ';!' and ';!;!'
12) Parameter names of the UDF's can be changed and additional optional parameters can be added.
13) Additional helper UDFs and code can be written as long as they reside inside the ';!' and ';!;!' tags.
14) The use of '$' as a variable is allowed.
15) The UDF layout is up to coder.
16) The UDF is expected to finish in a reasonable time, that is, on modern computers inside 1 hour timeframe.
17) You can submit scores as often as you want.
18) If you reach leading score, you are obligated to post your score immediately so others can try to compete with you.
19) The UDF may only use the KiXtart/KiXforms commands/functions/macros, no other code fragments are allowed.
20) Calls to COM components that are part of a standard default Windows installation are allowed.
21) The use of the KiXforms DLL is also permitted as the KiXforms DLL can now be considered an integral part of KiXtart scripting.
22) Calls to other executables, as long as they are part of a standard default Windows installation are allowed.
23) The UDF should be self-contained (except for any I/O mentioned in the challenge). In particular, you may not do things like fetching extra data from a remote site or file.
24) You may assume ASCII as character set.
25) You may use block comments as the KiXgolf Scoring Engine now supports block comments.
26) You are allowed to only use publicly available versions of KiXtart and KiXforms, private builds or alpha builds are NOT allowed.
27) Your submitted score must include the result print of the KiXgolf test-engine.
28) The SETOPTION() parameters in the KiXgolf script may not be modified and will govern the script behavior. SETOPTION() parameters may change depending on the particular needs of the KiXgolf challenge.
29) Tokenizing the UDF, script, or portions thereof is not allowed.
30) If something is not explicitly denied by the rules, it's allowed.
31) If Confusion arises, arranger of the KiXgolf round has the final say.
32) Additional test cases can be added at any time during the KiXgolf round. The code is expected to pass based on the rules. The test cases may not include tests for all rules and exceptions. Test cases that are added during the public round will not alter the results of the private round.


================================================================
KiXtart GOLF - The Duration of the Competition
================================================================


1) Private coding phase: 2008-12-27 to 2009-01-02

2) Public coding phase: 2009-01-03 to 2009-01-09

3) Final results: 2009-01-10

You will need the complete package from http://s91376351.onlinehome.us/kixtart/kixgolf_ls.zip.
_________________________
There are two types of vessels, submarines and targets.

Top
#191447 - 2008-12-28 02:47 AM Re: KiXgolf: Latin Squares [Re: Sealeopard]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
There has been a question regarding the correct output for the UDF. The output is supposed to be a three-dimensional array [x,y,z] where the [x,y] dimension are the initial puzzle, intermediate steps, or final solution. The [z] dimension represents the steps taken to get from the initial puzzle to the final solution.

Below is a sample UDF that generates such an array with the solution for the first test, though the steps/solution is hard-coded and works for the first test ony. Additionally, there is commented out code in the scoring engine labeled "display the results" that then prints the array such that you can see how one got from the initial puzzle to the final solution. Just uncomment that section to see your output displayed.

 Code:
; begin KiXgolf UDF
;
;!
Function S($)
  dim $a[3,3,5], $sInput, $ix, $iy

  for $iy=0 to 3
    for $ix=0 to 3
      $a[$ix,$iy,0] = $[$ix,$iy]
    next
  next

  $sInput = 'xx41|xx23|4132|3214'
  for $iy=0 to 3
    for $ix=0 to 3
      $a[$ix,$iy,1] = substr($sInput, $iy*5 + $ix + 1, 1)
    next
  next

  $sInput = 'x341|xx23|4132|3214'
  for $iy=0 to 3
    for $ix=0 to 3
      $a[$ix,$iy,2] = substr($sInput, $iy*5 + $ix + 1, 1)
    next
  next

  $sInput = '2341|xx23|4132|3214'
  for $iy=0 to 3
    for $ix=0 to 3
      $a[$ix,$iy,3] = substr($sInput, $iy*5 + $ix + 1, 1)
    next
  next

  $sInput = '2341|x423|4132|3214'
  for $iy=0 to 3
    for $ix=0 to 3
      $a[$ix,$iy,4] = substr($sInput, $iy*5 + $ix + 1, 1)
    next
  next

  $sInput = '2341|1423|4132|3214'
  for $iy=0 to 3
    for $ix=0 to 3
      $a[$ix,$iy,5] = substr($sInput, $iy*5 + $ix + 1, 1)
    next
  next

  $S = $a

EndFunction
;!
;!
; end KiXgolf UDF
_________________________
There are two types of vessels, submarines and targets.

Top
#191449 - 2008-12-28 04:51 AM Re: KiXgolf: Latin Squares [Re: Sealeopard]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
Hole 18... Teeing off \:D

 Code:
Running Test 01...Done...passed
Running Test 02...Done...passed
Running Test 03...Done...passed
Running Test 04...Done...passed
Running Test 05...Done...passed
Running Test 06...Done...passed
Running Test 07...Done...passed
Running Test 08...Done...passed
Running Test 09...Done...passed
Running Test 10...Done...passed
Your solution passed all tests

KiXtart
KiXtart Version  = 4.60
KiXGolf Script   = kixgolf_ls.KIX

Computer
OS               = Windows Vista Ultimate Edition
CPU              = Intel Pentium Model 14
Speed            = 1733 MHz
Memory           = 2038 MB

KiXGolf Scoring Engine
Scoring Engine   = 3.3

KiXtart Golf Score
Tournament       = Latin Squares
Processing Start = 2008/12/28 04:50:58.058
Processing End   = 2008/12/28 04:50:58.187
Duration         = 0000/00/00 00:00:00.129
KiXGolf Score    = 438

Thank you for participating in KiXtart Golf!
_________________________
The Code is out there

Top
#191450 - 2008-12-28 05:17 AM Re: KiXgolf: Latin Squares [Re: DrillSergeant]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
 Code:
Running Test 01...Done...passed
Running Test 02...Done...passed
Running Test 03...Done...passed
Running Test 04...Done...passed
Running Test 05...Done...passed
Running Test 06...Done...passed
Running Test 07...Done...passed
Running Test 08...Done...passed
Running Test 09...Done...passed
Running Test 10...Done...passed
Your solution passed all tests

KiXtart
KiXtart Version  = 4.60
KiXGolf Script   = kixgolf_ls.KIX

Computer
OS               = Windows Vista Ultimate Edition
CPU              = Intel Pentium Model 14
Speed            = 1733 MHz
Memory           = 2038 MB

KiXGolf Scoring Engine
Scoring Engine   = 3.3

KiXtart Golf Score
Tournament       = Latin Squares
Processing Start = 2008/12/28 05:16:45.742
Processing End   = 2008/12/28 05:16:45.923
Duration         = 0000/00/00 00:00:00.181
KiXGolf Score    = 435

Thank you for participating in KiXtart Golf!
_________________________
The Code is out there

Top
#191451 - 2008-12-28 05:28 AM Re: KiXgolf: Latin Squares [Re: DrillSergeant]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
 Code:
Running Test 01...Done...passed
Running Test 02...Done...passed
Running Test 03...Done...passed
Running Test 04...Done...passed
Running Test 05...Done...passed
Running Test 06...Done...passed
Running Test 07...Done...passed
Running Test 08...Done...passed
Running Test 09...Done...passed
Running Test 10...Done...passed
Your solution passed all tests

KiXtart
KiXtart Version  = 4.60
KiXGolf Script   = kixgolf_ls.KIX

Computer
OS               = Windows Vista Ultimate Edition
CPU              = Intel Pentium Model 14
Speed            = 1733 MHz
Memory           = 2038 MB

KiXGolf Scoring Engine
Scoring Engine   = 3.3

KiXtart Golf Score
Tournament       = Latin Squares
Processing Start = 2008/12/28 05:27:19.570
Processing End   = 2008/12/28 05:27:19.837
Duration         = 0000/00/00 00:00:00.266
KiXGolf Score    = 429

Thank you for participating in KiXtart Golf!
_________________________
The Code is out there

Top
#191452 - 2008-12-28 05:57 AM Re: KiXgolf: Latin Squares [Re: DrillSergeant]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
I'd like to add a testcase where every line has only one filled variable.

 Code:
[Test 11]
Puzzle=1xxx|xxx2|xx3x|xxx4
Solution=1243|4312|2431|3124
_________________________
The Code is out there

Top
#191455 - 2008-12-28 03:49 PM Re: KiXgolf: Latin Squares [Re: DrillSergeant]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
 Code:
Running Test 01...Done...passed
Running Test 02...Done...passed
Running Test 03...Done...passed
Running Test 04...Done...passed
Running Test 05...Done...passed
Running Test 06...Done...passed
Running Test 07...Done...passed
Running Test 08...Done...passed
Running Test 09...Done...passed
Running Test 10...Done...passed
Running Test 11...Done...passed
Your solution passed all tests

KiXtart
KiXtart Version  = 4.60
KiXGolf Script   = kixgolf_ls.KIX

Computer
OS               = Windows Vista Ultimate Edition
CPU              = Intel Pentium Model 14
Speed            = 1733 MHz
Memory           = 2038 MB

KiXGolf Scoring Engine
Scoring Engine   = 3.3

KiXtart Golf Score
Tournament       = Latin Squares
Processing Start = 2008/12/28 15:48:39.698
Processing End   = 2008/12/28 15:48:39.938
Duration         = 0000/00/00 00:00:00.240
KiXGolf Score    = 405

Thank you for participating in KiXtart Golf!
_________________________
The Code is out there

Top
#191563 - 2009-01-03 02:17 PM Re: KiXgolf: Latin Squares [Re: DrillSergeant]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
The private round of KiXgolf: Latin Squares is now closed. Please post your code in the public round thread at http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=191564 .

Edited by Sealeopard (2009-01-03 02:19 PM)
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

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

Generated in 0.06 seconds in which 0.025 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