|
@ -219,6 +219,13 @@ public class AIGridGUI extends JPanel { |
|
|
r = moveRight(r); |
|
|
r = moveRight(r); |
|
|
rightCount++; |
|
|
rightCount++; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int l = guessLocation; |
|
|
|
|
|
int leftCount = -1; |
|
|
|
|
|
while(l >= 0 && !cellsHit[l]) { |
|
|
|
|
|
l = moveLeft(l); |
|
|
|
|
|
leftCount++; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -251,4 +258,12 @@ public class AIGridGUI extends JPanel { |
|
|
return dirRight; |
|
|
return dirRight; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
public int moveLeft(int l) { |
|
|
|
|
|
int dirLeft = l - 1; |
|
|
|
|
|
if((dirLeft < 0) || (l % columns == 0)) { |
|
|
|
|
|
return -1; |
|
|
|
|
|
} else { |
|
|
|
|
|
return dirLeft; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |