Created
May 12, 2010 18:53
-
-
Save rodrigomanhaes/398985 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
class Peca | |
def self.iniciar | |
@pecas = (0..6).collect {|lado1| | |
(lado1..6).collect {|lado2| Peca.new(lado1, lado2) } | |
}.flatten.shuffle | |
end | |
def self.proxima | |
@pecas.pop | |
end | |
def initialize(lado1, lado2) | |
@lado1 = lado1 | |
@lado2 = lado2 | |
end | |
attr_reader :lado1, :lado2 | |
class << self | |
alias :reiniciar :iniciar | |
end | |
iniciar | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment