hotfixes - so we can at least run it #9

Merged
lgc merged 3 commits from hotfixes into main 2024-11-27 12:01:15 +00:00
2 changed files with 15 additions and 1 deletions
Showing only changes of commit b2a26c1f81 - Show all commits

View File

@ -2,4 +2,10 @@ import java.net.Socket;
public abstract class OnlinePlayer extends Player{
private Socket socket;
public OnlinePlayer(int size, Socket socket) {
super(size);
this.socket = socket;
//TODO Auto-generated constructor stub
}
}

View File

@ -1,3 +1,6 @@
import java.util.ArrayList;
import java.util.List;
import java.awt.Point;
public class SpecificAiPlayerMedium extends AiPlayer{
@ -13,7 +16,7 @@ public class SpecificAiPlayerMedium extends AiPlayer{
// Shoot at the enemy and receive the hit response
enemy.receiveShoot(nextShot);
HitResponse hitResponse = enemy.board.getHitResponsOnPoint(nextShot)
HitResponse hitResponse = enemy.board.getHitResponsOnPoint(nextShot);
// If it's a hit or sunk, add adjacent cells to the hitsQueue
if (hitResponse.getHitResponse() == HitResponseType.HIT) {
addAdjacentPoints(nextShot);
@ -58,6 +61,11 @@ public class SpecificAiPlayerMedium extends AiPlayer{
}
}
private boolean alreadyShot(Point p) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'alreadyShot'");
}
private boolean isValidPoint(Point point) {
return point.x >= 0 && point.x < board.getSize() &&
point.y >= 0 && point.y < board.getSize();