SHARE
TWEET

Untitled

a guest Sep 3rd, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def printSolution(): Unit ={
  2.  
  3.     val str:String = ""
  4.  
  5.     var s1:String = ""
  6.     var s2:String = ""
  7.     var s3:String = ""
  8.     var s4:String = ""
  9.  
  10.     val sX:String = "x"
  11.     val space:String = " "
  12.  
  13.     for(y<-allSquares.indices.toList){
  14.       for(x<-allSquares.indices.toList){
  15.         //Print the values
  16.         print(allSquares(x)(y).possibleValues.mkString(","))
  17.  
  18.         //Print right neighbor or not
  19.         if (allSquares(x)(y).neighbors.contains(Direction.right)){
  20.           print("x")
  21.         }
  22.         else {
  23.           print(" ")
  24.         }
  25.  
  26.       }   // for(x)
  27.  
  28.         //Remove some code and added this
  29.         //This will work on all sizes if i am not mistaken
  30.         //and also follow  functional requirments
  31.         // You jobb double check it, understand it, write comments and clean up the code
  32.         print("\n")
  33.         for (v<-(0 until num).toList){
  34.           if (allSquares(v)(y).neighbors.contains(Direction.down)){
  35.             print("x ")
  36.           }
  37.           else{
  38.             print("  ")
  39.           }
  40.         }
  41.         //Above
  42.  
  43.  
  44.       println("");
  45.  
  46.     }   // for(y)
  47.  
  48.   }   // printSolution()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top