don't allow moving towers of the same color to empty spots

This commit is contained in:
Jana Dönszelmann 2026-01-02 15:03:54 +01:00
parent 727a738fd4
commit fc5872a5af
No known key found for this signature in database

View file

@ -280,6 +280,13 @@ impl<const TOWER_HEIGHT: usize> Game<TOWER_HEIGHT> {
continue; continue;
} }
let rings = self.towers[from_tower].rings;
if rings[1..].iter().all(|i| i == &rings[0])
&& self.towers[to_tower].rings[0].is_none()
{
continue;
}
let m = Move::new(from_tower, to_tower); let m = Move::new(from_tower, to_tower);
if self.try_make_move(m, true).is_ok() { if self.try_make_move(m, true).is_ok() {
res.push(m); res.push(m);