#213093 - 2017-12-17 07:36 PM
Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round
[Re: Jochen]
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
Here is my 130 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
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
And immediately after posting...realized I could have shaved more..
125
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
KiX Supporter
   
Registered: 2003-04-19
Posts: 4557
Loc: USA
|
151
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
KiX Supporter
   
Registered: 2003-04-19
Posts: 4557
Loc: USA
|
Shane 123
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
|
|
|
|
#213099 - 2017-12-17 08:53 PM
Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round
[Re: ShaneEP]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4557
Loc: USA
|
Shane 120
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
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
KiX Supporter
   
Registered: 2003-01-28
Posts: 4400
Loc: New Jersey
|
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!
|
Top
|
|
|
|
#213103 - 2017-12-18 06:20 AM
Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round
[Re: ShaneEP]
|
Allen
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
|
|
|
|
#213126 - 2017-12-24 06:01 PM
Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round
[Re: Allen]
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
Top
|
|
|
|
#213127 - 2017-12-24 06:06 PM
Re: Kixgolf - Rock Paper Scissors Lizard Spock - Public Round
[Re: Jochen]
|
Jochen
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:
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
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 787 anonymous users online.
|
|
|