# Search Results

Results tagged with Search options user 18535
6 results

This challenge is generally based upon, related to, or simulates a game or some portion of one.

Ruby, 100 bytes ->a{%w(^2.*4$6$ ^6 6 5$5 4$ ^1*$3$ 4 2$1$ .).index{|b|/#{b}/=~([1,*a,4].map{|c|a.count(c)}*'')}} Try it online! How it works: Count occurrences of every number in the array, …
answered Sep 25 '18 by G B
Ruby, 29 bytes ->n{0until"#{n+=n%3}"!~/3/;n} Try it online!
answered Mar 8 by G B
hard_coded class hard_coded: def __init__(self): self.money = 0 self.round = 0 def play_round(self, did_i_win, amount): self.money += 500 self.round += 1 if did_i_win == 0: …
answered Nov 23 '17 by G B
Ruby, 22 19 bytes ->x,y{390[(x-y)%9]} Input: ASCII code of the 2 characters. Output: 1 for allies, 0 for enemies. How it works: Get the difference between the 2 numbers modulo 9, use a bitmask (3 …
answered Mar 13 '17 by G B
Ruby, 21 bytes ->a,b,x,y{b-y>6*x-=a} Try it online! Worked around the boring solution, saved a byte and called it a day.
answered Sep 27 by G B
Ruby, 126 bytes ->l,w{(/(_|^)..(_|$)/!~s=w*?_)&&!!s.chars.uniq&&/__|^_|_$|(_.*)\1/!~s.gsub(/(.)_\1/,'\1').chars.map{|x|l.grep(/#{x}/)}*?_} Try it online!
answered Apr 17 by G B