You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1013 B

package source;
import source.component.game.Cell;
import source.component.game.GamePanel;
public interface GameData {
String getDescription();
int getRowsNum();
int getColsNum();
int getMinesNum();
default int getPanelWidth() {
return getPanelWidth(getColsNum());
}
default int getPanelHeight() {
return getPanelHeight(getRowsNum());
}
static int getPanelWidth(int cellColumnsAmount) {
return cellColumnsAmount * Cell.CELL_WIDTH + GamePanel.GAME_BORDER_WIDTH * 2;
}
static int getPanelHeight(int cellRowsAmount) {
return cellRowsAmount * Cell.CELL_HEIGHT + GamePanel.GAME_BORDER_WIDTH * 2;
}
default boolean isNotSameWith(GameData data) {
if (data == null) {
return true;
}
if (this == data) {
return false;
}
return getRowsNum() != data.getRowsNum() || getColsNum() != data.getColsNum()
|| getMinesNum() != data.getMinesNum();
}
}