Challenge 1: Correct Hash Keys — Solution class Point attr_reader :x, :y def initialize(x, y) @x = x @y = y end def ==(other) other.is_a?(Point) && x == other.x && y == other.y end alias eql? == def hash [x, y].hash end end lookup = { Point.new(1, 2) => "Origin-ish" } puts lookup[Point.new(1, 2)] =begin Output: Origin-ish Notes: - == compares two Point instances by value (matching x and y), not by object identity. - alias eql? == makes eql? behave identically to == for this class, so Ruby's Hash lookup machinery (which uses eql?, not ==) agrees with the value-equality logic already written. - hash delegates to [x, y].hash — Array already implements hash correctly for its elements, so two Points with the same x and y always produce the same hash value, satisfying the requirement that eql?-equal objects must have equal hash values. - lookup[Point.new(1, 2)] succeeds even though it's a brand new Point instance, different in memory from the one used as the original key — it works purely because eql? and hash both agree the two are equal. =end