Dodona may be unavailable on July 11th - Due to works at the UGent data centre on Friday July 11th, Dodona may be temporarily unavailable. We apologise for the inconvenience.
Warning! It seems that you are using Dodona within another webpage, so not everything may work properly. Let your teacher know so that he can solve the problem by adjusting a setting in the learning environment. In the meantime, you can click this link to open Dodona in a new window.
L-tiling
Sign in to test your solution.
public class DriekwartsBetegeling implements Betegeling {
public DriekwartsBetegeling(int k) {
/* ... */
}
public int zijde() {
/* ... */
return 0;
}
public int tegelnummer(int r, int c) {
/* ... */
return 0;
}
public void plaatsTegel(int r, int c, int d) {
/* ... */
}
public void betegel(int r, int c) {
/* ... */
}
public String toString() {
StringBuilder s = new StringBuilder();
String crlf = System.lineSeparator();
for(int r = 0; r < zijde(); r++) {
for(int c = 0; c < zijde(); c++) {
s.append('+');
if(1 > r || tegelnummer(r - 1, c) != tegelnummer(r, c)) s.append("--");
else s.append(" ");
}
s.append('+');
s.append(crlf);
for(int c = 0; c < zijde(); c++) {
if(1 > c || tegelnummer(r, c - 1) != tegelnummer(r, c)) s.append("|");
else s.append(" ");
s.append(String.format("%2d", tegelnummer(r, c) % 100));
}
s.append('|');
s.append(crlf);
}
for(int c = 0; c < zijde(); c++) {
s.append("+--");
}
s.append('+');
s.append(crlf);
return s.toString();
}
}
You can submit as many times as you like. Only your latest submission will be taken into account.
Sign in to test your solution.