mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 07:10:42 -08:00
MAINT: Apply pre-commit
Remove byte-order-marker pre-commit check as there would be many adjustments necessary
This commit is contained in:
@@ -155,7 +155,7 @@ public class Battle {
|
||||
|
||||
System.out.println("\n****************************\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ public class Input {
|
||||
System.out.println("Need two coordinates separated by ','");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
coords = new int[2];
|
||||
boolean error = false;
|
||||
// each field should contain an integer from 1 to the size of the sea
|
||||
// each field should contain an integer from 1 to the size of the sea
|
||||
try {
|
||||
for (int c = 0 ; c < 2; ++c ) {
|
||||
int val = Integer.parseInt(fields[c].strip());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Track the content of the sea
|
||||
// Track the content of the sea
|
||||
class Sea {
|
||||
// the sea is a square grid of tiles. It is a one-dimensional array, and this
|
||||
// class maps x and y coordinates to an array index
|
||||
@@ -20,11 +20,11 @@ class Sea {
|
||||
public String encodedDump() {
|
||||
StringBuilder out = new StringBuilder();
|
||||
for (int x = 0; x < size; ++x) {
|
||||
for (int y = 0; y < size; ++y)
|
||||
for (int y = 0; y < size; ++y)
|
||||
out.append(Integer.toString(get(x, y)));
|
||||
out.append('\n');
|
||||
}
|
||||
return out.toString();
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
/* return true if x,y is in the sea and empty
|
||||
|
||||
@@ -17,7 +17,7 @@ class Ship {
|
||||
private boolean placed; // whether this ship is in the sea yet
|
||||
private boolean sunk; // whether this ship has been sunk
|
||||
private ArrayList<Boolean> hits; // which tiles of the ship have been hit
|
||||
|
||||
|
||||
private int startX; // starting position coordinates
|
||||
private int startY;
|
||||
private int orientX; // x and y deltas from each tile occupied to the next
|
||||
|
||||
Reference in New Issue
Block a user