Page 1 of 2 12>
Topic Options
#213044 - 2017-12-10 05:59 PM Kixgolf - Rock Paper Scissors Lizard Spock - Private Round
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
=================================
The Challenge - Rock Paper Scissors Lizard Spock
=================================


Given two inputs in the range 'Rock', 'Paper', 'Scissors', 'Lizard', 'Spock' representing the selections for player1 and player2 determine the winner of the match.

The rules:
 Code:
[Winner] [action]    [loser]
-----------------------------
scissors cut         paper
paper    covers      rock
rock     crushes     lizard
lizard   poisons     spock
spock    smashes     scissors
scissors decapitates lizard
lizard   eats        paper
paper    disproves   spock
spock    vaporizes   rock
rock     crushes     scissors


Input will be a pair of strings divided by commas. First string represents selection of player1, second string selection of player2.
The callenge is to write the shortest code to return either 0 for a tie, 1 for player1 winning or 2 for player2 winning.

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

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


Example Input
Spock,Lizard

Output (lizard poisons spock)
2

Example Input
Paper,Spock

Output (paper disporoves spock)
1

alas, poor Spock!

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

- The scoring engine has added code to help diagnose which cases are failing. To see test case results:
 Code:
   kix32 kixgolf_drc $verbose=1 ;shows failing results
   kix32 kixgolf_drc $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: 2017-12-10 to 2017-12-17 (Official Count down clock will determine end time)

2) Public coding phase: 2017-12-17 to 2017-12-24

3) Final results: 2017-12-24


Attachments
kixgolf_rpsls.zip (225 downloads)
Description:




Edited by Jochen (2017-12-10 06:08 PM)
_________________________



Top
#213045 - 2017-12-10 06:01 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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

Edited by Jochen (2017-12-17 06:52 PM)
_________________________



Top
#213046 - 2017-12-10 09:16 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Jochen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
 Code:
KiXtart Version  = 4.66
KiXGolf Script   = kixgolf_rpsls.KIX
Scoring Engine   = 3.3
OS               = Windows 10 Pro
CPU              = Intel Pentium III Xeon
Speed            = 3392 MHz
Memory           = 16384 MB

Tournament       = Rock Paper Scissors Lizard Spock
Processing Start = 2017/12/10 15:14:19.131
Processing End   = 2017/12/10 15:14:19.193
Duration         = 0000/00/00 00:00:00.061
# Tests Run      = 20
# Tests Passed   = 20
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 235

Top
#213047 - 2017-12-10 09:58 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
This will definitely be one of those that is easy to complete, and hard to find stokes.
Top
#213048 - 2017-12-10 11:19 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
It‘s a start.. there are definitely more to come.
Carry on \:\)
_________________________



Top
#213049 - 2017-12-10 11:45 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Jochen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
... at the end I mean. ;\)
Top
#213050 - 2017-12-11 05:19 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
 Code:
KiXtart Version  = 4.66
KiXGolf Script   = kixgolf_rpsls.KIX
Scoring Engine   = 3.3
OS               = Windows 10 Pro
CPU              = Intel Pentium III Xeon
Speed            = 3392 MHz
Memory           = 16384 MB

Tournament       = Rock Paper Scissors Lizard Spock
Processing Start = 2017/12/11 11:18:52.787
Processing End   = 2017/12/11 11:18:52.787
Duration         = 0000/00/00 00:00:00.000
# Tests Run      = 20
# Tests Passed   = 20
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 186

Top
#213051 - 2017-12-11 05:22 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

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



