This commit is contained in:
Talia-12 2023-06-01 21:44:49 +10:00
parent 578c4fdab5
commit 0daecb38e4

View file

@ -8,7 +8,7 @@ import kotlin.math.min
* Uses axial coordinates as per https://www.redblobgames.com/grids/hexagons/
*/
data class HexCoord(val q: Int, val r: Int) {
fun s(): Int = this.q - this.r
fun s(): Int = -this.q - this.r
fun shiftedBy(x: HexCoord): HexCoord = HexCoord(this.q + x.q, this.r + x.r)