From 045314e5a15bf4d8a43dcc250d74d2e77cb3e4be Mon Sep 17 00:00:00 2001 From: prathoseraaj Date: Fri, 3 Oct 2025 14:52:17 +0530 Subject: [PATCH] fix: grid issues --- memory-game/components/MemoryGame.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/memory-game/components/MemoryGame.jsx b/memory-game/components/MemoryGame.jsx index 2ab63222..1f3741ad 100644 --- a/memory-game/components/MemoryGame.jsx +++ b/memory-game/components/MemoryGame.jsx @@ -22,12 +22,12 @@ const MemoryGame = () => { const [won, setWon] = useState(false); - const handleGridSize = (e) => { - const size = parseInt(e.target.value); - if (2 <= size && size <= 10) { - setGridSize(size); - } - }; +const handleGridSize = (e) => { + const size = parseInt(e.target.value); + if (2 <= size && size <= 10 && (size * size) % 2 === 0) { + setGridSize(size); + } +}; const initializeGame = useCallback(() => { const totalCards = gridSize * gridSize;