Top
#213052 - 2017-12-12 06:21 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Jochen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
Sure is quiet out here \:\(

 Code:
KiXtart Version  = 4.66
KiXGolf Script   = kixgolf_rpsls.KIX
Scoring Engine   = 3.3
OS               = Windows 10 Pro
CPU              = Intel Pentium III Xeon
Speed            = 3392 MHz
Memory           = 16384 MB

Tournament       = Rock Paper Scissors Lizard Spock
Processing Start = 2017/12/12 12:20:27.614
Processing End   = 2017/12/12 12:20:27.614
Duration         = 0000/00/00 00:00:00.000
# Tests Run      = 20
# Tests Passed   = 20
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 177

Top
#213053 - 2017-12-12 06:40 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
Move over... I want the lead

 Code:
KiXtart Version  = 4.66
KiXGolf Script   = kixgolf_rpsls.KIX
Scoring Engine   = 3.3
OS               = Windows 10 Pro
CPU              = Intel Pentium III Xeon
Speed            = 3392 MHz
Memory           = 16384 MB

Tournament       = Rock Paper Scissors Lizard Spock
Processing Start = 2017/12/12 12:39:53.426
Processing End   = 2017/12/12 12:39:53.426
Duration         = 0000/00/00 00:00:00.000
# Tests Run      = 20
# Tests Passed   = 20
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 169

Top
#213054 - 2017-12-12 09:11 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
so lonely here he split his personality in half
Allen took the lead. Or ... was it Allen?
_________________________



Top
#213056 - 2017-12-12 10:51 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Jochen]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Been super busy. Will try to throw some bloatware on here later to at least get on the board.
Top
#213063 - 2017-12-13 05:57 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: ShaneEP]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
 Code:
KiXtart Version  = 4.66
KiXGolf Script   = kixgolf_rpsls.KIX
Scoring Engine   = 3.3
OS               = Windows 10 Pro
CPU              = Intel Pentium III Xeon
Speed            = 3392 MHz
Memory           = 16384 MB

Tournament       = Rock Paper Scissors Lizard Spock
Processing Start = 2017/12/13 11:57:08.275
Processing End   = 2017/12/13 11:57:08.275
Duration         = 0000/00/00 00:00:00.000
# Tests Run      = 20
# Tests Passed   = 20
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 162

Top
#213067 - 2017-12-14 03:01 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4400
Loc: New Jersey
Opening round:
 Code:
KiXtart Version  = 4.66
KiXGolf Script   = kixgolf_rpsls.kix
Scoring Engine   = 3.3
OS               = Windows 10 Pro
CPU              = AMD FX(tm)-8350 Eight-Core Processor
Speed            = 3991 MHz
Memory           = 16384 MB

Tournament       = Rock Paper Scissors Lizard Spock
Processing Start = 2017/12/14 09:00:17.557
Processing End   = 2017/12/14 09:00:17.557
Duration         = 0000/00/00 00:00:00.000
# Tests Run      = 20
# Tests Passed   = 20
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 144

Thank you for participating in KiXtart Golf!
Data center migration this weekend - probably my only chance to play. \:\(

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#213068 - 2017-12-14 05:44 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Glenn Barnas]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
 Code:
KiXtart Version  = 4.66
KiXGolf Script   = kixgolf_rpsls.KIX
Scoring Engine   = 3.3
OS               = Windows 10 Pro
CPU              = Intel Pentium III Xeon
Speed            = 3392 MHz
Memory           = 16384 MB

Tournament       = Rock Paper Scissors Lizard Spock
Processing Start = 2017/12/14 11:44:01.969
Processing End   = 2017/12/14 11:44:01.969
Duration         = 0000/00/00 00:00:00.000
# Tests Run      = 20
# Tests Passed   = 20
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 159

Top
#213070 - 2017-12-14 08:47 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4400
Loc: New Jersey
Some lunchtime golfing:
 Code:
KiXtart Version  = 4.66
KiXGolf Script   = kixgolf_rpsls.kix
Scoring Engine   = 3.3
OS               = Windows 10 Pro
CPU              = AMD FX(tm)-8350 Eight-Core Processor
Speed            = 3991 MHz
Memory           = 16384 MB

Tournament       = Rock Paper Scissors Lizard Spock
Processing Start = 2017/12/14 14:32:26.311
Processing End   = 2017/12/14 14:32:26.321
Duration         = 0000/00/00 00:00:00.010
# Tests Run      = 20
# Tests Passed   = 20
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 141
Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#213071 - 2017-12-15 12:18 AM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Glenn Barnas]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
It'll get me on the board at least...

 Code:

KiXtart Version  = 4.67
KiXGolf Script   = kixgolf_rpsls.kix
Scoring Engine   = 3.3
OS               = Windows 7 Enterprise Edition
CPU              = Intel Pentium III Xeon
Speed            = 2600 MHz
Memory           = 8192 MB

Tournament       = Rock Paper Scissors Lizard Spock
Processing Start = 2017/12/14 17:18:17.400
Processing End   = 2017/12/14 17:18:17.416
Duration         = 0000/00/00 00:00:00.015
# Tests Run      = 20
# Tests Passed   = 20
# Tests Failed   = 0
Result           = Passed
KiXGolf Score    = 242

Thank you for participating in KiXtart Golf!

Top
#213072 - 2017-12-15 09:11 AM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: ShaneEP]
Jochen Administrator Offline
KiX Supporter
*****

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

Glenn     141
Allen     159
Shane     242



All ( ) players on the course. Me likes!
Wonder where the other regulars are \:\(
_________________________



Top
#213076 - 2017-12-15 01:55 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Jochen]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Regulars are lurking ;\)
Top
#213077 - 2017-12-15 03:56 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Private Round [Re: Shawn]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Any side prizes for doing it in one line?
Top
Page 1 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 323 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.12 seconds in which 0.081 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