-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathSimpleShip.java
More file actions
34 lines (30 loc) · 821 Bytes
/
SimpleShip.java
File metadata and controls
34 lines (30 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package esi18;
import battleship.core.*;
import java.util.List;
/*
* SimpleShip
* @author Your Name
*/
public class SimpleShip extends Ship {
public SimpleShip() {
this.initializeName("Simple Ship");
this.initializeOwner("Your Name");
this.initializeHull(1);
this.initializeFirepower(1);
this.initializeSpeed(1);
this.initializeRange(1);
}
/*
* Determines what actions the ship will take on a given turn
* @param arena (Arena) the battlefield for the match
* @return void
*/
@Override
protected void doTurn(Arena arena) {
this.move(arena, Direction.EAST);
Coord location = this.getCoord();
int x = location.getX();
int y = location.getY();
this.fire(arena, x+1, y);
}
}