I am trying to run this program but it is telling me that r is not found. How do you call the method since it is in a class? (I am assuming that the error is because of this)
package pack
class Sud(val grid: List[List[Int]]) {
def r(r: Int): List[Int] =
//code
}
object Sud
{
def main(args: Array[String])
{
val puzzle=new Sudoku(List(
List(0, 0, 9, 0, 0, 7, 5, 0, 0),
//rest of Sudoku puzzle created by repeating the above statement
println(r(0)) //ERROR given here
}
}
As said in the comments, in your code r is a class method. Hence you need to Instantiate your Class Sud in order to call that method.
val inst: Sud = new Sud(puzzle)
println(inst.r(0))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With