Skip to content

Commit

Permalink
Fix map index: corner reflections were not handled properly; bots did…
Browse files Browse the repository at this point in the history
… not see 'reflected' blocks in case of both x and y reflections
  • Loading branch information
Evgeny Pisarenko committed Jul 5, 2022
1 parent a39a561 commit ca9a1ea
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion server/src/main/java/ru/croccode/hypernull/match/MapIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,19 @@ public MapIndex(MatchMap map) {
: freeBuilder;
Point value = new Point(x, y);
target.add(new Point(x, y), value);

// reflections of the
// map quadrants:
// 4 3 4 3
// 1 2 1 2
// 4 3 4 3
// 1 2 1 2

int dx = x < w / 2 ? w : -w;
target.add(new Point(x + dx, y), value);
int dy = y < h / 2 ? h : -h;
target.add(new Point(x + dx, y), value);
target.add(new Point(x, y + dy), value);
target.add(new Point(x + dx, y + dy), value);
}
}

Expand Down

0 comments on commit ca9a1ea

Please sign in to comment.