2 台の戦車を互いに対戦させるプログラムを作成しています。ゲームを終了させる火以外のすべてのメソッドを作成しました。ここのところ
public class Tank {
Tank() {
int xPos, yPos;
char direction;
boolean loaded = 0;
}
public void move(Tank currentPlayer) {
if (yPos<=4 && yPos>=0) {
if (xPos<=4 && xPos>=0) {
if (currentPlayer.direction == 'u') {
currentPlayer.yPos--;
}
if (currentPlayer.direction == 'd') {
currentPlayer.yPos++;
}
if (currentPlayer.direction == 'l') {
currentPlayer.xPos--;
}
if (currentPlayer.direction == 'r') {
currentPlayer.xPos++;
}
}
}
}
public void turn(boolean bool, Tank currentPlayer) {
if (currentPlayer.direction == 'u') {
currentPlayer.direction ='r';
}
if (currentPlayer.direction == 'd') {
currentPlayer.direction = 'l';
}
if (currentPlayer.direction == 'l') {
currentPlayer.direction ='u';
}
if (currentPlayer.direction == 'r') {
currentPlayer.direction ='d';
}
}
public void load(Tank currentPlayer) {
currentPlayer.loaded=true;
}
public int fire(Tank currentPlayer, Tank jim) {
// ???
}
}
プログラムを終了するにはどうすればよいですか? どんな助けでも大歓迎です。