Added several improvements IX

This commit is contained in:
Robert Vokac 2024-01-13 13:16:56 +00:00
parent 0dc51a1b55
commit 1f1b680266
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055

View File

@ -179,9 +179,9 @@ public class Main {
int spacesDone = (int) (percent * 52);
int spacesTodo = spacesTotal - spacesDone;
System.out.println(
WALL + createSpaces(spacesDone) + " () " + createSpaces(spacesTodo) + WALL + (spacesTodo == 0 ? "*GO*" :"XXXX") + WALL + NEW_LINE +
WALL + createSpaces(spacesDone) + "/||\\" + createSpaces(spacesTodo) + WALL + (spacesTodo == 0 ? "HOME" :"XXXX") + WALL + NEW_LINE +
WALL + createSpaces(spacesDone) + " /\\ " + createSpaces(spacesTodo) + WALL + (spacesTodo == 0 ? "!!!!" :"XXXX") + WALL + NEW_LINE +
WALL + createSpaces(spacesDone) + " () " + createOneZeroes(spacesTodo) + WALL + (spacesTodo == 0 ? "*GO*" :"XXXX") + WALL + NEW_LINE +
WALL + createSpaces(spacesDone) + "/||\\" + createOneZeroes(spacesTodo) + WALL + (spacesTodo == 0 ? "HOME" :"XXXX") + WALL + NEW_LINE +
WALL + createSpaces(spacesDone) + " /\\ " + createOneZeroes(spacesTodo) + WALL + (spacesTodo == 0 ? "!!!!" :"XXXX") + WALL + NEW_LINE +
"=================================================================="
);
@ -189,9 +189,19 @@ public class Main {
}
private static final String createSpaces(int spaceCount) {
return create(spaceCount, ' ');
}
private static final String create(int count, char ch) {
StringBuilder sb = new StringBuilder();
for(int i = 1; i <= spaceCount; i++) {
sb.append(" ");
for(int i = 1; i <= count; i++) {
sb.append(ch);
}
return sb.toString();
}
private static final String createOneZeroes(int count) {
StringBuilder sb = new StringBuilder();
for(int i = 1; i <= count; i++) {
sb.append(Math.random() > 0.5 ? "1" : "0");
}
return sb.toString();
}