public int[] estPlacable(Case c, int isPlayerTurn) { int[] coordonnees = { -1, -1 }; if (!isInArray(c)) return coordonnees; if (!c.isEmpty() || !gameboard[c.x, c.y].isEmpty()) return coordonnees; if (noPlaceLeft-- <= 0) return coordonnees; if (!c.placePiece(isPlayerTurn == 0 ? false : true)) { noPlaceLeft++; //En cas de problème, on annule le coup précédent return coordonnees; } coordonnees[0] = c.x; coordonnees[1] = c.y; return coordonnees; }
public bool estPlacable(Case c, int isPlayerTurn) { if (!isInArray(c)) return false; if (!c.isEmpty() || !gameboard[c.x, c.y].isEmpty()) return false; if (noPlaceLeft-- <= 0) return false; if (!c.placePiece(isPlayerTurn == 0 ? false : true)) { noPlaceLeft++; //En cas de problème, on annule le coup précédent return false; } return true; }