IN JAVA 10X10 TAKUZU CHECKER PROGRAM You should write a method public static boolean isSolutionValid(int[][] solution);

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

IN JAVA 10X10 TAKUZU CHECKER PROGRAM You should write a method public static boolean isSolutionValid(int[][] solution);

Post by answerhappygod »

IN JAVA 10X10 TAKUZU CHECKER PROGRAM
You should write a method public static boolean
isSolutionValid(int[][] solution); that checks whether the
matrix provided by solution is a valid Takuzu solution. It
should return true when the solution is valid and false otherwise.
You do not have to
check if the solution satisfies a given starting solution in this
case.
Hint:
Write separate methods to check certain conditions of the solution.
In particular, you
may want to create the following methods, that you can then use in
the
isSolutionValid method:
public static boolean checkAllOneOrZero(int[][] solution)
that checks if each value in the solution matrix is equal to 0
or 1.
public static int countNumberOfOnesInRow(int[][] solution, int
rowNumber)
to check the number of 1 values (ones) present in row rowNumber
of the solution
matrix.
public static int countNumberOfOnesInColumn(int[][] solution,
int colNumber)
to check the number of 1 values (ones) present in column
colNumber of the solution
matrix.
public static boolean checkConsecutivesForRow(int[][] solution,
int
rowNumber)
o check that there are no more than two consecutive zero or one
values in row
rowNumber of the solution matrix.
public static boolean checkConsecutivesForColumn(int[][]
solution, int
colNumber)
to check that there are no more than two consecutive zero or one
values in column
colNumber of the solution matrix.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply