Merge pull request #513 from guusdk/SPARK-2151_Reversi-indexoutofbounds

SPARK-2151: Prevent IndexOutOfBoundsException in Reversi
This commit is contained in:
wroot
2020-08-22 09:31:58 +03:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@
</parent> </parent>
<artifactId>reversi</artifactId> <artifactId>reversi</artifactId>
<version>1.5</version> <version>1.6</version>
<name>Reversi</name> <name>Reversi</name>
<description>Multiplayer game of Reversi.</description> <description>Multiplayer game of Reversi.</description>

View File

@ -329,7 +329,7 @@ public class ReversiModel {
} }
// Going down vertically. // Going down vertically.
if (position < 48) { if (position < 48) {
for (int i=position+8; i <= 65; i+=8) { for (int i=position+8; i <= 64; i+=8) {
if (board[i] == BLANK) { if (board[i] == BLANK) {
break; break;
} }
@ -438,4 +438,4 @@ public class ReversiModel {
return flipCount; return flipCount;
} }
} }