From f53b1e98f3b3dafddac97ad22d01ca4ed6bd6959 Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Thu, 15 Jul 2021 16:56:10 +0530 Subject: fixed 404 error because of build being in different directory --- build/static/js/main.67e91c3c.chunk.js.map | 1 + 1 file changed, 1 insertion(+) create mode 100644 build/static/js/main.67e91c3c.chunk.js.map (limited to 'build/static/js/main.67e91c3c.chunk.js.map') 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,E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,GACPK,EAAOL,GACPM,EAAON,GACPO,EAAQP,OCJdQ,IAASC,OACP,cAAC,IAAMC,WAAP,UACE,cAAC,EAAD,MAEFC,SAASC,eAAe,SAM1Bb,K","file":"static/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 .\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) => {\n return (\n
\n X: {props.scoreX}\n O: {props.scoreO}\n
\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 .\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) => {\n const handleClick = () => {\n props.sign === 2 &&\n props.setSign(props.index)\n }\n \n return (\n
\n {props.sign < 2 ? (props.sign === 1 ? \"X\" : \"O\") : \"\"}\n
\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 .\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>\n setScoreO: Dispatch>\n}\n\nconst Grid: React.FC = (props) => {\n // 0 is O, 1 is X, 2 is blank\n const [board, setBoard] = useState([2,2,2,2,2,2,2,2,2]);\n const [turn, setTurn] = useState(1);\n const [winner, setWinner] = useState(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
\n {\n board.map(\n (i, index) => \n \n )\n }\n
\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 .\n */\n\nimport React from 'react';\nimport './style.css';\n\nconst Footer: React.FC = () => {\n return (\n
\n

Tic Tac Toe Copyright (C) 2021 Vidhu Kant Sharma

\n

This program comes with ABSOLUTELY NO WARRANTY; for details refer to GNU GPL Licence.

\n

This is free software, and you are welcome to redistribute it under certain conditions; Refer to GNU GPL Licence for details

\n
\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 .\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(0);\n const [scoreO, setScoreO] = useState(0);\n return (\n <>\n \n \n