From 3b66a78800974f557b6e510fc98f9f5484da69b4 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:49:15 +0000 Subject: [PATCH] Explain pebble removal logic --- src/components/PebblePlacementGame.tsx | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/components/PebblePlacementGame.tsx b/src/components/PebblePlacementGame.tsx index a8300a9..5a740f0 100644 --- a/src/components/PebblePlacementGame.tsx +++ b/src/components/PebblePlacementGame.tsx @@ -71,18 +71,8 @@ const PebblePlacementGame: React.FC = ({ showSocialSha if (canRemovePebble(position)) { const newPlacedPebbles = new Set(placedPebbles); newPlacedPebbles.delete(position); - - // Cascade removal: remove any pebbles that become invalid - const sortedPebbles = Array.from(newPlacedPebbles).sort((a, b) => a - b); - for (const pebblePos of sortedPebbles) { - if (pebblePos > 1 && !newPlacedPebbles.has(pebblePos - 1)) { - newPlacedPebbles.delete(pebblePos); - } - } - - const pebblesRemoved = placedPebbles.size - newPlacedPebbles.size; setPlacedPebbles(newPlacedPebbles); - setPebblesInHand(pebblesInHand + pebblesRemoved); + setPebblesInHand(pebblesInHand + 1); } } else { // Try to place pebble @@ -171,7 +161,6 @@ const PebblePlacementGame: React.FC = ({ showSocialSha
  • • You can place a pebble on position i only if position (i-1) has a pebble
  • • You can remove a pebble from position i only if position (i-1) has a pebble
  • • The pebble on position 1 is always removable
  • -
  • • Removing a pebble may cascade and remove other pebbles that become invalid
  • • Goal: Place a pebble on the largest possible position