I've been attempting many different ways to make this work and I either come up with everything stopping once the game looks like it's been won and an "illegal move" and "retry" message, or I end up with a successful end "ftw" when in fact it's not actually won. (See result below code).
So sorry to repeat similar questions. I can't seem to find the answers in what I've reviewed from others. Where am I going wrong?
bool won(void)
{
// TODO
for (int i = 0; i < d - 1; i++)
{
for (int j = 0;j < d - 1;j++)
{
if (board[d - 1][d - 1] == 0)
{
if (board[0][0] == 1 && board [i][j - 2] < board[i][j - 1])
{
return true;
}
}
}
}
{
return false;
}
}
Here's what I get with this:
1 2 3
4 8 7
6 5 _
ftw!