diff --git a/src/components/BulgarianSolitaire.tsx b/src/components/BulgarianSolitaire.tsx index 119cb4b..9c5a029 100644 --- a/src/components/BulgarianSolitaire.tsx +++ b/src/components/BulgarianSolitaire.tsx @@ -285,6 +285,25 @@ const BulgarianSolitaire: React.FC = ({ showSocialShare setIsAnimating(false); }; + const randomStart = () => { + // Reset first + reset(); + + // Randomly distribute all boxes into columns + const newBoxes: Box[] = []; + const newColumns = Array.from({ length: totalBoxes }, () => []); + + for (let i = 0; i < totalBoxes; i++) { + // Pick a random column index (ensure we use at least some columns) + const columnIndex = Math.floor(Math.random() * Math.min(totalBoxes, 8)); // Limit to 8 columns for better visualization + newBoxes.push({ id: i, columnIndex }); + newColumns[columnIndex].push(i); + } + + setBoxes(newBoxes); + setColumns(newColumns); + }; + const containerBoxes = boxes.filter(box => box.columnIndex === null); const handleBackgroundClick = () => { @@ -321,6 +340,9 @@ const BulgarianSolitaire: React.FC = ({ showSocialShare + {/* Container */}