Page 1 of 7 12345>Last »
Topic Options
#201971 - 2011-05-01 05:09 PM Kixgolf - Four Is Magic - Private Round
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4518
Loc: USA
=============
The Challenge - Four is Magic
=============


A popular puzzle Teachers use to make students think about numbers is called "Four is Magic".

The puzzle would go something like this. The teacher would ask the students to give him a number. Upon
hearing the number, the teacher would do some sort of transformation on it repeatedly, until arriving at
the number four, at which point the teacher would proclaim "four is magic". The challenge for the students
was to figure out how every number they gave the teacher always equaled four.

For Example, the students gave the number 25, the teacher would say:
25 is 10. 10 is 3. 3 is 5. 5 is 4. 4 is magic.

The solution to the puzzle was to take the number in question and count the number of letters in the word(in
English, ignoring spaces and hypens"). Upon getting this number, repeat on the next number, until the number of letters equals 4.

So using the example above:
25 has 10 letters.
10 has 3 letters.
3 has 5 letters.
5 has 4 letters.
4 is magic.


A download is available at http://www.kixtart.org/forums/ubbthreads.php?ubb=download&Number=225

=============
Specification
=============


Given a number(in words or a number), determine the transformation, and proclaim "4/Four is Magic".

There is one exception rule. When the input is only "4" or "four", there is no transformation. Just simply proclaim
4 is magic. or four is magic.


=============
Inputs and Outputs
=============


The input consists of either a number(0-99) or a string representing a number(zero - ninety nine).

If the input is a number (0-99), the output is in the format of:
25 is 10. 10 is 3. 3 is 5. 5 is 4. 4 is magic.

If the input is a string (zero through ninety nine), and the input numbers have spaces, the output is in
the format of: twenty five is ten. ten is three. three is five. five is four. four is magic.

If the input is string (zero through ninety-nine), and the input numbers have hyphens, the output is in
the format of: twenty-five is ten. ten is three. three is five. five is four. four is magic.

** When counting number of letters, ignore spaces or hypens. **



=================================================================
Notes
================================================================

- The scoring engine has added code to help diagnose which cases are failing. To see test case results:
 Code:
   kix32 kixgolf_fim $verbose=1 ;shows failing results
   kix32 kixgolf_fim $verbose=2 ;shows all results

- The scoring engine expects your (primary) function to be named a().


=======
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: 2011-05-01 to 2011-05-08 (Official Count down clock will determine end time)

2) Public coding phase: 2011-05-08 to 2010-05-15

3) Final results: 2011-08-16


*--> You will need the complete package from http://www.kixtart.org/forums/ubbthreads.php?ubb=download&Number=225.


Attachments
kixgolf_fim.zip (264 downloads)
Description:



Top
#201972 - 2011-05-01 05:12 PM Re: Kixgolf - Four Is Magic - Private Round [Re: Allen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4518
Loc: USA

Top
#201973 - 2011-05-01 05:14 PM Re: Kixgolf - Four Is Magic - Private Round [Re: Allen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4518
Loc: USA
I had some work to do this afternoon, so I started it a little early. Hope you enjoy.
Top
#201974 - 2011-05-01 05:34 PM Re: Kixgolf - Four Is Magic - Private Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Hey,
your countdownclock still has 26 minutes left

btw. nice problem Allen.


Edited by Jochen (2011-05-01 05:38 PM)
_________________________



Top
#201975 - 2011-05-01 07:28 PM Re: Kixgolf - Four Is Magic - Private Round [Re: Jochen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
woot? text input? wtf! does not compute...
_________________________
!

download KiXnet

Top
#201976 - 2011-05-01 07:38 PM Re: Kixgolf - Four Is Magic - Private Round [Re: Lonkero]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4518
Loc: USA
lol... okay... string is what I meant. fixed. \:\)
Top
#201977 - 2011-05-01 07:39 PM Re: Kixgolf - Four Is Magic - Private Round [Re: Lonkero]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
hehe, thats what I thought too ..

here are my first miserable steps:

 Code:
KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_fim.kix
Scoring Engine   = 3.3
OS               = Windows 7 Professional Edition
CPU              = Intel Pentium III
Speed            = 2669 MHz
Memory           = 4096 MB

Tournament       = Four Is Magic
Processing Start = 2011/05/01 19:37:27.420
Processing End   = 2011/05/01 19:37:27.670
Duration         = 0000/00/00 00:00:00.250
# Tests Run      = 200
# Tests Passed   = 54
# Tests Failed   = 146
Result           = failed
KiXGolf Score    = 409

Thank you for participating in KiXtart Golf!
Press any key to continue...


nB.: someone stolen my Q8400 and replaced it with a P III ???
_________________________



Top
#201978 - 2011-05-01 07:45 PM Re: Kixgolf - Four Is Magic - Private Round [Re: Jochen]
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
this should be interesting...
_________________________
Eric

Top
#201979 - 2011-05-01 08:06 PM Re: Kixgolf - Four Is Magic - Private Round [Re: maciep]
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
getting there

 Code:
KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_fim.kix
Scoring Engine   = 3.3
OS               = Windows 7 Home Premium Edition
CPU              = AMD Turion(tm) II P540 Dual-Core Processor
Speed            = 2394 MHz
Memory           = 4096 MB

Tournament       = Four Is Magic
Processing Start = 2011/05/01 14:05:40.719
Processing End   = 2011/05/01 14:05:40.760
Duration         = 0000/00/00 00:00:00.041
# Tests Run      = 200
# Tests Passed   = 92
# Tests Failed   = 108
Result           = failed
KiXGolf Score    = 249
_________________________
Eric

Top
#201980 - 2011-05-01 08:13 PM Re: Kixgolf - Four Is Magic - Private Round [Re: maciep]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
I can handle actually the input but output being readable english? that's just wicked and will hock my score BAD.
_________________________
!

download KiXnet

Top
#201981 - 2011-05-01 08:13 PM Re: Kixgolf - Four Is Magic - Private Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
well, whining done. I better see if I can wrap this up today.
_________________________
!

download KiXnet

Top
#201982 - 2011-05-01 08:50 PM Re: Kixgolf - Four Is Magic - Private Round [Re: Lonkero]
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
It's ugly, but it's working

 Code:
KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_fim.kix
Scoring Engine   = 3.3
OS               = Windows 7 Home Premium Edition
CPU              = AMD Turion(tm) II P540 Dual-Core Processor
Speed            = 2394 MHz
Memory           = 4096 MB

Tournament       = Four Is Magic
Processing Start = 2011/05/01 14:49:15.274
Processing End   = 2011/05/01 14:49:15.828
Duration         = 0000/00/00 00:00:00.554
# Tests Run      = 200
# Tests Passed   = 200
# Tests Failed   = 
Result           = passed
KiXGolf Score    = 525

Thank you for participating in KiXtart Golf!
_________________________
Eric

Top
#201983 - 2011-05-01 09:09 PM Re: Kixgolf - Four Is Magic - Private Round [Re: maciep]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Nice tee off Eric, here's my actual:


KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_fim.kix
Scoring Engine   = 3.3
OS               = Windows 7 Professional Edition
CPU              = Intel Pentium III
Speed            = 2669 MHz
Memory           = 4096 MB

Tournament       = Four Is Magic
Processing Start = 2011/05/01 21:06:20.256
Processing End   = 2011/05/01 21:06:20.318
Duration         = 0000/00/00 00:00:00.062
# Tests Run      = 200
# Tests Passed   = 199
# Tests Failed   = 1
Result           = failed
KiXGolf Score    = 507

Thank you for participating in KiXtart Golf!
Press any key to continue...

_________________________



Top
#201984 - 2011-05-01 09:39 PM Re: Kixgolf - Four Is Magic - Private Round [Re: Jochen]
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
Thanks, Jochen! Slashed a few more strokes, good enough for day 1

 Code:
KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_fim.kix
Scoring Engine   = 3.3
OS               = Windows 7 Home Premium Edition
CPU              = AMD Turion(tm) II P540 Dual-Core Processor
Speed            = 2394 MHz
Memory           = 4096 MB

Tournament       = Four Is Magic
Processing Start = 2011/05/01 15:36:44.236
Processing End   = 2011/05/01 15:36:44.297
Duration         = 0000/00/00 00:00:00.061
# Tests Run      = 200
# Tests Passed   = 200
# Tests Failed   =
Result           = passed
KiXGolf Score    = 402
_________________________
Eric

Top
#201985 - 2011-05-01 09:43 PM Re: Kixgolf - Four Is Magic - Private Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
The score drops, the error remains the same ...


KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_fim.kix
Scoring Engine   = 3.3
OS               = Windows 7 Professional Edition
CPU              = Intel Pentium III
Speed            = 2669 MHz
Memory           = 4096 MB

Tournament       = Four Is Magic
Processing Start = 2011/05/01 21:42:11.008
Processing End   = 2011/05/01 21:42:11.055
Duration         = 0000/00/00 00:00:00.046
# Tests Run      = 200
# Tests Passed   = 199
# Tests Failed   = 1
Result           = failed
KiXGolf Score    = 440

Thank you for participating in KiXtart Golf!
Press any key to continue...

_________________________



Top
#201986 - 2011-05-02 07:43 AM Re: Kixgolf - Four Is Magic - Private Round [Re: Jochen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
didn't have time yesterday to play and am late from work now, but...
 Code:
KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_fim.kix
Scoring Engine   = 3.3
OS               = Windows 7 Professional Edition
CPU              = Intel Pentium III
Speed            = 1396 MHz
Memory           = 4096 MB

Tournament       = Four Is Magic
Processing Start = 2011/05/02 08:41:45.276
Processing End   = 2011/05/02 08:41:45.518
Duration         = 0000/00/00 00:00:00.241
# Tests Run      = 200
# Tests Passed   = 200
# Tests Failed   =
Result           = passed
KiXGolf Score    = 461

Thank you for participating in KiXtart Golf!
_________________________
!

download KiXnet

Top
#201987 - 2011-05-02 07:46 AM Re: Kixgolf - Four Is Magic - Private Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
oops...
 Code:
KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_fim.kix
Scoring Engine   = 3.3
OS               = Windows 7 Professional Edition
CPU              = Intel Pentium III
Speed            = 1396 MHz
Memory           = 4096 MB

Tournament       = Four Is Magic
Processing Start = 2011/05/02 08:45:39.981
Processing End   = 2011/05/02 08:45:40.307
Duration         = 0000/00/00 00:00:00.326
# Tests Run      = 200
# Tests Passed   = 200
# Tests Failed   =
Result           = passed
KiXGolf Score    = 384

Thank you for participating in KiXtart Golf!
_________________________
!

download KiXnet

Top
#201988 - 2011-05-02 10:12 AM Re: Kixgolf - Four Is Magic - Private Round [Re: Lonkero]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Very strange error I had there .. puzzled me for some hours, but now fixed..




KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_fim.kix
Scoring Engine   = 3.3
OS               = Windows XP Professional
CPU              = Intel Pentium III
Speed            = 2526 MHz
Memory           = 4096 MB

Tournament       = Four Is Magic
Processing Start = 2011/05/02 10:10:22.687
Processing End   = 2011/05/02 10:10:22.875
Duration         = 0000/00/00 00:00:00.188
# Tests Run      = 200
# Tests Passed   = 200
# Tests Failed   =
Result           = passed
KiXGolf Score    = 438

Thank you for participating in KiXtart Golf!
Press any key to continue...


_________________________



Top
#201989 - 2011-05-02 10:26 AM Re: Kixgolf - Four Is Magic - Private Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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


KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_fim.kix
Scoring Engine   = 3.3
OS               = Windows XP Professional
CPU              = Intel Pentium III
Speed            = 2526 MHz
Memory           = 4096 MB

Tournament       = Four Is Magic
Processing Start = 2011/05/02 10:25:38.312
Processing End   = 2011/05/02 10:25:38.468
Duration         = 0000/00/00 00:00:00.156
# Tests Run      = 200
# Tests Passed   = 200
# Tests Failed   =
Result           = passed
KiXGolf Score    = 432

Thank you for participating in KiXtart Golf!
Press any key to continue...

_________________________



Top
#201990 - 2011-05-02 10:39 AM Re: Kixgolf - Four Is Magic - Private Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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

KiXtart Version  = 4.61
KiXGolf Script   = kixgolf_fim.kix
Scoring Engine   = 3.3
OS               = Windows XP Professional
CPU              = Intel Pentium III
Speed            = 2526 MHz
Memory           = 4096 MB

Tournament       = Four Is Magic
Processing Start = 2011/05/02 10:38:51.828
Processing End   = 2011/05/02 10:38:51.984
Duration         = 0000/00/00 00:00:00.155
# Tests Run      = 200
# Tests Passed   = 200
# Tests Failed   =
Result           = passed
KiXGolf Score    = 419

Thank you for participating in KiXtart Golf!
Press any key to continue...


_________________________



Top
Page 1 of 7 12345>Last »


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

Who's Online
0 registered and 312 anonymous users online.
Newest Members
Praveer, Ollero, rayyo, Foxlicht, DonChild
17742 Registered Users

Generated in 0.045 seconds in which 0.014 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