diff options
Diffstat (limited to 'build/static/js/main.67e91c3c.chunk.js.map')
-rw-r--r-- | build/static/js/main.67e91c3c.chunk.js.map | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/build/static/js/main.67e91c3c.chunk.js.map b/build/static/js/main.67e91c3c.chunk.js.map new file mode 100644 index 0000000..de12d5c --- /dev/null +++ b/build/static/js/main.67e91c3c.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["components/ScoreBoard.tsx","components/Box.tsx","components/Grid.tsx","components/Footer.tsx","components/App.tsx","reportWebVitals.ts","index.tsx"],"names":["ScoreBoard","props","className","scoreX","scoreO","Box","onClick","sign","setSign","index","Grid","useState","board","setBoard","turn","setTurn","winner","setWinner","getBoard","slice","concat","allEqual","arr","includes","every","v","getRow","r","getCol","c","length","getLeftDiagonal","i","getRightDiagonal","checkHorMatch","rowNum","checkVerMatch","colNum","checkDiagonalMatch","endGame","gameWinner","alert","setScoreX","setScoreO","useEffect","map","Footer","href","App","reportWebVitals","onPerfEntry","Function","then","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","StrictMode","document","getElementById"],"mappings":"iLAmCeA,EATqB,SAACC,GACnC,OACE,sBAAKC,UAAW,aAAhB,UACE,uCAAUD,EAAME,UAChB,uCAAUF,EAAMG,cCUPC,EAbc,SAACJ,GAM5B,OACE,qBAAKC,UAAW,MAAOI,QANL,WACH,IAAfL,EAAMM,MACJN,EAAMO,QAAQP,EAAMQ,QAItB,SACGR,EAAMM,KAAO,EAAoB,IAAfN,EAAMM,KAAa,IAAM,IAAO,MC0D1CG,EAhEe,SAACT,GAAU,MAEbU,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAFvB,mBAEhCC,EAFgC,KAEzBC,EAFyB,OAGfF,mBAAiB,GAHF,mBAGhCG,EAHgC,KAG1BC,EAH0B,OAIXJ,mBAAiB,GAJN,mBAIhCK,EAJgC,KAIxBC,EAJwB,KAMjCC,EAAW,SAAC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js/main.67e91c3c.chunk.js","sourcesContent":["/*\n * Tic Tac Toe - Minimalistic Tic Tac Toe\n * Copyright (C) 2021 Vidhu Kant Sharma\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport React from 'react';\nimport './style.css';\n\ninterface Props {\n scoreX: number\n scoreO: number\n}\n\nconst ScoreBoard: React.FC<Props> = (props) => {\n return (\n <div className={\"ScoreBoard\"}>\n <span>X: {props.scoreX}</span>\n <span>O: {props.scoreO}</span>\n </div>\n );\n}\n\nexport default ScoreBoard;\n","/*\n * Tic Tac Toe - Minimalistic Tic Tac Toe\n * Copyright (C) 2021 Vidhu Kant Sharma\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport React from 'react';\nimport './style.css';\n\ninterface Props {\n sign: number\n index: number\n setSign: (index: number) => void\n}\n\nconst Box: React.FC<Props> = (props) => {\n const handleClick = () => {\n props.sign === 2 &&\n props.setSign(props.index)\n }\n \n return (\n <div className={\"Box\"} onClick={handleClick}>\n {props.sign < 2 ? (props.sign === 1 ? \"X\" : \"O\") : \"\"}\n </div>\n );\n}\n\nexport default Box;\n","/*\n * Tic Tac Toe - Minimalistic Tic Tac Toe\n * Copyright (C) 2021 Vidhu Kant Sharma\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport React, { useState, useEffect, Dispatch, SetStateAction } from 'react';\nimport Box from './Box';\nimport './style.css';\n\ninterface Props {\n scoreX: number\n scoreO: number\n setScoreX: Dispatch<SetStateAction<number>>\n setScoreO: Dispatch<SetStateAction<number>>\n}\n\nconst Grid: React.FC<Props> = (props) => {\n // 0 is O, 1 is X, 2 is blank\n const [board, setBoard] = useState<number[]>([2,2,2,2,2,2,2,2,2]);\n const [turn, setTurn] = useState<number>(1);\n const [winner, setWinner] = useState<number>(2)\n\n const getBoard = (index: number) => {\n setBoard(board.slice(0, index).concat(turn).concat(board.slice(index+1, 9)));\n setTurn(turn === 1 ? 0 : 1)\n }\n\n const allEqual = (arr: number[]) => arr.includes(2) ? false : arr.every(v => v === arr[0])\n\n const getRow = (r: number) => board.slice(r * 3, (r * 3) + 3);\n\n const getCol: any = (c: number, arr=board) => arr.length <= 3 ? arr[c] : [arr[c]].concat(getCol(c, arr.slice(3)))\n\n const getLeftDiagonal: any = (i: number = 0) =>\n i < 3 ? [getRow(i)[i]].concat(getLeftDiagonal(i+1)) : [];\n\n const getRightDiagonal: any = (i: number = 2) =>\n i >= 0 ? [getRow(2-i)[i]].concat(getRightDiagonal(i-1)) : [];\n\n const checkHorMatch: any = (rowNum: number = 0) =>\n rowNum <= 2 && (allEqual(getRow(rowNum)) ? setWinner(turn === 1 ? 0 : 1) : checkHorMatch(rowNum+1))\n\n const checkVerMatch: any = (colNum: number = 0) =>\n colNum <= 2 && (allEqual(getCol(colNum)) ? setWinner(turn === 1 ? 0 : 1) : checkVerMatch(colNum+1))\n\n const checkDiagonalMatch: any = () => {\n (allEqual(getLeftDiagonal()) || allEqual(getRightDiagonal())) && setWinner(turn === 1 ? 0 : 1)\n }\n\n const endGame = (winner: number) => {\n const gameWinner = winner < 2 ? (winner === 1 ? \"X\" : \"O\") : \"Draw\";\n alert(`WINNER: ${gameWinner}`)\n gameWinner === \"Draw\" || gameWinner === \"X\" \n ? props.setScoreX(props.scoreX + 1) \n : props.setScoreO(props.scoreO + 1)\n // clean up\n setBoard([2,2,2,2,2,2,2,2,2]);\n setWinner(2);\n }\n\n useEffect(() => {\n checkHorMatch();\n checkVerMatch();\n checkDiagonalMatch();\n winner < 2 && endGame(winner);\n board.includes(2) || endGame(2);\n })\n\n return (\n <div className=\"Grid\">\n {\n board.map(\n (i, index) => \n <Box key={index} index={index} sign={i} setSign={getBoard}/>\n )\n }\n </div>\n );\n}\n\nexport default Grid;\n","/*\n * Tic Tac Toe - Minimalistic Tic Tac Toe\n * Copyright (C) 2021 Vidhu Kant Sharma\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport React from 'react';\nimport './style.css';\n\nconst Footer: React.FC = () => {\n return (\n <div className={\"Footer\"}>\n <p><a href=\"https://github.com/MikunoNaka/tic-tac-toe\">Tic Tac Toe</a> Copyright (C) 2021 Vidhu Kant Sharma</p>\n <p>This program comes with ABSOLUTELY NO WARRANTY; for details refer to <a href=\"https://www.gnu.org/licenses/gpl-3.0.en.html\">GNU GPL Licence.</a></p>\n <p>This is free software, and you are welcome to redistribute it under certain conditions; Refer to <a href=\"https://www.gnu.org/licenses/gpl-3.0.en.html\">GNU GPL Licence</a> for details</p>\n </div>\n );\n}\n\nexport default Footer;\n","/*\n * Tic Tac Toe - Minimalistic Tic Tac Toe\n * Copyright (C) 2021 Vidhu Kant Sharma\n * \n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport React, { useState } from 'react';\nimport ScoreBoard from './ScoreBoard';\nimport Grid from './Grid';\nimport Footer from './Footer';\nimport './style.css';\n\nconst App: React.FC = () => {\n const [scoreX, setScoreX] = useState<number>(0);\n const [scoreO, setScoreO] = useState<number>(0);\n return (\n <>\n <ScoreBoard scoreX={scoreX} scoreO={scoreO}/>\n <Grid scoreX={scoreX} setScoreX={setScoreX} scoreO={scoreO} setScoreO={setScoreO}/>\n <Footer/>\n </>\n );\n}\n\nexport default App;\n","import { ReportHandler } from 'web-vitals';\n\nconst reportWebVitals = (onPerfEntry?: ReportHandler) => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './components/App';\nimport reportWebVitals from './reportWebVitals';\n\nReactDOM.render(\n <React.StrictMode>\n <App />\n </React.StrictMode>,\n document.getElementById('root')\n);\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""}
\ No newline at end of file |