Skip to content

Commit

Permalink
reset masks when resetting, because map size may have changed
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisSoemers committed Dec 19, 2023
1 parent 50a912f commit b7225f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/tests/JNIGridnetClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ public Response reset(int player) throws Exception {
ai2 = ai2.clone();
ai2.reset();
pgs = PhysicalGameState.load(mapPath, utt);
masks = new int[pgs.getHeight()][pgs.getWidth()][1+6+4+4+4+4+utt.getUnitTypes().size()+maxAttackRadius*maxAttackRadius];
gs = new GameState(pgs, utt);
if (partialObs) {
player1gs = new PartiallyObservableGameState(gs, player);
Expand Down
5 changes: 5 additions & 0 deletions src/tests/JNIGridnetClientSelfPlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ public String sendUTT() throws Exception {

public void reset() throws Exception {
pgs = PhysicalGameState.load(mapPath, utt);

for (int i = 0; i < numPlayers; i++) {
masks[i] = new int[pgs.getHeight()][pgs.getWidth()][1+6+4+4+4+4+utt.getUnitTypes().size()+maxAttackRadius*maxAttackRadius];
}

gs = new GameState(pgs, utt);
for (int i = 0; i < numPlayers; i++) {
playergs[i] = gs;
Expand Down

0 comments on commit b7225f1

Please sign in to comment.