i ja sa hlasim poctivo nato, moc ma to sere ze to bude v lete ale co uz... tak je sanca ze to nebude mat boss shroter ?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Zobrazi» príspevky MenuQuote from: m@T0 on 19.03.2009, 14:40:24leQuote from: stiffmaister on 19.03.2009, 14:02:13malo by to byt takto:
vie niekto implementovat metodu void update() v triede ConsoleUI, ktora zabezpeci vykreslenie herneho pola?
public void update() {
char[] alfa = {' ','A','B','C','D','E','F','G','H','I'};
for(int i=-1;i<field.getRowCount();i++) {
for(int j=0;j<field.getColumnCount();j++) {
if(j==0) {
// vypise prazdny znak az I
System.out.printf("%s",alfa[i+1]);
}
if(i==-1) {
// vypise 0 az 9
System.out.printf("%3d", j);
}
else {
// vypise hracie pole
Tile tile = field.getTile(i, j);
if(tile.getState() == Tile.State.OPEN) {
if(tile instanceof Mine) {
System.out.printf("%3s", "X");
}
else if(tile instanceof Clue) {
// potreba pretypovania Tile na Clue,
// aby som mohol pouzit metodu getValue()
System.out.printf("%3d", ((Clue) tile).getValue());
}
}
else if(tile.getState() == Tile.State.MARKED) {
System.out.printf("%3s", "M");
}
else {
System.out.printf("%3s", "-");
}
}
}
System.out.print("\n");
}
}