public static bool CheckTop(int size, Matchfield matchfield, char aktPlayer, char nxtPlayer, int yPos, int x) { bool stoneOfNextPlayerFound = false; for (int y = yPos - 1; y >= 0 && y <= size - 1; y--) { char currentFieldValue = matchfield.GetField(y, x); if (currentFieldValue == ' ') { return(false); } if (currentFieldValue == nxtPlayer) { stoneOfNextPlayerFound = true; continue; } if (currentFieldValue == aktPlayer && stoneOfNextPlayerFound) { return(true); } else { return(false); } } return(false); }
public static bool CheckBottomRightNextTurn(int size, Matchfield matchfield, char aktPlayer, char nxtPlayer, int yPos, int xPos) { bool stoneOfNextPlayerFound = false; for (int y = yPos + 1, x = xPos + 1; x >= 0 && x <= size - 1 && y >= 0 && y <= size - 1; x++, y++) { char currentFieldValue = matchfield.GetField(y, x); if (currentFieldValue == ' ') { return(false); } if (currentFieldValue == aktPlayer) { stoneOfNextPlayerFound = true; continue; } if (currentFieldValue == nxtPlayer && stoneOfNextPlayerFound) { return(true); } else { return(false); } } return(false); }