From cc2184c8adb0a337b5fd537f017a8b320abab7ce Mon Sep 17 00:00:00 2001 From: bionic85 <144353436+bionic85@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:21:46 +0100 Subject: [PATCH] Update Binary.cs --- PuzzlePlayer/Binary.cs | 51 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/PuzzlePlayer/Binary.cs b/PuzzlePlayer/Binary.cs index b0b50f7..9c99900 100644 --- a/PuzzlePlayer/Binary.cs +++ b/PuzzlePlayer/Binary.cs @@ -102,7 +102,56 @@ namespace PuzzlePlayer_Namespace protected override List<int[,]> GetSolveList(int[,] boardToSolve) { - throw new NotImplementedException(); + List<int[,]> result = new List<int[,]>(); + + for (int i = 0; i < boardToSolve.GetLength(0); i++) + for (int j = 0; j < boardToSolve.GetLength(1); + { + int[,] move = CheckMove(i, j, boardToSolve); + if (move != null) + result.Add(move); + } + + + + return result; + } + + private int[,] CheckMove(int x, int y, int[,] boardToSolve) + { + bool validForZero = false; + bool validForOne = false; + + // empty check + if (boardToSolve[x, y] != emptySpace) + return null; + + // loop two times for checking 0 and 1 + for (int i = 0; i <= 1; i++) + { + // middle check + MiddleCheck(x, y, boardToSolve, i); + + // side check + + // even 1 and 0 in one row and colum + + + } + + + } + + // check if the space is surrounded on both sides by the same number. If it is, the checked space should be the opposite number + private bool MiddleCheck(int x, int y, int[,] b, int checkFor) + { + + if (b[x - 1, y]) + + return false; } + + } +} } } \ No newline at end of file -- GitLab