Skip to content

Instantly share code, notes, and snippets.

@zaeleus
Last active December 24, 2015 00:49
Show Gist options
  • Save zaeleus/6718884 to your computer and use it in GitHub Desktop.
Save zaeleus/6718884 to your computer and use it in GitHub Desktop.
Rock-paper-scissors code golf solution to <https://icpcarchive.ecs.baylor.edu/external/40/4065.pdf>. 168 characters.
M=%w[R S P];S=STDIN;S.gets.to_i.times{t=0;S.gets.to_i.times{i,j=S.gets.split.map{|a|M.index(a)};M[i-2]==M[j]?t+=1:M[i]!=M[j]&&t-=1};puts t==0?"TIE":"Player #{t>0?1:2}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment