Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

New answers tagged

0 votes

Return of the Hydra Slayer

Scala 3, 364 bytes A port of @Ajax1234's Python answer in Scala. 364 bytes, it can be golfed more. Golfed version. Attempt This Online! ...
138 Aspen's user avatar
  • 5,951
0 votes

Return of the Hydra Slayer

Python3, 150 bytes ...
Ajax1234's user avatar
  • 7,191
2 votes

Play a sequential game of Rock Paper Scissors

R, 128 123 bytes Minus 5 bytes thanks to pajonk ...
int 21h -- Glory to Ukraine --'s user avatar
0 votes

Play a sequential game of Rock Paper Scissors

Scala 3, 203 bytes 203 bytes, it can be golfed more. Uses Rock = 0, Paper = 1, Scissors = 2 and takes a list of integers as input such as ...
138 Aspen's user avatar
  • 5,951
5 votes

Play a sequential game of Rock Paper Scissors

Desmos, 102 101 bytes -1 bytes thanks to @fireflame241!!! a=l[1] b=l[2] k=mod((a-b)^2-a-b,3) L=l.count f(l)=\join(\{L>1:f(\join(a+b-k,l[3...])),l\}[1...L-1],k) <...
Aiden Chow's user avatar
  • 13.5k
0 votes

Play a sequential game of Rock Paper Scissors

Python 3.8 (pre-release), 66 bytes f=lambda a,b,*c:[l:=((a-b)**2-a-b)%3]+(c and f(a+b-l,*c)or[a+b-l]) Try it online! Port of xnor's Haskell answer ...
Jitse's user avatar
  • 7,146
0 votes

Play a sequential game of Rock Paper Scissors

Perl 5 -pl, 65 bytes say$&=~s/$+//r while s/^((.)\2|R(P)|(P)R|S(R)|(R)S|(S)P|P(S))/$+/ Try it online! Output is in order ...
Xcali's user avatar
  • 15.1k
0 votes

Play a sequential game of Rock Paper Scissors

Ruby, 44 bytes ->a,*s{[s.map{|x|a+x-a=[a,x,a][(x-a)%3]},a]} Try it online!
G B's user avatar
  • 22k
1 vote

Play a sequential game of Rock Paper Scissors

05AB1E, 15 13 bytes ćsvDysy/òƒs]ðsJ Port of @Tbw's Uiua's answer, so make sure to upvote that answer as well! -2 bytes (thanks to @Tbw) mentioning a rule I missed (...
Kevin Cruijssen's user avatar
2 votes

Play a sequential game of Rock Paper Scissors

Thue, 184 182 bytes -2 bytes thanks to @DLosc!!! ...
Aiden Chow's user avatar
  • 13.5k
3 votes

Play a sequential game of Rock Paper Scissors

Haskell, 48 bytes f(a:b:r)|k<-mod((a-b)^2-a-b)3=k:f(a+b-k:r) f l=l Try it online! Outputs the throws eliminated in order with the last element being the winner,...
xnor's user avatar
  • 145k
3 votes

Play a sequential game of Rock Paper Scissors

Haskell, 69 bytes o![a]=(a,o) o!(a:b:r)|mod(a-b)3>1=(a:o)!(b:r)|1<2=(b:o)!(a:r) f=([]!) Attempt This Online! Uses a list of integers as input and output, ...
corvus_192's user avatar
  • 5,295
2 votes

Play a sequential game of Rock Paper Scissors

Charcoal, 22 bytes FS¿⁼ω§RPS⌕SRιι«ω≔ιω»,ω Try it online! Link is to verbose version of code. Outputs the updated line and winner (here separated by a comma, ...
Neil's user avatar
  • 171k
1 vote

Play a sequential game of Rock Paper Scissors

Retina 0.8.2, 36 bytes ^ , {O^`(?<=,.?). ,SP ,PS ,(.)\B $1, Try it online! Link includes test cases. Outputs the updated line and the winner separated by a ...
Neil's user avatar
  • 171k
2 votes

Play a sequential game of Rock Paper Scissors

JavaScript (Node.js), 55 48 bytes -7b thanks to @Arnauld's math wizardry f=(a,b,...A)=>b?[q=19/(b^=a)&3||a]+f(q^b,...A):a Try it online! Takes input as ...
Justin Mariner's user avatar
1 vote

Play a sequential game of Rock Paper Scissors

APL+WIN, 95 bytes Prompts for string consisting of characters R P S: SP←RS←PR←2⋄PS←SR←RP←RR←PP←SS←1⋄x←0⍴⍬⋄y←⎕⋄⍎∊(¯1+⍴y)⍴⊂'n←⍎m←2↑y⋄x←x,m[n]⋄y←m[1 2~n],2↓y⋄'⋄y,',',x ...
Graham's user avatar
  • 6,226
9 votes

Play a sequential game of Rock Paper Scissors

Uiua 0.11.0, 1211 bytes SBCS /(&p⍥:⁅÷,,) Try on Uiua Pad! Takes a list of 1 for rock, 2 ...
Tbw's user avatar
  • 2,063
3 votes

Play a sequential game of Rock Paper Scissors

Python 2, 77 bytes a=lambda s,l=[]:len(s)<2and(s,l)or a(s,l+[s.pop(s[:2]in[[1,0],[2,1],[0,2]])]) Try it Online! Uses ...
Alec's user avatar
  • 151
1 vote

Determine the optimal blackjack move

Charcoal, 118 bytes NθNη≔&⁺⁶NI§§⪪⎇N”|“.MPητe4d↔_ςζWQG8XG60d⊞&≦δ‽”⎇N”|“.,oW¿²*₂¶‴ι6⁰γ;)J×XSiI=φO3””|'φΣ3Xζ⎚⦃″.I?¬4⟲↧\`cMN{|E#-⁶¹T”χηθεI∨&ε¹ε Try it online! Link ...
Neil's user avatar
  • 171k

Top 50 recent answers are included