Page 1 of 2 12>
Topic Options
#213089 - 2017-12-17 06:49 PM Kixgolf - Rock Paper Scissors Lizard Spock - Public Round
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Gentlemen, post your code.
sorry for the delay
_________________________



Top
#213091 - 2017-12-17 06:53 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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

Edited by Jochen (2017-12-24 06:01 PM)
_________________________



Top
#213093 - 2017-12-17 07:36 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Jochen]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Here is my 130 code.

 Code:
function a($)
Dim $o
$o = Ro, Sp, Pa, Li, Sc

$a = (AScan($o, Left($,2)) + 5 - AScan($o, Left(Split($,",")[1],2))) mod 5

$a = IIf($a>2, 2, $a>0*1)

endfunction

Top
#213094 - 2017-12-17 07:37 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: ShaneEP]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
And immediately after posting...realized I could have shaved more..

125
 Code:
function a($)
$a = Ro, Sp, Pa, Li, Sc

$a = (AScan($a, Left($,2)) + 5 - AScan($a, Left(Split($,",")[1],2))) mod 5

$a = IIf($a>2, 2, $a>0*1)
endfunction

Top
#213095 - 2017-12-17 08:00 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: ShaneEP]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
151
 Code:
function a($)
  dim $r
  $r=cai,aop,oic,ipa,pco 
  $a=substr($,instr($,",")+2,1)
  $=substr($,2,1)
  for each $r in $r
    if left($r,1)=$
      $a=2-(instr($r,$a)>1)-($=$a)*2
	;endif
  ;next
endfunction

Top
#213096 - 2017-12-17 08:22 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
Shane 123

 Code:
function a($)
  $a = Ro, Sp, Pa, Li, Sc
  $a = (AScan($a, Left($,2)) + 5 - AScan($a, Left(Split($,",")[1],2))) mod 5
  $a = IIf($a>2, 2, $a>0)
endfunction

Top
#213097 - 2017-12-17 08:24 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

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



Top
#213098 - 2017-12-17 08:24 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Allen]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
doh!
Top
#213099 - 2017-12-17 08:53 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: ShaneEP]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
Shane 120

 Code:
function a($)
  $a = Ro, Sp, Pa, Li, Sc
  $a = (AScan($a, Left($,2)) + 5 - AScan($a, Left(Split($,",")[1],2))) mod 5
  $a=($a>0) + ($a>2)
endfunction

Top
#213100 - 2017-12-17 09:01 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
I still haven't figured out how you did this I looked and looked and looked at could never see what you obviously did. When I have a minute I'm going to tear this thing apart to understand the math.

Well done Shane. \:\)

Top
#213101 - 2017-12-18 01:30 AM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4400
Loc: New Jersey
 Code:
function a($)

  $ = Split($, ',')
  $a = 0

  If $[0] <> $[1]
    $a = x,ai,op,ic,ap,co 
    $a = IIf(InStr($a[InStr(caoip, substr($[0],2,1))], substr($[1],2,1)),1,2)

endfunction
Wish I had more time for this one..

I'll be using these in my upcoming coding class - they're fun, interesting, and show how many ways to look at a coding challenge!

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

Top
#213102 - 2017-12-18 01:35 AM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Glenn Barnas]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
It was all about finding a pattern of victories. In the order that I put them..

Ro, Sp, Pa, Li, Sc

Any of the options in the list, always beat the 3rd and 4th (>2) options to their right.

So the second line of the function is simply getting difference between the 2 in the list. Using the +5 and mod 5 to get around the wrapping. If difference >2 then they win, greater than 1, I win, 0 difference ties.


Edited by ShaneEP (2017-12-18 01:39 AM)

Top
#213103 - 2017-12-18 06:20 AM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: ShaneEP]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
My wording didn't come out how it sounded in my head. I meant while in the private stage I just could not come up with the pattern you found, despite my best efforts. Honestly, even after reading your code, I don't think that would have EVER come to me. That was some seriously good sleuthing on your part. \:\)
Top
#213104 - 2017-12-18 07:26 AM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Still, In my book the path to victory leads over shortening the pattern even more
_________________________



Top
#213106 - 2017-12-18 01:25 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
uuuh! I wish I could play
_________________________



Top
#213107 - 2017-12-19 07:49 AM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
 Originally Posted By: Jochen
uuuh! I wish I could play


I somehow expected Richard to pop up from behind a bush taking the lead
_________________________



Top
#213114 - 2017-12-19 06:10 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Jochen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
I keep glancing when I login to the forums... but time this week is at a premium.
Top
#213126 - 2017-12-24 06:01 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Ok, good game gentlemen \:\)

here the results

 Code:
Private Round

Shane     130    5    1
Glenn     141    4    1
Allen     151    3    1


Public Round

Allen     120    5    1
Shane     125    4    1
Glenn     141    3    1



Final results of the KPGA tour 2017

 Code:
Shane - 43
Allen - 29
Glenn - 18


Cui honorem, honorem!
_________________________



Top
#213127 - 2017-12-24 06:06 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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

($a>0) this was sooo painful to see!
($a>) would have been a 119 \:\)

Anyway, everybody likes cake, so here's some cake for you for 112:

 Code:
function a($)
    $a = (instr(cake,substr($,4,1)) + 5 - instr(cake,substr($,instr($,',')+4,1))) mod 5
    $a = $a - 2*($a>2)
endfunction



Wish you all a very merry christmas and a happy new year 2018. may you and you families be well and healthy.

I'll take an errand over the project euler site to polish my python skills a bit, but I guess there will be some more golfing to go on next year!

See you then!
_________________________



Top
#213128 - 2017-12-25 07:58 PM Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round [Re: Jochen]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Thanks for another fun round. Hope the holidays are great for you and yours as well.
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 787 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

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