Skip to content

Instantly share code, notes, and snippets.

@lctseng
Created October 14, 2019 03:45
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 lctseng/435018f069648a76dc79828b18c617ee to your computer and use it in GitHub Desktop.
Save lctseng/435018f069648a76dc79828b18c617ee to your computer and use it in GitHub Desktop.
@char_pool = []
10.times do |i|
if i != 5
@char_pool << "R#{i}"
@char_pool << "B#{i}"
else
@char_pool << "G5"
@char_pool << "G5"
end
end
@char_pool.shuffle!
def draw
print("\033[2J")
list = []
5.times do
list << @char_pool.pop
end
list.sort_by! do |block|
color = block[0]
num = block[1].to_i
val = num * 10
val +=1 if color == 'B'
val
end
list.each do |block|
print "#{block} "
end
puts "Press any key to continue"
gets
end
draw
print("\033[2J")
puts "Press any key to go next player"
gets
draw
print("\033[2J")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment