const std = @import("std"); const Position = @This(); x: i64, y: i64, pub fn init(x: i64, y: i64) Position { return Position{ .x = x, .y = y }; } pub fn zero() Position { return init(0, 0); } pub fn eql(self: Position, other: Position) bool { return self.x == other.x and self.y == other.y; } pub fn subtract(self: Position, other: Position) Position { return init(self.x - other.x, self.y - other.y); } pub fn format( self: Position, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) !void { _ = fmt; _ = options; try writer.print("Position{{ {}, {} }}", .{ self.x, self.y }); }