Skip to content

Instantly share code, notes, and snippets.

@loganrosen
Created February 4, 2011 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loganrosen/810571 to your computer and use it in GitHub Desktop.
Save loganrosen/810571 to your computer and use it in GitHub Desktop.
SHOES_APP = File.expand_path(__FILE__)
require 'shoes'
begin
Shoes.setup do
gem 'win32-sound'
end
require 'win32/sound'
Shoes.app :width => 520, :height => 540 do
$nums = []
100.times do
$nums << rand(4)
end
counter = 0
n = 0
$clickarray = []
$playarray = []
newcount = -1
reallynewcount = 0
$red = image 'Anonymous_Button_Red.png'
$blue = image 'Anonymous_Button_Blue.png'
$yellow = image 'Anonymous_Button_Yellow.png'
$green = image 'Anonymous_Button_Green.png'
button "Start" do
x = 0
until x == 1
if $nums.fetch(n) == 0
Win32::Sound.play('simonSound1.wav')
reallynewcount = 0
para "red"
$clickarray << 0
elsif $nums.fetch(n) == 1
Win32::Sound.play('simonSound2.wav')
reallynewcount = 0
para "green"
$clickarray << 1
elsif $nums.fetch(n) == 2
Win32::Sound.play('simonSound3.wav')
reallynewcount = 0
para "blue"
$clickarray << 2
elsif $nums.fetch(n) == 3
Win32::Sound.play('simonSound4.wav')
reallynewcount = 0
para "yellow"
$clickarray << 3
end
x = x + 1
end
$red.click do
$playarray << 0
newcount = newcount + 1
if $playarray.at(newcount) == $clickarray.at(newcount)
Win32::Sound.play('simonSound1.wav')
counter = counter + 1
reallynewcount = reallynewcount + 1
n = 0
if reallynewcount == counter
while n <= counter
if $nums.fetch(n) == 0
Win32::Sound.play('simonSound1.wav')
reallynewcount = 0
$clickarray << 0
elsif $nums.fetch(n) == 1
Win32::Sound.play('simonSound2.wav')
reallynewcount = 0
$clickarray << 1
elsif $nums.fetch(n) == 2
Win32::Sound.play('simonSound3.wav')
reallynewcount = 0
$clickarray << 2
elsif $nums.fetch(n) == 3
Win32::Sound.play('simonSound4.wav')
reallynewcount = 0
$clickarray << 3
end
n = n + 1
end
end
else
para "fail"
end
end
$green.click do
$playarray << 1
newcount = newcount + 1
if $playarray.at(newcount) == $clickarray.at(newcount)
Win32::Sound.play('simonSound1.wav')
counter = counter + 1
reallynewcount = reallynewcount + 1
n = 0
if reallynewcount == counter
while n <= counter
if $nums.fetch(n) == 0
Win32::Sound.play('simonSound1.wav')
reallynewcount = 0
$clickarray << 0
elsif $nums.fetch(n) == 1
Win32::Sound.play('simonSound2.wav')
reallynewcount = 0
$clickarray << 1
elsif $nums.fetch(n) == 2
Win32::Sound.play('simonSound3.wav')
reallynewcount = 0
$clickarray << 2
elsif $nums.fetch(n) == 3
Win32::Sound.play('simonSound4.wav')
reallynewcount = 0
$clickarray << 3
end
n = n + 1
end
end
else
para "fail"
end
end
$blue.click do
$playarray << 2
newcount = newcount + 1
if $playarray.at(newcount) == $clickarray.at(newcount)
Win32::Sound.play('simonSound1.wav')
counter = counter + 1
reallynewcount = reallynewcount + 1
n = 0
if reallynewcount == counter
while n <= counter
if $nums.fetch(n) == 0
Win32::Sound.play('simonSound1.wav')
reallynewcount = 0
$clickarray << 0
elsif $nums.fetch(n) == 1
Win32::Sound.play('simonSound2.wav')
reallynewcount = 0
$clickarray << 1
elsif $nums.fetch(n) == 2
Win32::Sound.play('simonSound3.wav')
reallynewcount = 0
$clickarray << 2
elsif $nums.fetch(n) == 3
Win32::Sound.play('simonSound4.wav')
reallynewcount = 0
$clickarray << 3
end
n = n + 1
end
end
else
para "fail"
end
end
$yellow.click do
$playarray << 3
newcount = newcount + 1
reallynewcount = reallynewcount + 1
if $playarray.at(newcount) == $clickarray.at(newcount)
Win32::Sound.play('simonSound1.wav')
counter = counter + 1
n = 0
if reallynewcount == counter
while n <= counter
if $nums.fetch(n) == 0
Win32::Sound.play('simonSound1.wav')
reallynewcount = 0
$clickarray << 0
elsif $nums.fetch(n) == 1
Win32::Sound.play('simonSound2.wav')
reallynewcount = 0
$clickarray << 1
elsif $nums.fetch(n) == 2
Win32::Sound.play('simonSound3.wav')
reallynewcount = 0
$clickarray << 2
elsif $nums.fetch(n) == 3
Win32::Sound.play('simonSound4.wav')
reallynewcount = 0
$clickarray << 3
end
n = n + 1
end
end
else
para "fail"
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment