Skip to content

Instantly share code, notes, and snippets.

View hazpotts's full-sized avatar

Harry Potts hazpotts

View GitHub Profile
@hazpotts
hazpotts / Coordinates.php
Last active February 19, 2022 17:03
Small algorithm for calculating coordinates on a spiral
<?php
/*
* Calculates the coordinates from an Id. The counting starts from 0,0 and then spirals out
* like this:
*
* +--+--+--+-->
* |
* + +--+--+--+
* | | |
* + + +--+ +