-
Notifications
You must be signed in to change notification settings - Fork 1
Comparing Cubots
Akshath Raghav edited this page Jun 28, 2021
·
2 revisions
- if
this
andother
have different cubeTypes, an IllegalArgumentException is thrown
Cubot cube = new Cubot();
Cubot cube2 = new Cubot() ;
System.out.println("Same Cube? -- " + cube.compareTo(cube2)) ;
// -- true
Cubot cube = new Cubot();
String[] end2 = {"RRRR", "GGGG", "OOOO", "BBBB", "WWWW", "YYYY"};
Cubot cube2 = new Cubot(temp2) ;
System.out.println("Same Cube? -- " + cube.compareTo(cube2)) ;
// -- Exception in thread "main" java.lang.IllegalArgumentException: Error: Unmatched cubeTypes
// at Cubot.compareTo(Cubot.java:134)
You can also do this manually if you wish to.
- getCube() returns the Cube object ( it can be Cube2 or Cube3 -- exceptions shouldn't go unhandled )
- solved() is a Cube(2/3) method
Cubot cube = new Cubot();
Cubot cube2 = new Cubot() ;
System.out.println(((Cube3) cube.getCube()).solved((Cube3) cube2.getCube())) ;
// -- true
Read on to see Cubot in action