Skip to content

Commit

Permalink
🎨 rename Quadrants#seq to toSeq
Browse files Browse the repository at this point in the history
  • Loading branch information
twentylemon committed Dec 15, 2024
1 parent 5123fd9 commit 3a51c29
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/org/lemon/advent/lib/2d/Area.scala
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ case class Area(xRange: Range, yRange: Range):
builder.toString

case class Quadrants(topLeft: Area, topRight: Area, bottomLeft: Area, bottomRight: Area):
def seq: Seq[Area] = Seq(topLeft, topRight, bottomLeft, bottomRight)
def toSeq: Seq[Area] = Seq(topLeft, topRight, bottomLeft, bottomRight)
2 changes: 1 addition & 1 deletion src/main/scala/org/lemon/advent/year2024/Day14.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ private object Day14:
topLeft = quadrants.topLeft.dropRight(1).dropBottom(1),
topRight = quadrants.topRight.dropBottom(1),
bottomLeft = quadrants.bottomLeft.dropRight(1),
).seq.map(quad => robits.count(r => quad.contains(r._1)))
).toSeq.map(quad => robits.count(r => quad.contains(r._1)))

def part1(input: String, example: Boolean) =
val area = if example then Area(11, 7) else Area(101, 103)
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/org/lemon/advent/lib/2d/AreaTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class AreaTest extends UnitTest:
}

test("quadrants cover the area") {
check((area: Area) => area.quadrants.seq.flatMap(_.toSeq).toSet == area.toSet)
check((area: Area) => area.quadrants.toSeq.flatMap(_.toSeq).toSet == area.toSet)
}

test("area encloses itself") {
Expand Down

0 comments on commit 3a51c29

Please sign in to comment.