-
Notifications
You must be signed in to change notification settings - Fork 0
/
src.a2995b6b.js.map
1 lines (1 loc) · 40 KB
/
src.a2995b6b.js.map
1
{"version":3,"sources":["setup.js","../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../node_modules/@babel/runtime/helpers/iterableToArray.js","../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../node_modules/@babel/runtime/helpers/toConsumableArray.js","../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../node_modules/@babel/runtime/helpers/nonIterableRest.js","../node_modules/@babel/runtime/helpers/slicedToArray.js","../node_modules/@babel/runtime/helpers/classCallCheck.js","../node_modules/@babel/runtime/helpers/createClass.js","../node_modules/@babel/runtime/helpers/defineProperty.js","PacmanQueue.js","helper.js","GameBoard.js","Pacman.js","Ghost.js","ghostMoves.js","index.js"],"names":["GRID_SIZE","CELL_SIZE","DIRECTIONS","ArrowLeft","code","movement","rotation","ArrowUp","ArrowRight","ArrowDown","OBJECT_TYPE","BLANK","WALL","DOT","BLINKY","PINKY","INKY","CLYDE","PILL","PACMAN","GHOST","SCARED","GHOSTLAIR","CLASS_LIST","LEVEL","PacQueue","pushStack","pullStack","size","value","push","length","console","err","elem","pop","pushStackLength","i","poll","hslToRgb","h","s","l","r","g","b","hue2rgb","p","q","t","Math","round","GameBoard","DOMGrid","pos","object","grid","classList","contains","dotCount","level","innerHTML","style","cssText","forEach","squareValue","div","document","createElement","add","random","max","append","classes","remove","theClass","background","deg","transform","character","shouldMove","getNextMove","objectExists","bind","nextMovePos","direction","makeMove","classesToRemove","classesToAdd","rotateDiv","dir","removeObject","addObject","setNewPos","gameWin","board","createGrid","Pacman","speed","timer","powerPill","e","keyCode","key","Ghost","startPos","name","isScared","objectExist","nextPos","randomMovement","position","keys","Object","floor","bestBFSMovement","bfs","ghostPos","N","visited","Array","fill","backtrack","foundPacman","pacmanPos","empty","front","neighbors","neigh","log","curr","traceback","soundDot","soundPill","soundGameStart","soundGameOver","soundGhost","gameGrid","querySelector","scoreTable","startButton","levels","gameBoard","createGameboard","POWER_PILL_TIME","GLOBAL_SPEED","score","currentLevel","powerPillActive","powerPillTimer","playAudio","effect","Audio","play","gameOver","pacman","removeEventListener","handleKeyInput","showGameStatus","clearInterval","checkCollision","ghosts","collidedGhost","find","ghost","gameLoop","moveCharacter","clearTimeout","setTimeout","startGame","addEventListener","setInterval","target","querySelectorAll","butt","levelStr","id","parseInt"],"mappings":";AAsDO,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,MAAA,QAAA,WAAA,QAAA,YAAA,QAAA,WAAA,QAAA,UAAA,QAAA,eAAA,EAtDA,IAAMA,EAAY,GAsDlB,QAAA,UAAA,EArDA,IAAMC,EAAY,GAqDlB,QAAA,UAAA,EApDA,IAAMC,EAAa,CACxBC,UAAW,CACTC,KAAM,GACNC,UAAW,EACXC,SAAU,KAEZC,QAAS,CACPH,KAAM,GACNC,UAAWL,EACXM,SAAU,KAEZE,WAAY,CACVJ,KAAM,GACNC,SAAU,EACVC,SAAU,GAEZG,UAAW,CACTL,KAAM,GACNC,SAAUL,EACVM,SAAU,KAiCP,QAAA,WAAA,EA7BA,IAAMI,EAAc,CACzBC,MAAO,QACPC,KAAM,OACNC,IAAK,MACLC,OAAQ,SACRC,MAAO,QACPC,KAAM,OACNC,MAAO,QACPC,KAAM,OACNC,OAAQ,SACRC,MAAO,QACPC,OAAQ,SACRC,UAAW,QAiBN,QAAA,YAAA,EAbA,IAAMC,EAAa,CACxBb,EAAYC,MACZD,EAAYE,KACZF,EAAYG,IACZH,EAAYI,OACZJ,EAAYK,MACZL,EAAYM,KACZN,EAAYO,MACZP,EAAYQ,KACZR,EAAYS,OACZT,EAAYY,WAGP,QAAA,WAAA,EAAA,IAAME,EAAQ,CACnB,EAAG,EAAG,EAAG,EAAG,EAAG,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AKrH,UAAUiB,OAAO,YAEjD2B,EAAEuE,OAAOnH,UAAUY,IAAI,UACjB0G,IAAAA,EAAW1E,EAAEuE,OAAOI,GACpBpH,EAAQqH,SAASF,EAASA,EAAShJ,OAAS,IAClDoH,EAAevF","file":"src.a2995b6b.js","sourceRoot":"src","sourcesContent":["export const GRID_SIZE = 20;\nexport const CELL_SIZE = 25; // in pixels\nexport const DIRECTIONS = {\n ArrowLeft: {\n code: 37,\n movement: -1,\n rotation: 180\n },\n ArrowUp: {\n code: 38,\n movement: -GRID_SIZE,\n rotation: 270\n },\n ArrowRight: {\n code: 39,\n movement: 1,\n rotation: 0\n },\n ArrowDown: {\n code: 40,\n movement: GRID_SIZE,\n rotation: 90\n }\n};\n\nexport const OBJECT_TYPE = {\n BLANK: 'blank',\n WALL: 'wall',\n DOT: 'dot',\n BLINKY: 'blinky',\n PINKY: 'pinky',\n INKY: 'inky',\n CLYDE: 'clyde',\n PILL: 'pill',\n PACMAN: 'pacman',\n GHOST: 'ghost',\n SCARED: 'scared',\n GHOSTLAIR: 'lair'\n};\n\n// Lookup array for classes\nexport const CLASS_LIST = [\n OBJECT_TYPE.BLANK,\n OBJECT_TYPE.WALL,\n OBJECT_TYPE.DOT,\n OBJECT_TYPE.BLINKY,\n OBJECT_TYPE.PINKY,\n OBJECT_TYPE.INKY,\n OBJECT_TYPE.CLYDE,\n OBJECT_TYPE.PILL,\n OBJECT_TYPE.PACMAN,\n OBJECT_TYPE.GHOSTLAIR\n];\n\nexport const LEVEL = [\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1,\n 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1,\n 1, 7, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 7,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 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1,\n 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1,\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n];\n","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles;","function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableSpread;","var arrayWithoutHoles = require(\"./arrayWithoutHoles\");\n\nvar iterableToArray = require(\"./iterableToArray\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;","function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","\nexport default class PacQueue {\n\n constructor() {\n this.pushStack = [];\n this.pullStack = [];\n this.size = 0;\n }\n\n empty() {\n return this.size == 0;\n }\n\n push(value) {\n this.pushStack.push(value);\n this.size++;\n }\n\n front() {\n if(this.pullStack.length > 0) {\n const elem = this.pullStack[this.pullStack.length - 1];\n return elem;\n }\n else if(this.pushStack.length > 0) {\n return this.pushStack[0];\n }\n else {\n console.err(\"Empty queue being front() \");\n return null;\n }\n }\n\n poll() {\n if(this.pullStack.length > 0) {\n this.size--;\n const elem = this.pullStack[this.pullStack.length - 1];\n this.pullStack.pop();\n return elem;\n }\n else if(this.pushStack.length > 0) {\n const pushStackLength = this.pushStack.length;\n for(let i = pushStackLength; i--;) {\n const elem = this.pushStack[i];\n this.pushStack.pop();\n this.pullStack.push(elem);\n }\n return this.poll();\n }\n else {\n console.err(\"Empty queue being polled \");\n return null;\n }\n }\n\n}\n\n// const q = new PacQueue();\n// q.push(3);\n// q.push(5);\n// q.push(4);\n// q.push(9);\n// q.push(26);\n\n// console.log(q.front());\n\n// q.poll();\n// q.poll();\n\n// console.log(q.front());\n\n// console.log(\"----\");\n\n// while(!q.empty()) {\n// const elem = q.front();\n// q.poll();\n// console.log(elem);\n// }\n\n\n\n","export function hslToRgb(h, s, l) {\n let r;\n let g;\n let b;\n\n if (s == 0) {\n r = g = b = l;\n } else {\n const hue2rgb = function hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n };\n\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n\n return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];\n}\n","import { GRID_SIZE, CELL_SIZE, OBJECT_TYPE, CLASS_LIST } from './setup';\nimport PacQueue from './PacmanQueue';\nimport { hslToRgb } from './helper';\n\nexport default class GameBoard {\n\n constructor(DOMGrid) {\n this.dotCount = 0;\n this.grid = [];\n this.DOMGrid = DOMGrid;\n }\n\n createGrid(level) {\n this.dotCount = 0;\n this.grid = [];\n this.DOMGrid.innerHTML = '';\n this.DOMGrid.style.cssText = `\n grid-template-columns: repeat(${GRID_SIZE}, ${CELL_SIZE}px);\n `;\n\n level.forEach(squareValue => {\n const div = document.createElement('div');\n div.classList.add('square', CLASS_LIST[squareValue]);\n div.style.cssText = `\n width: ${CELL_SIZE}px;\n height: ${CELL_SIZE}px;\n `;\n if(OBJECT_TYPE.DOT == CLASS_LIST[squareValue]) {\n this.dotCount++;\n const [r, g, b] = hslToRgb(Math.random() * 3.6, 1, 0.5);\n div.style.cssText += `\n background: rgba(${Math.max(r / 255, r * 1.5)}, ${g}, ${b * 0.5}, 1) !important;\n `;\n }\n this.DOMGrid.append(div);\n this.grid.push(div);\n });\n\n }\n\n addObject(pos, classes) {\n this.grid[pos].classList.add(...classes);\n }\n\n removeObject(pos, classes) {\n this.grid[pos].classList.remove(...classes);\n /**\n * we must remove the background property otherwise pacman will merge colors with\n * the div the next time he is there in that grid!\n */\n for(let theClass of classes) {\n if(theClass == OBJECT_TYPE.DOT) {\n this.grid[pos].style.background = \"\";\n break;\n }\n }\n }\n\n objectExists = (pos, object) => {\n return this.grid[pos].classList.contains(object);\n }\n\n rotateDiv(pos, deg) {\n this.grid[pos].style.transform = `rotate(${deg}deg)`;\n }\n\n moveCharacter(character) {\n if(character.shouldMove()) {\n\n const { nextMovePos, direction } =\n character.getNextMove(this.objectExists.bind(this));\n\n const { classesToRemove, classesToAdd } = character.makeMove();\n\n if(character.rotation && character.nextMovePos !== character.pos) {\n this.rotateDiv(nextMovePos, character.dir.rotation);\n this.rotateDiv(character.pos, 0);\n }\n\n this.removeObject(character.pos, classesToRemove);\n this.addObject(nextMovePos, classesToAdd);\n\n character.setNewPos(nextMovePos, direction);\n }\n }\n\n\n showGameStatus(gameWin) {\n const div = document.createElement('div');\n div.classList.add('game-status');\n div.innerHTML = `\n ${gameWin ? 'WIN !' : 'GAME OVER' }\n `;\n this.DOMGrid.append(div);\n }\n\n static createGameboard(DOMGrid, level) {\n const board = new this(DOMGrid);\n board.createGrid(level);\n return board;\n }\n\n};","import { OBJECT_TYPE, DIRECTIONS } from \"./setup\";\n\nexport default class Pacman {\n\n constructor(pos, speed) {\n\n this.pos = pos;\n this.speed = speed;\n this.dir = null;\n this.timer = 0;\n this.powerPill = false;\n this.rotation = true; // we will rotate when we change direction\n\n }\n\n shouldMove() {\n\n if(!this.dir) return false;\n\n if(this.timer === this.speed) {\n this.timer = 0;\n return true;\n }\n\n this.timer++;\n }\n\n getNextMove(objectExists) {\n\n let nextMovePos = this.pos + this.dir.movement;\n\n if(\n objectExists(nextMovePos, OBJECT_TYPE.WALL) ||\n objectExists(nextMovePos, OBJECT_TYPE.GHOSTLAIR)\n ) {\n nextMovePos = this.pos;\n }\n\n return {\n nextMovePos, direction: this.dir\n }\n\n }\n\n makeMove() {\n const classesToRemove = [OBJECT_TYPE.PACMAN];\n const classesToAdd = [OBJECT_TYPE.PACMAN];\n return { classesToRemove, classesToAdd };\n }\n\n setNewPos(pos){\n this.pos = pos;\n }\n\n handleKeyInput(e, objectExists) {\n\n if(!(e.keyCode >= 37 && e.keyCode <= 40))\n return;\n\n const dir = DIRECTIONS[e.key];\n const nextMovePos = this.pos + dir.movement;\n\n if(objectExists(nextMovePos, OBJECT_TYPE.WALL)\n || objectExists(nextMovePos, OBJECT_TYPE.GHOSTLAIR)\n )\n return;\n\n this.dir = dir;\n\n }\n\n}","import { DIRECTIONS, OBJECT_TYPE } from './setup';\n\nexport default class Ghost {\n\n constructor(speed = 5, startPos, movement, name) {\n\n this.name = name;\n this.movement = movement;\n this.startPos = startPos;\n this.pos = startPos;\n this.speed = speed;\n this.timer = 0;\n this.isScared = false;\n this.rotation = false;\n this.dir = DIRECTIONS.ArrowRight;\n\n }\n\n shouldMove() {\n if(this.timer === this.speed) {\n this.timer = 0;\n return true;\n }\n this.timer++;\n }\n\n getNextMove(objectExist) {\n // Call move algoritm here\n const { nextMovePos, direction } = this.movement(\n this.pos,\n this.dir,\n objectExist\n );\n return { nextMovePos, direction };\n }\n\n makeMove() {\n\n const classesToRemove = [\n OBJECT_TYPE.GHOST,\n OBJECT_TYPE.SCARED,\n this.name\n ];\n\n let classesToAdd = [\n OBJECT_TYPE.GHOST,\n this.name\n ];\n\n if(this.isScared)\n classesToAdd = [...classesToAdd, OBJECT_TYPE.SCARED];\n\n return {\n classesToAdd,\n classesToRemove\n }\n\n }\n\n setNewPos(nextPos, dir) {\n this.dir = dir;\n this.pos = nextPos;\n }\n\n}\n\n\n","import { DIRECTIONS, OBJECT_TYPE, GRID_SIZE } from './setup';\nimport PacQueue from './PacmanQueue';\n\n// Primitive random movement.\nexport function randomMovement(position, direction, objectExist) {\n let dir = direction;\n let nextMovePos = position + dir.movement;\n // Create an array from the diretions objects keys\n const keys = Object.keys(DIRECTIONS);\n\n while (\n objectExist(nextMovePos, OBJECT_TYPE.WALL) ||\n objectExist(nextMovePos, OBJECT_TYPE.GHOST)\n ) {\n // Get a random key from that array\n const key = keys[Math.floor(Math.random() * keys.length)];\n // Set the new direction\n dir = DIRECTIONS[key];\n // Set the next move\n nextMovePos = position + dir.movement;\n }\n\n return { nextMovePos, direction: dir };\n}\n\n// ! Breadth First Search from ghost to pacman to make the best next step\nexport function bestBFSMovement(position, direction, objectExist) {\n return { nextMovePos: bfs(position, objectExist), direction };\n}\n\n// ! Too computationally heavy causes browser to crash\n\nfunction bfs(ghostPos, objectExists) {\n\n const N = GRID_SIZE * GRID_SIZE;\n\n const q = new PacQueue();\n let visited = Array(N).fill(false);\n// let distance = Array(N).fill(Number.POSITIVE_INFINITY);\n let backtrack = Array(N).fill(-1);\n\n let foundPacman = false;\n let pacmanPos = -1;\n\n visited[ghostPos] = true;\n backtrack[ghostPos] = -2;\n //distance[ghostPos] = 0;\n q.push(ghostPos);\n\n while(!q.empty()) {\n\n const pos = q.front();\n q.poll();\n\n const neighbors = [pos - GRID_SIZE, pos + GRID_SIZE, pos + 1, pos - 1];\n\n for(let neigh of neighbors) {\n\n if(neigh < 0 || neigh >= N)\n continue;\n\n if(\n objectExists(neigh, OBJECT_TYPE.WALL) ||\n objectExists(neigh, OBJECT_TYPE.GHOST)\n )\n continue;\n\n if(visited[neigh])\n continue;\n\n // distance[neigh] = distance[pos] + 1;\n backtrack[neigh] = pos;\n\n if(objectExists(neigh, OBJECT_TYPE.PACMAN)) {\n foundPacman = true;\n pacmanPos = neigh;\n break;\n }\n\n q.push(neigh);\n }\n\n if(foundPacman)\n break;\n\n }\n\n if(foundPacman) {\n\n console.log(\"found a way to pacman\");\n\n let traceback = [];\n let curr = pacmanPos;\n\n while(curr != -2) {\n traceback.push(curr);\n curr = backtrack[curr];\n }\n\n return traceback[traceback.length - 2];\n\n }\n\n // we couldnt get to pacman, so stay where you are\n return ghostPos;\n\n}\n\n\n\n","import { LEVEL, OBJECT_TYPE, GRID_SIZE } from './setup';\nimport GameBoard from './GameBoard';\nimport Pacman from './Pacman';\nimport Ghost from './Ghost';\nimport { randomMovement, bestBFSMovement } from './ghostMoves';\n\nconst soundDot = './sounds/munch.wav';\nconst soundPill = './sounds/pill.wav';\nconst soundGameStart = './sounds/game_start.wav';\nconst soundGameOver = './sounds/death.wav';\nconst soundGhost = './sounds/eat_ghost.wav';\n\nconst gameGrid = document.querySelector('#game');\nconst scoreTable = document.querySelector(\"#score\");\nconst startButton = document.querySelector(\"#start-button\");\nconst levels = document.querySelector('.levels');\nconst gameBoard = GameBoard.createGameboard(gameGrid, LEVEL);\n\nconst POWER_PILL_TIME = 10000;\nconst GLOBAL_SPEED = 80;\n\n// initial setup\nlet score = 0;\nlet timer = null;\nlet gameWin = false;\nlet currentLevel = 1;\n\n//keep track whether or not pacman ate the power pill which will be active\n// for a certain amount of time\n\nlet powerPillActive = false;\nlet powerPillTimer = null;\n\n\nfunction playAudio(effect) {\n try {\n new Audio(effect).play();\n } catch(e) {\n // ain't a big deal X) haha\n }\n}\n\nfunction gameOver(pacman, grid) {\n\n playAudio(soundGameOver);\n\n document.removeEventListener('keydown', e => {\n pacman.handleKeyInput(e, gameBoard.objectExists.bind(gameBoard))\n });\n\n gameBoard.showGameStatus(gameWin);\n clearInterval(timer);\n\n startButton.classList.remove('hide');\n levels.classList.remove('hide');\n\n}\n\nfunction checkCollision(pacman, ghosts) {\n const collidedGhost = ghosts.find(ghost => ghost.pos == pacman.pos);\n\n if(collidedGhost) {\n\n if(pacman.powerPill) {\n\n playAudio(soundGhost);\n\n gameBoard.removeObject(collidedGhost.pos, [\n OBJECT_TYPE.GHOST,\n OBJECT_TYPE.SCARED,\n collidedGhost.name\n ]);\n collidedGhost.pos = collidedGhost.startPos;\n score+=100;\n }\n\n else {\n\n gameBoard.removeObject(pacman.pos, [OBJECT_TYPE.PACMAN]);\n gameBoard.rotateDiv(pacman.pos, 0);\n gameOver(pacman, gameGrid);\n }\n }\n}\n\nfunction gameLoop(pacman, ghosts) {\n gameBoard.moveCharacter(pacman);\n checkCollision(pacman, ghosts);\n\n ghosts.forEach(ghost => {\n gameBoard.moveCharacter(ghost);\n checkCollision(pacman, ghosts);\n });\n\n if(gameBoard.objectExists(pacman.pos, OBJECT_TYPE.DOT)) {\n\n playAudio(soundDot);\n\n gameBoard.removeObject(pacman.pos, [OBJECT_TYPE.DOT]);\n gameBoard.dotCount--;\n score+=10;\n\n }\n\n if(gameBoard.objectExists(pacman.pos, OBJECT_TYPE.PILL)) {\n\n playAudio(soundPill);\n\n gameBoard.removeObject(pacman.pos, [OBJECT_TYPE.PILL]);\n pacman.powerPill = true;\n score += 50;\n\n clearTimeout(powerPillTimer);\n\n powerPillTimer = setTimeout(function() {\n pacman.powerPill = false;\n }, POWER_PILL_TIME);\n\n }\n\n if(pacman.powerPill !== powerPillActive) {\n powerPillActive = pacman.powerPill;\n ghosts.forEach(ghost => ghost.isScared = powerPillActive);\n }\n\n if(gameBoard.dotCount === 0) {\n gameWin = true;\n gameOver(pacman, ghosts);\n }\n\n scoreTable.innerHTML = score;\n\n}\n\nfunction startGame() {\n\n playAudio(soundGameStart);\n\n gameWin = false;\n powerPillActive = false;\n score = 0;\n\n startButton.classList.add('hide');\n levels.classList.add('hide');\n\n gameBoard.createGrid(LEVEL);\n const pacman = new Pacman(287, 2);\n\n gameBoard.addObject(287, [OBJECT_TYPE.PACMAN]);\n\n document.addEventListener('keydown', e => {\n pacman.handleKeyInput(e, gameBoard.objectExists.bind(gameBoard))\n });\n\n let ghosts = [\n new Ghost(5, 188, randomMovement, OBJECT_TYPE.BLINKY)\n ];\n\n if(currentLevel >= 2) {\n ghosts.push(new Ghost(4, 209, randomMovement, OBJECT_TYPE.PINKY));\n }\n\n if(currentLevel === 3) {\n ghosts.push(new Ghost(3, 230, randomMovement, OBJECT_TYPE.INKY));\n ghosts.push(new Ghost(2, 251, randomMovement, OBJECT_TYPE.CLYDE));\n }\n\n timer = setInterval(() => {\n gameLoop(pacman, ghosts)\n }, GLOBAL_SPEED);\n\n}\n\nstartButton.addEventListener('click', startGame);\n\nlevels.addEventListener('click', function(e) {\n if(e.target.classList.contains('level')) {\n\n const allButtons = levels.querySelectorAll('a');\n allButtons.forEach(butt => butt.classList.remove(\"active\"));\n\n e.target.classList.add(\"active\");\n const levelStr = e.target.id;\n const level = parseInt(levelStr[levelStr.length - 1]);\n currentLevel = level;\n }\n});\n\n"]}