Skip to content

Instantly share code, notes, and snippets.

@rodrigomanhaes
Created May 12, 2010 18:53
Show Gist options
  • Save rodrigomanhaes/398985 to your computer and use it in GitHub Desktop.
Save rodrigomanhaes/398985 to your computer and use it in GitHub Desktop.
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