3 attr_reader :color, :type
4 SYMBOLS = { :knight => 'N' }
5 TYPES = { 'P' => :pawn,
12 def initialize(color, type)
18 @color == other.color and @type == other.type
26 s = self.class.symbol(type)
27 s = s.downcase if color == :black
31 def same_color_of?(other)
32 other and other.color == color
40 other.instance_of?(self.class) and self == other
48 SYMBOLS[type] || type.to_s[0, 1].upcase
51 def self.type_from_symbol(sym)