|
@ -206,6 +206,12 @@ public class AIGridGUI extends JPanel { |
|
|
u = moveUp(u); |
|
|
u = moveUp(u); |
|
|
upCount++; |
|
|
upCount++; |
|
|
} |
|
|
} |
|
|
|
|
|
int d = guessLocation; |
|
|
|
|
|
int downCount = -1; |
|
|
|
|
|
while(d >= 0 && !cellsHit[d]) { |
|
|
|
|
|
d = moveDown(d); |
|
|
|
|
|
downCount++; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -221,4 +227,12 @@ public class AIGridGUI extends JPanel { |
|
|
return dirUp; |
|
|
return dirUp; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
public int moveDown(int d) { |
|
|
|
|
|
int dirDown = d + columns; |
|
|
|
|
|
if(dirDown >= (rows*columns)) { |
|
|
|
|
|
return -1; |
|
|
|
|
|
} else { |
|
|
|
|
|
return dirDown; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |