// constructor with baordSize parameter (default is set to 8 but can be changed)
// constructor with baordSize parameter (default is set to 8 but can be changed)
publicBinary(intboardSize=8)
publicBinary(intboardSize=8):base(boardSize)
{
{
// create a clear board with the specifide size
// create a clear board with the specifide size
boardState=GetClearBoard(boardSize);
setBoardState(GetClearBoard(boardSize));
description="Binary puzzle is played on any even-numbered square grid, with some cells initially containing black or white circles. The goal of the puzzle is to fill all cells such that:\r\n- More than two circles of the same color cannot be adjacent\r\n- Each row and column must contain an equal number of black and white circles\r\n- Each row and column cannot appear multiple times on the board";
description="Binary puzzle is played on any even-numbered square grid, with some cells initially containing black or white circles. The goal of the puzzle is to fill all cells such that:\r\n- More than two circles of the same color cannot be adjacent\r\n- Each row and column must contain an equal number of black and white circles\r\n- Each row and column cannot appear multiple times on the board";
// if both 1 and 0 are valid then something went wrong
// check if it is a valid move
if(validForZero&&validForOne)
if(IsValidMove(m,boardToSolve))
returnnull;
returnm;
}
// change the specifided place in a 0 or 1 if they are valid. if both are not valid then there is no valid move on the checked space and null is returnd.
// if both 0 and 1 fail, then the move is invalid and null is returned
if(validForZero)
returnnull;
returnnewMove(x,y,0);
elseif(validForOne)
returnnewMove(x,y,1);
else
returnnull;
}
}
// check if the space is surrounded on both sides by the same number. If it is, the checked space should be the opposite number
// check if the space is surrounded on both sides by the same number. If it is, the checked space should be the opposite number
// every row and colom should have an even number of 1'boardSize and 0'boardSize. So if the total number of 1'boardSize in a row is equal to half the with of the row a 0 should be filled in.
// every row and colom should have an even number of 1'boardSize and 0'boardSize. So if the total number of 1'boardSize in a row is equal to half the with of the row a 0 should be filled in.