Files
expansion/src/game/point.cr
2019-10-13 12:35:54 +03:00

15 lines
224 B
Crystal

struct Game::Point
property x : Int32
property y : Int32
def initialize(@x : Int32, @y : Int32)
end
getter x
getter y
def distance(other) : Int32
return (other.x - @x).abs + (other.y - @y).abs
end
end