Fix Subtraction Game bugs

Update background color transition to fade instead of blink.
Change the minimum value for n to 2.
Debug and fix issues with the reset functionality not fully clearing the game state.
This commit is contained in:
gpt-engineer-app[bot] 2025-08-22 10:48:11 +00:00
parent 68b40be8ec
commit 4eab9a899b
2 changed files with 11 additions and 3 deletions

View file

@ -302,6 +302,9 @@ const BulgarianSolitaire: React.FC<BulgarianSolitaireProps> = ({ showSocialShare
pauseRef.current = false; pauseRef.current = false;
setIsPaused(false); setIsPaused(false);
setIsPlaying(false); setIsPlaying(false);
setDraggedBox(null);
setLastUsedColumn(null);
setSelectedBoxForMove(null);
const newBoxes: Box[] = []; const newBoxes: Box[] = [];
for (let i = 0; i < totalBoxes; i++) { for (let i = 0; i < totalBoxes; i++) {
@ -365,7 +368,7 @@ const BulgarianSolitaire: React.FC<BulgarianSolitaireProps> = ({ showSocialShare
<Slider <Slider
value={[n]} value={[n]}
onValueChange={(value) => setN(value[0])} onValueChange={(value) => setN(value[0])}
min={3} min={2}
max={45} max={45}
step={1} step={1}
className="w-32" className="w-32"
@ -440,7 +443,7 @@ const BulgarianSolitaire: React.FC<BulgarianSolitaireProps> = ({ showSocialShare
highlightedBoxes.has(boxId) highlightedBoxes.has(boxId)
? 'bg-red-500 text-white shadow-lg scale-110' ? 'bg-red-500 text-white shadow-lg scale-110'
: 'bg-primary text-primary-foreground hover:bg-primary/80' : 'bg-primary text-primary-foreground hover:bg-primary/80'
} ${isAnimating && highlightedBoxes.has(boxId) ? 'animate-pulse' : ''}`} } ${isAnimating && highlightedBoxes.has(boxId) ? 'animate-[fade-red_1.6s_ease-in-out_infinite]' : ''}`}
title="Drag to move or double-click to move to last-used column" title="Drag to move or double-click to move to last-used column"
> >
</div> </div>

View file

@ -100,11 +100,16 @@ export default {
to: { to: {
height: '0' height: '0'
} }
},
'fade-red': {
'0%, 100%': { backgroundColor: 'hsl(var(--primary))' },
'50%': { backgroundColor: 'hsl(0, 84%, 60%)' }
} }
}, },
animation: { animation: {
'accordion-down': 'accordion-down 0.2s ease-out', 'accordion-down': 'accordion-down 0.2s ease-out',
'accordion-up': 'accordion-up 0.2s ease-out' 'accordion-up': 'accordion-up 0.2s ease-out',
'fade-red': 'fade-red 1.6s ease-in-out infinite'
}, },
fontFamily: { fontFamily: {
'sans': ['Lato', 'ui-sans-serif', 'system-ui', '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Helvetica Neue', 'Arial', 'Noto Sans', 'sans-serif'], 'sans': ['Lato', 'ui-sans-serif', 'system-ui', '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Helvetica Neue', 'Arial', 'Noto Sans', 'sans-serif'],