Rock papper scissors game representation

I tried making a representation for Rock papper scissors using 2 different randomization methods .

# Rock , papper , scissors representation coded by Omar Kayal
# each live_loop resemble a player
# I used the first 2 :elec_twang sample to resemble the 2 hand movements-
# before the players reveal their play
#  player 1 rock :bd_haus , papper :elec_mid_snare, scissors :drum_cymbal_pedal
# player 2 rock :C4, papper :E4, scissors :G4

use_random_seed Time.now.to_i

live_loop :player1 do
  sample :elec_twang
  sleep 0.5
  sample :elec_twang
  sleep 0.5
  if one_in(3)
    sample :bd_haus
    sleep 1
  else
    sample [ :elec_mid_snare, :drum_cymbal_pedal ].pick
    sleep 1
    
  end
end

live_loop :player2 do
  sample :elec_twang
  sleep 0.5
  sample :elec_twang
  sleep 0.5
  play choose([:C4, :E4, :G4])
  sleep 1
end
1 Like