Skip to content

Commit

Permalink
don't load mower if it has a # comment
Browse files Browse the repository at this point in the history
  • Loading branch information
anonymax25 committed Jan 9, 2022
1 parent b61ab04 commit bba3d67
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion projet/funprog-al/src/main/scala/progfun/InputLoader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ class InputLoader(filePath: String) {
)
}

val groupedMowerLines = mowerLines.grouped(2).toList
// group input lines by 2 for mower parsing, and remove mower line groups when starting with '#'
val groupedMowerLines = mowerLines
.map(line => line.trim())
.grouped(2)
.toList
.filter(
mowerGroup =>
mowerGroup(0).take(1) != "#" || mowerGroup(1).take(1) != "#"
)
val mowers: List[Mower] = parseMowerLines(groupedMowerLines)

(sizes(0), sizes(1), mowers)
Expand Down

0 comments on commit bba3d67

Please sign in to comment.