diff --git a/src/components/ParityBitsGame.tsx b/src/components/ParityBitsGame.tsx index 5897284..fa3ce72 100644 --- a/src/components/ParityBitsGame.tsx +++ b/src/components/ParityBitsGame.tsx @@ -148,8 +148,8 @@ const ParityBitsGame = ({ showSocialShare = true }: ParityBitsGameProps) => { colCounts }); - // Animate through rows - for (let i = 0; i < gridSize; i++) { + // Animate through rows (including parity row) + for (let i = 0; i <= gridSize; i++) { setAnimationState(prev => ({...prev, currentRow: i})); await new Promise(resolve => setTimeout(resolve, 800)); } @@ -158,13 +158,13 @@ const ParityBitsGame = ({ showSocialShare = true }: ParityBitsGameProps) => { setAnimationState(prev => ({...prev, currentRow: -1, showRowParity: true})); await new Promise(resolve => setTimeout(resolve, 1000)); - // Animate through columns - for (let j = 0; j < gridSize; j++) { + // Animate through columns (including parity column) + for (let j = 0; j <= gridSize; j++) { setAnimationState(prev => ({...prev, currentCol: j})); await new Promise(resolve => setTimeout(resolve, 800)); } - // Show column parities + // Show column parities and keep them persistent setAnimationState(prev => ({...prev, currentCol: -1, showColParity: true})); await new Promise(resolve => setTimeout(resolve, 1000)); @@ -176,17 +176,13 @@ const ParityBitsGame = ({ showSocialShare = true }: ParityBitsGameProps) => { setErrorDetected({row: errorRow, col: errorCol}); } - setAnimationState({ + // Keep labels persistent - don't reset them + setAnimationState(prev => ({ + ...prev, isAnimating: false, currentRow: -1, - currentCol: -1, - showRowParity: false, - showColParity: false, - rowParities: [], - colParities: [], - rowCounts: [], - colCounts: [] - }); + currentCol: -1 + })); setPhase('detect'); }; @@ -259,6 +255,8 @@ const ParityBitsGame = ({ showSocialShare = true }: ParityBitsGameProps) => { const isCurrentRowBeingChecked = animationState.currentRow === row; const isCurrentColBeingChecked = animationState.currentCol === col; const shouldHighlightForAnimation = isCurrentRowBeingChecked || isCurrentColBeingChecked; + const isBlackCell = currentGrid[row]?.[col]; + const highlightColor = isBlackCell ? 'ring-2 ring-orange-400 bg-orange-400/20' : 'ring-2 ring-yellow-400 bg-yellow-400/15'; return (