From 6860b6e83f2c6be5e59253105cf397c5b27b1590 Mon Sep 17 00:00:00 2001 From: DJ O'Leary Date: Mon, 3 Mar 2025 01:14:16 +0100 Subject: feat: Move 2024 php files --- 2024/PHP/day_04/Position.php | 77 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 2024/PHP/day_04/Position.php (limited to '2024/PHP/day_04/Position.php') diff --git a/2024/PHP/day_04/Position.php b/2024/PHP/day_04/Position.php new file mode 100644 index 0000000..182da7e --- /dev/null +++ b/2024/PHP/day_04/Position.php @@ -0,0 +1,77 @@ +x}, {$this->y})"; + } + + /** + * Not validated + */ + public function getNorth(): self + { + return new self($this->x, $this->y - 1); + } + + /** + * Not validated + */ + public function getNorthEast(): self + { + return new self($this->x + 1, $this->y - 1); + } + + /** + * Not validated + */ + public function getEast(): self + { + return new self($this->x + 1, $this->y); + } + + /** + * Not validated + */ + public function getSouthEast(): self + { + return new self($this->x + 1, $this->y + 1); + } + + /** + * Not validated + */ + public function getSouth(): self + { + return new self($this->x, $this->y + 1); + } + + /** + * Not validated + */ + public function getSouthWest(): self + { + return new self($this->x - 1, $this->y + 1); + } + + /** + * Not validated + */ + public function getWest(): self + { + return new self($this->x - 1, $this->y); + } + + /** + * Not validated + */ + public function getNorthWest(): self + { + return new self($this->x - 1, $this->y - 1); + } +} -- cgit v1.2.3