I'm writing a chess game, to be played over
a socket. In my eyes, a function that made
a chess move would have to do something
about like this:
int move(int old_r, int old_c, int new_r, int new_c)
{
if (checkMov(old_r, old_c, new_r, new_c)) {
board[new_r][new_c] = board[old_r][old_c];
board[old_r][old_c] = 0;
}
else printf("Invalid move.\n");
return 0;
}
My question is, how would a function that
examines if a move is valid work? I'm thinking that I could use a bunch of nested
conditionals, but that would be kind of nasty.
Does anyone else have a better way?
Thanks in Advance,
Transmitt