Created
October 14, 2019 03:45
-
-
Save lctseng/435018f069648a76dc79828b18c617ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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