I am writing a game simulation that tests if any piece is on the board. If a piece is not I would like the AI to place a piece on the board, for this I created a bool function to test if all the pieces are set to 0 which means they are yet to enter the board. The current function boots, but I feel there is a much simpler way to do this:
bool checkPiece(int a[])
{
int n = 0;
bool e = true;
while (e == true && n < 4)
{
if (a[n] == 0 )
{
n++;
}
else
{
return false;
}
}
return true;
}