Skip to content

Commit

Permalink
change x: Some[A] to Some(x) in pattern matching
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaydixi committed Oct 31, 2014
1 parent 4e581e2 commit 5693dd1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/scala/sudoku4sc/Sudoku.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ object Sudoku {
else {
this.blank match {
case None => None
case pos: Some[Position] =>
val solutions = (for (i <- 1 to 9 ) yield update(pos.get, i)).filter(_.isOkay)
case Some(pos) =>
val solutions = (for (i <- 1 to 9 ) yield update(pos, i)).filter(_.isOkay)
lazy val completeSolutions = (for (solution <- solutions) yield solution.solve).filter(_.isInstanceOf[Some[Sudoku]])
if (completeSolutions.length > 0) completeSolutions.head
else None
Expand Down Expand Up @@ -107,7 +107,7 @@ object Sudoku {
def solveFromFile(inputFile: String, outputFile: String) = {
val result = new Sudoku(inputFile).solve match {
case None => "Could not solve"
case sud: Some[Sudoku] => sud.get.toString
case Some(sud) => sud.toString
}
val output = Resource.fromFile(outputFile)
output.write(result)
Expand Down

0 comments on commit 5693dd1

Please sign in to comment.