I hereby claim:
- I am ajjahn on github.
- I am ajjahn (https://keybase.io/ajjahn) on keybase.
- I have a public key ASAXu4nEtPwoxBj_Xd9A3paM_SoYLLbWuS9YeNKZ99-skwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env ruby | |
puts Process.pid | |
SIGNAL_QUEUE = [] | |
reader, writer = IO.pipe | |
[:INT, :QUIT, :KILL, :USR1].each do |signal| | |
Signal.trap(signal) do | |
writer.write_nonblock('.') | |
SIGNAL_QUEUE << signal | |
end |
def play(n) | |
s=%w[Paper Rock Scissors].rotate rand 3 | |
s[1]+%w[,Draw ,Lose ,Win][s.index(n)<=>1] | |
end |