#include"BugBots.hpp" Position::Position(int ax, int ay) { x = ax; y = ay; } Position::Position(const Position & ap) { x = ap.x; y = ap.y; } void Position::SetX(int ax) { x = ax; } void Position::SetY(int ay) { y = ay; } int Position::GetX() const { return x; } int Position::GetY() const { return y; } int Position::Distance(const Position& pos) { return (*this - pos).Length(); } size_t Position::Hash() const { hash fcn; return fcn(x) ^ fcn(y); } Position Position::operator+(const Offset& ofst) { return Position(x + ofst.GetX(), y + ofst.GetY()); } Offset Position::operator-(const Position& pos) { return Offset(x - pos.x, y - pos.y); } Offset::Offset(int ax, int ay) { x = ax; y = ay; } Offset::Offset(const Offset & ap) { x = ap.x; y = ap.y; } void Offset::SetX(int ax) { x = ax; } void Offset::SetY(int ay) { y = ay; } int Offset::GetX() const { return x; } int Offset::GetY() const { return y; } int Offset::Length() { return MAX(ABS(x), ABS(y)); } Position Offset::operator+(const Position& pos) { return Position( pos.GetX() + x, pos.GetY() + y); } size_t hash::operator()(const Position& pos) { return pos.Hash(); }