Skip to content

Commit

Permalink
Split sections of the UI into views
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Weisberger committed Jul 30, 2017
1 parent dae1500 commit fec2531
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 160 deletions.
20 changes: 9 additions & 11 deletions lib/freecell/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,18 @@ def red?
%i[hearts diamonds].include?(suit)
end

def color
case suit
when :hearts, :diamonds
:red
when :spades, :clubs
:black
end
end

def opposite_color?(other)
red = %i[hearts diamonds]
red.include?(suit) ^ red.include?(other.suit)
end
end

# Used for printing
class EmptyCard
def black?
false
end

def red?
false
end
end
end
Loading

0 comments on commit fec2531

Please sign in to comment.