This commit is contained in:
2025-09-22 13:02:35 +02:00
parent c32b20e5b3
commit 5b95c4dd64
41 changed files with 998 additions and 152 deletions

View File

@@ -0,0 +1,29 @@
package blitz.math
import blitz.unreachable
/** only 6 directions -> only needs 3 bits */
@JvmInline
value class Direction(
val idx: U3
) {
companion object {
val UP = Direction(U3(0u))
val DOWN = Direction(U3(1u))
val NORTH = Direction(U3(2u))
val EAST = Direction(U3(3u))
val SOUTH = Direction(U3(4u))
val WEST = Direction(U3(5u))
}
override fun toString() =
when (this) {
UP -> "Up"
DOWN -> "Down"
NORTH -> "North"
EAST -> "East"
SOUTH -> "South"
WEST -> "West"
else -> unreachable()
}
}