Skip to content
Snippets Groups Projects
Commit 218ec63c authored by bionic85's avatar bionic85
Browse files

We zijn Cooked

parent a0ca0436
No related branches found
No related tags found
No related merge requests found
......@@ -151,13 +151,8 @@ namespace PuzzlePlayer_Namespace
for (int j = 0; j < board.GetLength(1); j++)
{
// if the checked space is already filled in than it is not a valid move
if (board[i, j] != emptySpace)
continue;
if (SideCheck(i, j, board, checkFor) || MiddleCheck(i, j, board, checkFor))
continue;
if (EvenCheck(i, j, board, checkFor))
continue;
//if (board[i, j] != emptySpace)
// continue;
/*
// if one of the checks succeeds then it is an invalid move
......@@ -165,12 +160,40 @@ namespace PuzzlePlayer_Namespace
continue;
//*/
// if all checks pass then add the move to the list
choices.Add(new Move(i, j, checkFor));
if(board[i, j] == emptySpace && ValidChoiceCheck(i,j,board,checkFor))
choices.Add(new Move(i, j, checkFor));
}
}
return choices;
}
private static bool ValidChoiceCheck(int x, int y, int[,] board, int checkFor)
{
int opposite;
if(checkFor == 0)
opposite = 1;
else
opposite = 0;
if (SideCheck(x, y, board, checkFor))
{
//Debug.WriteLine("side check. return false");
return false;
}
if (MiddleCheck(x, y, board, checkFor))
{
//Debug.WriteLine("middle check. return false");
return false;
}
if(EvenCheck(x, y, board, checkFor))
return false;
return true;
}
private static bool IsBoardCompletlyFilledIn(int[,] board)
{
for (int i = 0; i < board.GetLength(0); i++)
......@@ -215,7 +238,7 @@ namespace PuzzlePlayer_Namespace
// check if it is a valid move
if (DoAllChecks(x, y, boardToSolve, opposite))
{
Debug.WriteLine($"true {x} {y} {i}");
//Debug.WriteLine($"true {x} {y} {i}");
return new Move(x, y, i);
}
......@@ -289,6 +312,10 @@ namespace PuzzlePlayer_Namespace
if(b[x,i] == checkFor) countCol++;
}
// if there are more counted then possible return false
if ((countRow) > b.GetLength(0) / 2 || (countCol) > b.GetLength(0) / 2)
return false;
// check if the total number of oppisite numbers is equal to half te widht/heigt
if (countRow == b.GetLength(0) / 2 || countCol == b.GetLength(1) / 2)
return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment