Skip to content

Conversation

@msmilkshake
Copy link

No description provided.

Comment on lines 218 to 283
public void hijackStart() {
String[] board = {
"OOOOO~~~~~",
"~~~~~~~~~~",
"OOOO~~~~~~",
"~~~~~~~~~~",
"OOO~~~~~~~",
"~~~~~~~~~~",
"OOO~~~~~~~",
"~~~~~~~~~~",
"OO~~~~~~~~",
"~~~~~~~~~~"
};
Board p1 = new Board();
p1.hijackField(board);

Board p2 = new Board();
p2.hijackField(board);

playerOneField = p1;
playerTwoField = p2;

List<Ship> ships = new ArrayList<>(Arrays.asList(
new Ship(5, "Aircraft Carrier"),
new Ship(4, "Battleship"),
new Ship(3, "Submarine"),
new Ship(3, "Cruiser"),
new Ship(2, "Destroyer")
));
playerOneShips.addAll(ships);

ships = new ArrayList<>(Arrays.asList(
new Ship(5, "Aircraft Carrier"),
new Ship(4, "Battleship"),
new Ship(3, "Submarine"),
new Ship(3, "Cruiser"),
new Ship(2, "Destroyer")
));
playerTwoShips.addAll(ships);

int[][] nums = {
{0, 0, 4, 0},
{0, 2, 3, 2},
{0, 4, 2, 4},
{0, 6, 2, 6},
{0, 8, 1, 8}
};

for (int i = 0; i < 5; ++i) {
playerOneShips.get(i).setRowMin(nums[i][0]);
playerOneShips.get(i).setColMin(nums[i][1]);
playerOneShips.get(i).setRowMax(nums[i][2]);
playerOneShips.get(i).setColMax(nums[i][3]);

playerTwoShips.get(i).setRowMin(nums[i][0]);
playerTwoShips.get(i).setColMin(nums[i][1]);
playerTwoShips.get(i).setRowMax(nums[i][2]);
playerTwoShips.get(i).setColMax(nums[i][3]);
}

playerOneShipsOnField = playerOneField.totalShips();
playerTwoShipsOnField = playerTwoField.totalShips();

gameplay();
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice little method to bypass the starting phases, I like it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants