Closed Potherca closed 4 years ago
The result of our attempt at a CLI runner (built using this Cloud9 workspace):
package net.arjanonline.sudoku_solver case class SudokuGenerator(content: String) extends GameDef with StringBoardParser with Solver { override val boardString: String = content } object foo { def main(args: Array[String]): Unit = { val generator = SudokuGenerator(args(0)) println("Input: ") println(generator.board) println("Solution: ") println(generator.solution.getOrElse("No solution")) } }
Run in sbt with the following command:
sbt
run "8 . . . . . . . .\n. . 3 6 . . . . .\n. 7 . . 9 . 2 . .\n. 5 . . . 7 . . .\n. . . . 4 5 7 . .\n. . . 1 . . . 3 .\n. . 1 . . . . 6 8\n. . 8 5 . . . 1 .\n. 9 . . . . 4 . ."
This gave us the following output:
[info] Compiling 1 Scala source to /home/ubuntu/workspace/target/scala-2.12/classes... [info] Running net.arjanonline.sudoku_solver.foo 8 . . . . . . . . [info] . . 3 6 . . . . . [info] . 7 . . 9 . 2 . . [info] . 5 . . . 7 . . . [info] . . . . 4 5 7 . . [info] . . . 1 . . . 3 . [info] . . 1 . . . . 6 8 [info] . . 8 5 . . . 1 . [info] . 9 . . . . 4 . . Input: 8 . . . . . . . . . . 3 6 . . . . . . 7 . . 9 . 2 . . . 5 . . . 7 . . . . . . . 4 5 7 . . . . . 1 . . . 3 . . . 1 . . . . 6 8 . . 8 5 . . . 1 . . 9 . . . . 4 . . Solution: 8 1 2 7 5 3 6 4 9 9 4 3 6 8 2 1 7 5 6 7 5 4 9 1 2 8 3 1 5 4 2 3 7 8 9 6 3 6 9 8 4 5 7 2 1 2 8 7 1 6 9 5 3 4 5 2 1 9 7 4 3 6 8 4 3 8 5 2 6 9 1 7 7 9 6 3 1 8 4 5 2
Closing due to lack of activity.
The result of our attempt at a CLI runner (built using this Cloud9 workspace):
Run in
sbt
with the following command:This gave us the following output: