diff options
author | tchojnacki <tomaszchojnacki2001@gmail.com> | 2021-12-09 13:33:22 +0100 |
---|---|---|
committer | tchojnacki <tomaszchojnacki2001@gmail.com> | 2021-12-09 13:33:22 +0100 |
commit | aa6edaafc8ec598197a8c06b6326a0075e78bba4 (patch) | |
tree | 42cf8313614503c20bbe398bcc9cb36abbefb73e /src/Utils.kt | |
parent | 67852df6b6b9bb816dceae94493457764a8a272d (diff) | |
download | gleam_aoc2020-aa6edaafc8ec598197a8c06b6326a0075e78bba4.tar.gz gleam_aoc2020-aa6edaafc8ec598197a8c06b6326a0075e78bba4.zip |
Finish day 9
Diffstat (limited to 'src/Utils.kt')
-rw-r--r-- | src/Utils.kt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Utils.kt b/src/Utils.kt index 7876c3a..492c71d 100644 --- a/src/Utils.kt +++ b/src/Utils.kt @@ -32,6 +32,14 @@ fun readInputAsBitLists(name: String): List<List<Int>> = readInputAsLines(name) .map { binaryString -> binaryString.toList().map { bit -> bit.toString().toInt() } } +data class Pos2D(val x: Int, val y: Int) { + companion object { + val directions = listOf(Pos2D(0, 1), Pos2D(1, 0), Pos2D(0, -1), Pos2D(-1, 0)) + } + + operator fun plus(other: Pos2D) = Pos2D(x + other.x, y + other.y) +} + /** * Converts string to md5 hash. * @receiver a string |