Witam,
nie wiem jak reprezentujesz plansze. Dajmy na to że tak
char board[10][10] = {
'e', 'e', '1', 'e', '2', '2', ....
'e', 'e', 'e','e', 'e', 'e', ....
'3','3','3',....
....
'4','4','e','e','e',...
'e','e','4','4','e',...
};
Następnie tworzysz funkcje które sprawdzają czy względem jakiegoś punktu sąsiedni punkt jest pusty np:
bool isLeftEmpty(int x, int y)
{
if( board[x-1][y] == 'e')
return true;
return false;
}
bool isRightEmpty(int x, int y);
bool isUpEmpty(int x, int y);
bool isDownEmpty(int x, int y);
bool isTopLeftEmpty(int x, int y);
bool isTopRightEmpty(int x, int y);
bool isBottomLeftEmpty(int x, int y);
bool isBottomRightEmpty(int x, int y);
Następnie możesz wykorzystać te funkcje do sprawdzenia pol w zależności od potrzeb. Np
if(isLeftEmpty(x,y) && isRightEmpty(x,y) && isDownEmpty(x,y))
{
// zrob cos
}