Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plugin2027/piece.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ impl Piece {
pub fn shape(&self) -> HashSet<Coordinate> {
self.kind
.coordinates()
.flip(self.is_flipped)
.rotate(self.rotation)
.flip(self.is_flipped)
}

/// Die tatsächlichen Koordinaten, die der Stein am Ende auf dem Feld einnimmt.
Expand Down
15 changes: 6 additions & 9 deletions src/plugin2027/utils/game_rule_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,12 @@ impl GameRuleLogic {

let color = game_state.current_color();
for field in &valid_fields {
for (_variant_shape, rotation, is_flipped) in shape.variants() {
let area = shape.transform(rotation, is_flipped).area();
for x in (field.x - area.delta_x)..=field.x {
for y in (field.y - area.delta_y)..=field.y {
let position = Coordinate::new(x, y);
let piece = Piece::new(color, shape, rotation, is_flipped, position);
if Self::is_valid_set_move(game_state, &piece) {
moves.insert(piece);
}
for (variant_coordinates, rotation, is_flipped) in shape.variants() {
for anchor in &variant_coordinates {
let position = Coordinate::new(field.x - anchor.x, field.y - anchor.y);
let piece = Piece::new(color, shape, rotation, is_flipped, position);
if Self::is_valid_set_move(game_state, &piece) {
moves.insert(piece);
}
}
}
Expand Down
Loading