This bit of code is supposed to be adding a letter to a single tile, but the way it's currently written it's adding a letter to several tiles. How do I fix that? Thanks.
public void add(char c) {
for (int row = 0; row < 4; row++){
for (int col = 0; col < 4; col++){
if (tiles[row][col] != null && tiles[row][col].getLetter() == null){
tiles[row][col].setLetter(letters.pop());
notifyObservers();
break;
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire