|
@ -212,6 +212,13 @@ public class AIGridGUI extends JPanel { |
|
|
d = moveDown(d); |
|
|
d = moveDown(d); |
|
|
downCount++; |
|
|
downCount++; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int r = guessLocation; |
|
|
|
|
|
int rightCount = -1; |
|
|
|
|
|
while(r >= 0 && !cellsHit[r]) { |
|
|
|
|
|
r = moveRight(r); |
|
|
|
|
|
rightCount++; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -235,4 +242,13 @@ public class AIGridGUI extends JPanel { |
|
|
return dirDown; |
|
|
return dirDown; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int moveRight(int r) { |
|
|
|
|
|
int dirRight = r + 1; |
|
|
|
|
|
if((dirRight >= (rows * columns)) || (dirRight % columns == 0)) { |
|
|
|
|
|
return -1; |
|
|
|
|
|
} else { |
|
|
|
|
|
return dirRight; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |