I'm creating a game in C++ (speaking of which, does the code I use matter?), which coudl be loosely described as a board game, and I'm wondering which of these two "check if character is out of bounds" functions is more efficient:
ONE:
int main()
{
//display board
//get player input
//move player
//if player is out of bounds,
//force player back into bounds
}
TWO
//int main()
{
//same thing, except without last two lines.
}
void move(char input)
{
//if input does not place player out of bounds
//move player according to input
}
Essentially, the first one moves every entity, then checks all of the entities positions and resets them accordingly, and the second one makes sure that the players move does not move him out of bounds, reather than waiting until the end of the loop.
I would like to know which of these two (systems?) is more efficient or faster than the other, or, if they're both equal, which one of these would be a better coding style?