Skip to content

Instantly share code, notes, and snippets.

@sml0820
Created August 18, 2013 00:18
Show Gist options
  • Save sml0820/6d1f2f419a6b4a7208f2 to your computer and use it in GitHub Desktop.
Save sml0820/6d1f2f419a6b4a7208f2 to your computer and use it in GitHub Desktop.
Part of Bingo - Creates boards
def start_game(user_goes_first)
#bingo slots
@places = {
a1:" ",a2:" ",a3:" ", a4:" ", a5:" ",
b1:" ",b2:" ",b3:" ", b4:" ", b5:" ",
c1:" ",c2:" ",c3:" ", c4:" ", c5:" ",
d1:" ",d2:" ",d3:" ", d4:" ", d5:" ",
e1:" ",e2:" ",e3:" ", e4:" ", e5:" "
}
@places_keys = [
:a1,:a2,:a3,:a4,:a5,
:b1,:b2,:b3,:b4,:b5,
:c1,:c2,:c3,:c4,:c5,
:d1,:d2,:d3,:d4,:d5,
:e1,:e2,:e3,:e4,:e5
]
@bingo_cards = []
@user_name.each do |numbers|
@places_keys.each_with_index do |n,i|
@places[n] = pick_number(i)
end
@bingo_cards << @places
end
user_turn
end
def pick_number(num)
case num
when 0..5
rand(1..15)
when 6..10
rand(16..30)
when 11..12
rand(16..30)
when 13
"X"
when 14..15
rand(16..30)
when 16..20
rand(31..45)
when 21..25
rand(46..60)
else
0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment