From 973fd9ba9b6869ebd128ca3b8cb8925db439ba8c Mon Sep 17 00:00:00 2001 From: Shay Patel Date: Wed, 18 Feb 2026 13:55:52 +0000 Subject: [PATCH] initial commit --- .gitignore | 2 + package-lock.json | 1076 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 14 + public/game.js | 434 ++++++++++++++++++ public/index.html | 169 +++++++ public/style.css | 871 ++++++++++++++++++++++++++++++++++++ riddles.js | 177 ++++++++ server.js | 300 +++++++++++++ 8 files changed, 3043 insertions(+) create mode 100644 .gitignore create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 public/game.js create mode 100644 public/index.html create mode 100644 public/style.css create mode 100644 riddles.js create mode 100644 server.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..82d30cc --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +node_modules/ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..1342239 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1076 @@ +{ + "name": "riddle-racer", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "riddle-racer", + "version": "1.0.0", + "dependencies": { + "express": "^4.18.2", + "socket.io": "^4.7.2" + } + }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", + "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==", + "license": "MIT" + }, + "node_modules/@types/cors": { + "version": "2.8.19", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz", + "integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "25.2.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.3.tgz", + "integrity": "sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ==", + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "license": "MIT" + }, + "node_modules/base64id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", + "license": "MIT", + "engines": { + "node": "^4.5.0 || >= 5.9" + } + }, + "node_modules/body-parser": { + "version": "1.20.4", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz", + "integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "~1.2.0", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "on-finished": "~2.4.1", + "qs": "~6.14.0", + "raw-body": "~2.5.3", + "type-is": "~1.6.18", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", + "license": "MIT" + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/engine.io": { + "version": "6.6.5", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.5.tgz", + "integrity": "sha512-2RZdgEbXmp5+dVbRm0P7HQUImZpICccJy7rN7Tv+SFa55pH+lxnuw6/K1ZxxBfHoYpSkHLAO92oa8O4SwFXA2A==", + "license": "MIT", + "dependencies": { + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "~0.7.2", + "cors": "~2.8.5", + "debug": "~4.4.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.18.3" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz", + "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/engine.io/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/engine.io/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.22.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz", + "integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "~1.20.3", + "content-disposition": "~0.5.4", + "content-type": "~1.0.4", + "cookie": "~0.7.1", + "cookie-signature": "~1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.3.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "~0.1.12", + "proxy-addr": "~2.0.7", + "qs": "~6.14.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "~0.19.0", + "serve-static": "~1.16.2", + "setprototypeof": "1.2.0", + "statuses": "~2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", + "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "statuses": "~2.0.2", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "license": "MIT" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.14.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.2.tgz", + "integrity": "sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", + "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz", + "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.4.1", + "range-parser": "~1.2.1", + "statuses": "~2.0.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/serve-static": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz", + "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==", + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "~0.19.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/socket.io": { + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.8.3.tgz", + "integrity": "sha512-2Dd78bqzzjE6KPkD5fHZmDAKRNe3J15q+YHDrIsy9WEkqttc7GY+kT9OBLSMaPbQaEd0x1BjcmtMtXkfpc+T5A==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.4", + "base64id": "~2.0.0", + "cors": "~2.8.5", + "debug": "~4.4.1", + "engine.io": "~6.6.0", + "socket.io-adapter": "~2.5.2", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/socket.io-adapter": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.6.tgz", + "integrity": "sha512-DkkO/dz7MGln0dHn5bmN3pPy+JmywNICWrJqVWiVOyvXjWQFIv9c2h24JrQLLFJ2aQVQf/Cvl1vblnd4r2apLQ==", + "license": "MIT", + "dependencies": { + "debug": "~4.4.1", + "ws": "~8.18.3" + } + }, + "node_modules/socket.io-adapter/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io-adapter/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/socket.io-parser": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.5.tgz", + "integrity": "sha512-bPMmpy/5WWKHea5Y/jYAP6k74A+hvmRCQaJuJB6I/ML5JZq/KfNieUVo/3Mh7SAqn7TyFdIo6wqYHInG1MU1bQ==", + "license": "MIT", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.4.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io-parser/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/socket.io/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..963010e --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "name": "riddle-racer", + "version": "1.0.0", + "description": "Multiplayer riddle racing game", + "main": "server.js", + "scripts": { + "start": "node server.js", + "dev": "node server.js" + }, + "dependencies": { + "express": "^4.18.2", + "socket.io": "^4.7.2" + } +} diff --git a/public/game.js b/public/game.js new file mode 100644 index 0000000..84050bb --- /dev/null +++ b/public/game.js @@ -0,0 +1,434 @@ +/* ═══════════════════════════════════════ + RIDDLE RACER – client-side game logic +═══════════════════════════════════════ */ +const socket = io(); + +const FINISH_LINE = 10; +const CAR_EMOJIS = ['🏎️', '🚗', '🚕', '🚙', '🚓', '🚑', '🚐', '🚌']; + +// ── State ────────────────────────────── +let myRoomId = null; +let amHost = false; +let myFinished = false; +let carEmojiMap = {}; // playerId → car emoji + +// ── Screen helpers ───────────────────── +const screens = { + home: document.getElementById('home-screen'), + lobby: document.getElementById('lobby-screen'), + game: document.getElementById('game-screen'), + results: document.getElementById('results-screen'), +}; + +function showScreen(name) { + Object.values(screens).forEach(s => s.classList.remove('active')); + screens[name].classList.add('active'); +} + +// ── DOM refs ─────────────────────────── +const nameInput = document.getElementById('name-input'); +const codeInput = document.getElementById('code-input'); +const errorMsg = document.getElementById('error-msg'); +const createBtn = document.getElementById('create-btn'); +const joinBtn = document.getElementById('join-btn'); + +const roomCodeEl = document.getElementById('room-code'); +const copyBtn = document.getElementById('copy-btn'); +const playerListEl = document.getElementById('player-list'); +const playerCount = document.getElementById('player-count'); +const startBtn = document.getElementById('start-btn'); +const waitingMsg = document.getElementById('waiting-msg'); + +const gameBadge = document.getElementById('game-room-badge'); +const raceTrack = document.getElementById('race-track'); + +const riddlePanel = document.getElementById('riddle-panel'); +const riddleNumEl = document.getElementById('riddle-num'); +const riddleTotEl = document.getElementById('riddle-total'); +const progressFill = document.getElementById('progress-fill'); +const riddleQ = document.getElementById('riddle-question'); +const answerInput = document.getElementById('answer-input'); +const submitBtn = document.getElementById('submit-btn'); +const hintBtn = document.getElementById('hint-btn'); +const feedbackEl = document.getElementById('feedback'); +const hintBox = document.getElementById('hint-box'); +const hintText = document.getElementById('hint-text'); + +const finishedBanner = document.getElementById('finished-banner'); +const finishedTrophy = document.getElementById('finished-trophy'); +const finishedText = document.getElementById('finished-text'); + +const resultsList = document.getElementById('results-list'); +const playAgainBtn = document.getElementById('play-again-btn'); +const hostOnlyMsg = document.getElementById('host-only-msg'); + +// ══════════════════════════════════════════════ +// HOME SCREEN +// ══════════════════════════════════════════════ + +// Tab switching +document.querySelectorAll('.tab-btn').forEach(btn => { + btn.addEventListener('click', () => { + const tab = btn.dataset.tab; + document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active')); + document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active')); + btn.classList.add('active'); + document.getElementById(`${tab}-tab`).classList.add('active'); + clearError(); + }); +}); + +createBtn.addEventListener('click', () => { + const name = nameInput.value.trim(); + if (!name) return showError('Please enter your racing name first.'); + clearError(); + createBtn.disabled = true; + socket.emit('createRoom', { name }); +}); + +joinBtn.addEventListener('click', () => { + const name = nameInput.value.trim(); + const code = codeInput.value.trim().toUpperCase(); + if (!name) return showError('Please enter your racing name first.'); + if (!code) return showError('Please enter the room code.'); + clearError(); + joinBtn.disabled = true; + socket.emit('joinRoom', { name, code }); +}); + +nameInput.addEventListener('keydown', e => { + if (e.key === 'Enter') createBtn.click(); +}); + +codeInput.addEventListener('keydown', e => { + if (e.key === 'Enter') joinBtn.click(); +}); + +codeInput.addEventListener('input', () => { + codeInput.value = codeInput.value.toUpperCase(); +}); + +function showError(msg) { + errorMsg.textContent = msg; +} + +function clearError() { + errorMsg.textContent = ''; +} + +function resetHomeButtons() { + createBtn.disabled = false; + joinBtn.disabled = false; +} + +// ══════════════════════════════════════════════ +// LOBBY SCREEN +// ══════════════════════════════════════════════ + +copyBtn.addEventListener('click', () => { + navigator.clipboard.writeText(myRoomId).then(() => showNotif('Room code copied! 📋')); +}); + +startBtn.addEventListener('click', () => { + socket.emit('startGame'); +}); + +function renderLobbyPlayers(players) { + playerCount.textContent = players.length; + playerListEl.innerHTML = players.map((p, i) => { + const isMe = p.id === socket.id; + const isHost = i === 0; // first player is host (by join order) + return ` +
+ ${escHtml(p.name)} + + ${isHost ? 'Host' : ''} + ${isMe ? 'You' : ''} + +
+ `; + }).join(''); +} + +// ══════════════════════════════════════════════ +// GAME SCREEN +// ══════════════════════════════════════════════ + +// Assign a car emoji to each player consistently +function assignCarEmojis(players) { + players.forEach((p, i) => { + if (!carEmojiMap[p.id]) { + carEmojiMap[p.id] = CAR_EMOJIS[i % CAR_EMOJIS.length]; + } + }); +} + +function renderTrack(players) { + assignCarEmojis(players); + raceTrack.innerHTML = players.map(p => { + const pct = Math.min((p.position / FINISH_LINE) * 88 + 4, 92); + const carEmoji = carEmojiMap[p.id] || '🏎️'; + const isMe = p.id === socket.id; + return ` +
+
+ ${isMe ? '▶ ' : ''}${escHtml(p.name)} +
+
+ ${carEmoji} +
+
+ 🏁 + ${p.finishPosition ? `${getOrdinal(p.finishPosition)}` : ''} +
+
+ `; + }).join(''); +} + +function updateTrack(players) { + assignCarEmojis(players); + players.forEach(p => { + const carEl = document.getElementById(`car-${p.id}`); + if (!carEl) return; + const pct = Math.min((p.position / FINISH_LINE) * 88 + 4, 92); + const oldLeft = parseFloat(carEl.style.left); + if (Math.abs(pct - oldLeft) > 0.1) { + carEl.style.left = `${pct}%`; + // Trigger boost animation + carEl.classList.remove('boosting'); + void carEl.offsetWidth; // reflow + carEl.classList.add('boosting'); + setTimeout(() => carEl.classList.remove('boosting'), 450); + } + // Update place badge + const row = document.querySelector(`.track-row[data-player-id="${p.id}"]`); + if (row) { + const finishCol = row.querySelector('.finish-col'); + const existing = finishCol.querySelector('.place-badge'); + if (p.finishPosition && !existing) { + finishCol.insertAdjacentHTML('beforeend', + `${getOrdinal(p.finishPosition)}`); + } + } + }); +} + +function showRiddle(riddle, num, total) { + riddleNumEl.textContent = num; + riddleTotEl.textContent = total; + riddleQ.textContent = riddle.question; + progressFill.style.width = `${((num - 1) / total) * 100}%`; + answerInput.value = ''; + feedbackEl.textContent = ''; + feedbackEl.className = 'feedback'; + hintBox.style.display = 'none'; + hintText.textContent = ''; + answerInput.focus(); +} + +function setFeedback(msg, isCorrect) { + feedbackEl.textContent = msg; + feedbackEl.className = `feedback ${isCorrect ? 'correct' : 'wrong'}`; + if (!isCorrect) { + // Shake the input + answerInput.style.borderColor = 'var(--accent-red)'; + setTimeout(() => answerInput.style.borderColor = '', 700); + } +} + +submitBtn.addEventListener('click', submitAnswer); +answerInput.addEventListener('keydown', e => { + if (e.key === 'Enter') submitAnswer(); +}); + +function submitAnswer() { + if (myFinished) return; + const answer = answerInput.value.trim(); + if (!answer) return; + socket.emit('submitAnswer', { answer }); + submitBtn.disabled = true; + setTimeout(() => { submitBtn.disabled = false; }, 300); +} + +hintBtn.addEventListener('click', () => { + socket.emit('getHint'); +}); + +// ══════════════════════════════════════════════ +// RESULTS SCREEN +// ══════════════════════════════════════════════ + +playAgainBtn.addEventListener('click', () => { + if (amHost) { + socket.emit('playAgain'); + } else { + showNotif('Only the host can restart the race!'); + } +}); + +function renderResults(results) { + const medals = ['🥇', '🥈', '🥉']; + resultsList.innerHTML = results.map((r, i) => ` +
+ ${i < 3 + ? `${medals[i]}` + : `${r.place}.` + } + ${escHtml(r.name)} +
+ `).join(''); + + if (amHost) { + playAgainBtn.style.display = 'block'; + hostOnlyMsg.style.display = 'none'; + } else { + playAgainBtn.style.display = 'none'; + hostOnlyMsg.style.display = 'block'; + } +} + +// ══════════════════════════════════════════════ +// SOCKET EVENTS +// ══════════════════════════════════════════════ + +socket.on('roomCreated', ({ roomId }) => { + myRoomId = roomId; + amHost = true; + resetHomeButtons(); +}); + +socket.on('joinedRoom', ({ roomId }) => { + myRoomId = roomId; + amHost = false; + resetHomeButtons(); +}); + +socket.on('joinError', msg => { + showError(msg); + resetHomeButtons(); +}); + +socket.on('lobbyState', ({ players, isHost, roomId }) => { + myRoomId = roomId; + amHost = isHost; + myFinished = false; + carEmojiMap = {}; + + roomCodeEl.textContent = roomId; + startBtn.style.display = isHost ? 'block' : 'none'; + waitingMsg.style.display = isHost ? 'none' : 'block'; + + renderLobbyPlayers(players); + showScreen('lobby'); +}); + +socket.on('playerUpdate', ({ players, message, newHost }) => { + if (newHost && newHost === socket.id) { + amHost = true; + startBtn.style.display = 'block'; + waitingMsg.style.display = 'none'; + } + renderLobbyPlayers(players); + if (message) showNotif(message); +}); + +socket.on('gameStarted', ({ players, riddle, riddleNum, total }) => { + myFinished = false; + gameBadge.textContent = myRoomId; + + // Reset game UI + riddlePanel.style.display = 'block'; + finishedBanner.style.display = 'none'; + + assignCarEmojis(players); + renderTrack(players); + showRiddle(riddle, riddleNum, total); + showScreen('game'); +}); + +socket.on('positionUpdate', ({ players }) => { + updateTrack(players); +}); + +socket.on('answerResult', ({ correct, finished, finishPosition, riddle, riddleNum, total }) => { + if (!correct) { + setFeedback('✗ Wrong! Try again.', false); + return; + } + + if (finished) { + myFinished = true; + progressFill.style.width = '100%'; + riddlePanel.style.display = 'none'; + finishedBanner.style.display = 'flex'; + + const trophies = ['🏆', '🥈', '🥉', '🎖️']; + finishedTrophy.textContent = trophies[Math.min(finishPosition - 1, trophies.length - 1)] || '🎖️'; + finishedText.textContent = `You finished ${getOrdinal(finishPosition)}!`; + } else { + setFeedback('✓ Correct! Keep going!', true); + setTimeout(() => { + if (!myFinished) showRiddle(riddle, riddleNum, total); + }, 600); + } +}); + +socket.on('playerFinished', ({ name, place }) => { + showNotif(`🏁 ${escHtml(name)} finished ${getOrdinal(place)}!`, true); +}); + +socket.on('hint', ({ hint }) => { + hintText.textContent = hint; + hintBox.style.display = 'block'; +}); + +socket.on('gameOver', ({ results }) => { + renderResults(results); + showScreen('results'); +}); + +socket.on('returnToLobby', ({ players }) => { + myFinished = false; + carEmojiMap = {}; + + startBtn.style.display = amHost ? 'block' : 'none'; + waitingMsg.style.display = amHost ? 'none' : 'block'; + renderLobbyPlayers(players); + showScreen('lobby'); +}); + +socket.on('disconnect', () => { + showNotif('Connection lost. Refresh to reconnect.'); +}); + +socket.on('connect_error', () => { + showError('Could not connect to server.'); +}); + +// ══════════════════════════════════════════════ +// UTILITIES +// ══════════════════════════════════════════════ + +function showNotif(msg, isFinish = false) { + const container = document.getElementById('notif-container'); + const el = document.createElement('div'); + el.className = `notif${isFinish ? ' finish-notif' : ''}`; + el.textContent = msg; + container.appendChild(el); + setTimeout(() => el.remove(), 3200); +} + +function getOrdinal(n) { + const s = ['th', 'st', 'nd', 'rd']; + const v = n % 100; + return n + (s[(v - 20) % 10] || s[v] || s[0]); +} + +function escHtml(str) { + return String(str) + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); +} diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..e000107 --- /dev/null +++ b/public/index.html @@ -0,0 +1,169 @@ + + + + + + Riddle Racer 🏎️ + + + + + +
+
+ + +
+ + + +
+ + +
+ +
+

Start a new race and invite friends with your room code.

+ +
+ +
+

Enter the room code your friend shared with you.

+ + +
+ +
+
+ + +
+
+ + +
+
+
+

🏎️ Riddle Racer

+
+ Room Code + + +
+
+ +
+

Racers in the Lobby 0

+
+ +
+ + +

Share the room code so friends can join!

+
+
+ +
+
🧩 Answer riddles correctly to move forward
+
🏎️ First to answer 10 riddles wins!
+
🏁 Race continues until everyone finishes
+
+
+
+ + +
+
+ +
+ 🏎️ Riddle Racer + +
+ + +
+
+
+ + +
+
+ 🧩 Riddle 1 of 10 +
+
+
+
+ +

+ +
+ + +
+ + + + +
+ + + + +
+
+ + +
+
+
+
🏁 🏁 🏁
+

Race Complete!

+

Final Standings

+
+ +
+ +
+ + +
+
+
+ + +
+ + + + + diff --git a/public/style.css b/public/style.css new file mode 100644 index 0000000..0e2a534 --- /dev/null +++ b/public/style.css @@ -0,0 +1,871 @@ +/* ═══════════════════════════════════════ + BASE & RESET +═══════════════════════════════════════ */ +*, *::before, *::after { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +:root { + --bg: #0f1117; + --surface: #1a1d2e; + --surface2: #232740; + --track-green: #0d3320; + --track-line: #1a5c3a; + --accent-yellow: #f5c518; + --accent-red: #e74c3c; + --accent-blue: #3498db; + --accent-green: #2ecc71; + --text: #eef0f7; + --text-muted: #8891a8; + --radius: 14px; + --shadow: 0 8px 32px rgba(0, 0, 0, 0.4); +} + +html, body { + height: 100%; +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; + background: var(--bg); + color: var(--text); + min-height: 100vh; + overflow-x: hidden; +} + +/* ═══════════════════════════════════════ + SCREENS +═══════════════════════════════════════ */ +.screen { + display: none; + min-height: 100vh; +} + +.screen.active { + display: flex; +} + +/* ═══════════════════════════════════════ + SHARED COMPONENTS +═══════════════════════════════════════ */ +.card { + background: var(--surface); + border-radius: var(--radius); + padding: 28px 32px; + box-shadow: var(--shadow); + border: 1px solid rgba(255, 255, 255, 0.06); +} + +.btn { + display: inline-block; + padding: 13px 22px; + border: none; + border-radius: 10px; + font-size: 1rem; + font-weight: 700; + cursor: pointer; + transition: transform 0.1s, filter 0.15s; + letter-spacing: 0.3px; + text-align: center; +} + +.btn:hover { + filter: brightness(1.12); + transform: translateY(-1px); +} + +.btn:active { + transform: translateY(0); + filter: brightness(0.95); +} + +.btn-red { background: var(--accent-red); color: #fff; } +.btn-blue { background: var(--accent-blue); color: #fff; } +.btn-green { background: var(--accent-green); color: #fff; } +.btn-hint { background: var(--surface2); color: var(--accent-yellow); border: 1px solid var(--accent-yellow); font-size: 0.9rem; padding: 9px 16px; } + +.btn-icon { + background: none; + border: none; + font-size: 1.2rem; + cursor: pointer; + padding: 4px 8px; + border-radius: 8px; + transition: background 0.15s; +} + +.btn-icon:hover { + background: rgba(255,255,255,0.1); +} + +input[type="text"] { + display: block; + width: 100%; + padding: 13px 16px; + background: var(--surface2); + border: 2px solid rgba(255, 255, 255, 0.08); + border-radius: 10px; + color: var(--text); + font-size: 1rem; + margin-bottom: 14px; + transition: border-color 0.2s; +} + +input[type="text"]:focus { + outline: none; + border-color: var(--accent-yellow); +} + +input[type="text"]::placeholder { + color: var(--text-muted); +} + +.error-msg { + color: var(--accent-red); + font-size: 0.9rem; + min-height: 22px; + text-align: center; + margin-top: 8px; + font-weight: 600; +} + +.waiting-text { + color: var(--text-muted); + text-align: center; + font-size: 0.95rem; +} + +/* ═══════════════════════════════════════ + HOME SCREEN +═══════════════════════════════════════ */ +#home-screen { + align-items: center; + justify-content: center; + padding: 20px; + background: + radial-gradient(ellipse at 20% 50%, rgba(231,76,60,0.15) 0%, transparent 60%), + radial-gradient(ellipse at 80% 50%, rgba(52,152,219,0.15) 0%, transparent 60%), + var(--bg); +} + +.home-wrapper { + width: 100%; + max-width: 420px; +} + +.home-logo { + text-align: center; + margin-bottom: 28px; +} + +.logo-cars { + font-size: 2.8rem; + margin-bottom: 8px; + animation: carsSlide 3s ease-in-out infinite alternate; +} + +@keyframes carsSlide { + from { letter-spacing: 2px; } + to { letter-spacing: 12px; } +} + +.home-logo h1 { + font-size: 2.8rem; + font-weight: 900; + color: var(--accent-yellow); + text-shadow: 0 0 30px rgba(245, 197, 24, 0.5); + letter-spacing: -0.5px; +} + +.tagline { + color: var(--text-muted); + margin-top: 6px; + font-size: 1rem; +} + +.input-label { + display: block; + font-size: 0.85rem; + font-weight: 600; + color: var(--text-muted); + text-transform: uppercase; + letter-spacing: 0.8px; + margin-bottom: 6px; +} + +/* Tabs */ +.tabs { + display: flex; + background: var(--surface2); + border-radius: 10px; + padding: 4px; + margin-bottom: 20px; +} + +.tab-btn { + flex: 1; + padding: 10px; + border: none; + background: none; + border-radius: 8px; + color: var(--text-muted); + font-size: 0.95rem; + font-weight: 600; + cursor: pointer; + transition: all 0.2s; +} + +.tab-btn.active { + background: var(--surface); + color: var(--text); + box-shadow: 0 2px 8px rgba(0,0,0,0.3); +} + +.tab-content { + display: none; +} + +.tab-content.active { + display: block; +} + +.tab-desc { + font-size: 0.88rem; + color: var(--text-muted); + margin-bottom: 14px; + line-height: 1.4; +} + +.home-footer { + text-align: center; + color: var(--text-muted); + font-size: 0.82rem; + margin-top: 20px; +} + +/* ═══════════════════════════════════════ + LOBBY SCREEN +═══════════════════════════════════════ */ +#lobby-screen { + align-items: center; + justify-content: center; + padding: 20px; +} + +.lobby-wrapper { + width: 100%; + max-width: 480px; +} + +.lobby-header { + text-align: center; + margin-bottom: 24px; +} + +.lobby-header h1 { + font-size: 2rem; + color: var(--accent-yellow); + margin-bottom: 12px; +} + +.room-code-box { + display: inline-flex; + align-items: center; + gap: 10px; + background: var(--surface2); + border-radius: 12px; + padding: 10px 20px; + border: 1px solid rgba(245, 197, 24, 0.3); +} + +.room-code-label { + font-size: 0.8rem; + color: var(--text-muted); + text-transform: uppercase; + letter-spacing: 1px; +} + +.room-code-val { + font-size: 1.6rem; + font-weight: 900; + color: var(--accent-yellow); + letter-spacing: 6px; + font-family: monospace; +} + +.lobby-wrapper .card h3 { + font-size: 1.05rem; + color: var(--text-muted); + text-transform: uppercase; + letter-spacing: 0.8px; + margin-bottom: 16px; + display: flex; + align-items: center; + gap: 10px; +} + +.count-badge { + background: var(--accent-yellow); + color: #111; + font-size: 0.8rem; + padding: 2px 9px; + border-radius: 20px; + font-weight: 800; +} + +.player-list { + display: flex; + flex-direction: column; + gap: 10px; + min-height: 60px; + margin-bottom: 20px; +} + +.lobby-player { + display: flex; + align-items: center; + justify-content: space-between; + padding: 12px 16px; + background: var(--surface2); + border-radius: 10px; + border-left: 4px solid; + font-weight: 600; + animation: slideIn 0.25s ease; +} + +@keyframes slideIn { + from { opacity: 0; transform: translateY(-8px); } + to { opacity: 1; transform: translateY(0); } +} + +.you-badge { + background: var(--accent-yellow); + color: #111; + font-size: 0.72rem; + font-weight: 800; + padding: 2px 8px; + border-radius: 10px; + text-transform: uppercase; +} + +.host-badge { + background: var(--accent-red); + color: #fff; + font-size: 0.72rem; + font-weight: 800; + padding: 2px 8px; + border-radius: 10px; +} + +.lobby-actions { + display: flex; + flex-direction: column; + align-items: center; + gap: 10px; + margin-bottom: 14px; +} + +#start-btn { + width: 100%; + font-size: 1.1rem; + padding: 15px; +} + +.lobby-hint { + font-size: 0.82rem; + color: var(--text-muted); + text-align: center; +} + +.race-rules { + display: flex; + flex-direction: column; + gap: 8px; + margin-top: 20px; +} + +.rule { + background: var(--surface); + border-radius: 10px; + padding: 10px 16px; + font-size: 0.88rem; + color: var(--text-muted); + border: 1px solid rgba(255,255,255,0.05); +} + +/* ═══════════════════════════════════════ + GAME SCREEN +═══════════════════════════════════════ */ +#game-screen { + flex-direction: column; + padding: 0; +} + +.game-wrapper { + display: flex; + flex-direction: column; + min-height: 100vh; + max-width: 900px; + margin: 0 auto; + width: 100%; + padding: 0 16px 20px; +} + +.game-topbar { + display: flex; + align-items: center; + justify-content: space-between; + padding: 14px 0 10px; + border-bottom: 1px solid rgba(255,255,255,0.07); + margin-bottom: 16px; +} + +.topbar-title { + font-size: 1.1rem; + font-weight: 800; + color: var(--accent-yellow); +} + +.room-badge { + background: var(--surface2); + border: 1px solid rgba(245,197,24,0.3); + color: var(--accent-yellow); + font-family: monospace; + font-size: 0.85rem; + font-weight: 700; + padding: 4px 12px; + border-radius: 20px; + letter-spacing: 3px; +} + +/* ── Race Track ── */ +.track-section { + background: var(--track-green); + border-radius: 14px; + padding: 16px 20px; + margin-bottom: 16px; + border: 1px solid rgba(46, 204, 113, 0.2); + box-shadow: inset 0 2px 12px rgba(0,0,0,0.3); +} + +.race-track { + display: flex; + flex-direction: column; + gap: 12px; +} + +.track-row { + display: flex; + align-items: center; + gap: 10px; +} + +.player-label { + width: 110px; + min-width: 110px; + font-size: 0.85rem; + font-weight: 700; + text-align: right; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: #fff; +} + +.track-bar { + flex: 1; + height: 42px; + background: var(--track-line); + border-radius: 21px; + position: relative; + border: 2px solid rgba(46,204,113,0.3); + overflow: visible; +} + +/* Dashed center line */ +.track-bar::before { + content: ''; + position: absolute; + top: 50%; + left: 5%; + right: 5%; + height: 2px; + background: repeating-linear-gradient( + 90deg, + rgba(255,255,255,0.15) 0px, + rgba(255,255,255,0.15) 12px, + transparent 12px, + transparent 24px + ); + transform: translateY(-50%); + pointer-events: none; +} + +.car-emoji { + position: absolute; + top: 50%; + left: 4%; + transform: translateY(-50%); + font-size: 1.6rem; + transition: left 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94); + z-index: 5; + line-height: 1; + filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5)); + will-change: left; +} + +.car-emoji.boosting { + animation: carBoost 0.4s ease; +} + +@keyframes carBoost { + 0% { filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5)); transform: translateY(-50%) scale(1); } + 40% { filter: drop-shadow(0 0 14px rgba(245,197,24,0.9)); transform: translateY(-50%) scale(1.35); } + 100% { filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5)); transform: translateY(-50%) scale(1); } +} + +.finish-col { + display: flex; + align-items: center; + gap: 6px; + min-width: 44px; +} + +.finish-flag { + font-size: 1.4rem; +} + +.place-badge { + background: var(--accent-yellow); + color: #111; + font-size: 0.72rem; + font-weight: 900; + padding: 2px 7px; + border-radius: 10px; + white-space: nowrap; +} + +/* ── Riddle Panel ── */ +.riddle-panel { + background: var(--surface); + border-radius: var(--radius); + padding: 24px 28px; + border: 1px solid rgba(255,255,255,0.06); + flex: 1; +} + +.riddle-header { + display: flex; + align-items: center; + gap: 12px; + margin-bottom: 18px; + flex-wrap: wrap; +} + +.riddle-counter { + font-size: 0.85rem; + font-weight: 700; + color: var(--text-muted); + text-transform: uppercase; + letter-spacing: 0.5px; + white-space: nowrap; +} + +.progress-outer { + flex: 1; + height: 8px; + background: var(--surface2); + border-radius: 4px; + overflow: hidden; + min-width: 60px; +} + +.progress-fill { + height: 100%; + background: linear-gradient(90deg, var(--accent-green), var(--accent-yellow)); + border-radius: 4px; + transition: width 0.5s ease; +} + +.riddle-question { + font-size: 1.15rem; + line-height: 1.65; + color: var(--accent-yellow); + margin-bottom: 22px; + font-style: italic; +} + +.answer-row { + display: flex; + gap: 10px; + margin-bottom: 14px; +} + +.answer-input { + flex: 1; + margin-bottom: 0 !important; + font-size: 1.05rem; +} + +.submit-btn { + white-space: nowrap; + flex-shrink: 0; +} + +.riddle-footer { + display: flex; + align-items: center; + gap: 14px; + flex-wrap: wrap; +} + +.feedback { + font-size: 0.95rem; + font-weight: 700; + min-height: 22px; + transition: opacity 0.3s; +} + +.feedback.correct { color: var(--accent-green); } +.feedback.wrong { color: var(--accent-red); } + +.hint-box { + margin-top: 14px; + background: rgba(245, 197, 24, 0.08); + border: 1px solid rgba(245, 197, 24, 0.3); + border-radius: 10px; + padding: 12px 16px; + font-size: 0.92rem; + color: var(--text); + line-height: 1.5; + animation: fadeIn 0.3s ease; +} + +@keyframes fadeIn { + from { opacity: 0; transform: translateY(4px); } + to { opacity: 1; transform: translateY(0); } +} + +.hint-label { + font-weight: 700; + color: var(--accent-yellow); + margin-right: 6px; +} + +/* ── Finished Banner ── */ +.finished-banner { + background: var(--surface); + border-radius: var(--radius); + padding: 28px; + text-align: center; + flex: 1; + display: flex; + align-items: center; + justify-content: center; + border: 2px solid rgba(245,197,24,0.3); +} + +.finished-inner { + display: flex; + flex-direction: column; + align-items: center; + gap: 10px; +} + +.finished-trophy { + font-size: 4rem; + animation: trophyBounce 1s ease infinite alternate; +} + +@keyframes trophyBounce { + from { transform: translateY(0); } + to { transform: translateY(-8px); } +} + +#finished-text { + font-size: 1.5rem; + font-weight: 900; + color: var(--accent-yellow); +} + +.finished-sub { + color: var(--text-muted); + font-size: 0.9rem; +} + +/* ═══════════════════════════════════════ + RESULTS SCREEN +═══════════════════════════════════════ */ +#results-screen { + align-items: center; + justify-content: center; + padding: 20px; + background: + radial-gradient(ellipse at 50% 0%, rgba(245,197,24,0.18) 0%, transparent 60%), + var(--bg); +} + +.results-wrapper { + width: 100%; + max-width: 500px; +} + +.results-header { + text-align: center; + margin-bottom: 28px; +} + +.results-flags { + font-size: 2rem; + margin-bottom: 8px; + animation: wave 1.5s ease-in-out infinite; +} + +@keyframes wave { + 0%, 100% { transform: rotate(-5deg); } + 50% { transform: rotate(5deg); } +} + +.results-header h1 { + font-size: 2.4rem; + font-weight: 900; + color: var(--accent-yellow); +} + +.results-sub { + color: var(--text-muted); + font-size: 1rem; + margin-top: 6px; +} + +.results-list { + display: flex; + flex-direction: column; + gap: 12px; + margin-bottom: 28px; +} + +.result-item { + display: flex; + align-items: center; + gap: 16px; + background: var(--surface); + border-radius: var(--radius); + padding: 16px 22px; + border: 1px solid rgba(255,255,255,0.06); + animation: slideIn 0.35s ease both; +} + +.result-item:nth-child(1) { border-left: 4px solid #ffd700; animation-delay: 0.05s; } +.result-item:nth-child(2) { border-left: 4px solid #c0c0c0; animation-delay: 0.15s; } +.result-item:nth-child(3) { border-left: 4px solid #cd7f32; animation-delay: 0.25s; } +.result-item:nth-child(n+4) { animation-delay: 0.35s; } + +.result-medal { + font-size: 2.2rem; + width: 50px; + text-align: center; + flex-shrink: 0; +} + +.result-place { + font-size: 1.6rem; + font-weight: 900; + width: 50px; + text-align: center; + color: var(--text-muted); + flex-shrink: 0; +} + +.result-name { + flex: 1; + font-size: 1.15rem; + font-weight: 700; +} + +.results-actions { + display: flex; + flex-direction: column; + align-items: center; + gap: 12px; +} + +#play-again-btn { + width: 100%; + max-width: 280px; + padding: 15px; + font-size: 1.05rem; +} + +/* ═══════════════════════════════════════ + NOTIFICATIONS +═══════════════════════════════════════ */ +#notif-container { + position: fixed; + top: 16px; + right: 16px; + display: flex; + flex-direction: column; + gap: 10px; + z-index: 9999; + pointer-events: none; +} + +.notif { + background: var(--surface); + border: 1px solid rgba(245, 197, 24, 0.4); + border-radius: 12px; + padding: 13px 20px; + font-size: 0.92rem; + font-weight: 600; + max-width: 300px; + animation: notifIn 0.3s ease, notifOut 0.4s ease 2.6s forwards; + box-shadow: 0 4px 20px rgba(0,0,0,0.4); +} + +.notif.finish-notif { + border-color: var(--accent-green); + background: rgba(46, 204, 113, 0.12); +} + +@keyframes notifIn { + from { opacity: 0; transform: translateX(40px); } + to { opacity: 1; transform: translateX(0); } +} + +@keyframes notifOut { + to { opacity: 0; transform: translateX(40px); } +} + +/* ═══════════════════════════════════════ + RESPONSIVE +═══════════════════════════════════════ */ +@media (max-width: 600px) { + .player-label { + width: 80px; + min-width: 80px; + font-size: 0.78rem; + } + + .riddle-panel { + padding: 18px 16px; + } + + .answer-row { + flex-direction: column; + } + + .submit-btn { + width: 100%; + } + + .card { + padding: 20px 18px; + } + + .home-logo h1 { + font-size: 2.2rem; + } +} diff --git a/riddles.js b/riddles.js new file mode 100644 index 0000000..2349c62 --- /dev/null +++ b/riddles.js @@ -0,0 +1,177 @@ +module.exports = [ + { + question: "I have cities, but no houses live there. I have mountains, but no trees grow there. I have water, but no fish swim there. I have roads, but no cars drive there. What am I?", + answers: ["map", "a map"], + hint: "You use me to navigate and find your way around." + }, + { + question: "The more you take, the more you leave behind. What am I?", + answers: ["footsteps", "steps", "footprints", "footprint"], + hint: "Think about what you leave on the ground when you walk." + }, + { + question: "What has hands but cannot clap?", + answers: ["clock", "a clock", "watch", "a watch"], + hint: "It tells you something important every day." + }, + { + question: "What has to be broken before you can use it?", + answers: ["egg", "an egg"], + hint: "You might have it scrambled or sunny-side up for breakfast." + }, + { + question: "I speak without a mouth and hear without ears. I have no body, but I come alive with wind. What am I?", + answers: ["echo", "an echo"], + hint: "Shout in a canyon or large empty room and you will meet me." + }, + { + question: "What can travel around the world while staying in a corner?", + answers: ["stamp", "a stamp", "postage stamp"], + hint: "You stick me on an envelope before mailing it." + }, + { + question: "What has one eye but cannot see?", + answers: ["needle", "a needle", "sewing needle"], + hint: "Thread passes through my eye." + }, + { + question: "What gets wetter as it dries?", + answers: ["towel", "a towel"], + hint: "You use me after a shower or bath." + }, + { + question: "I have a head and a tail, but no body. What am I?", + answers: ["coin", "a coin"], + hint: "You might flip me to make a decision." + }, + { + question: "What has legs but cannot walk?", + answers: ["table", "a table", "chair", "a chair", "desk", "a desk"], + hint: "You eat your meals at one of these." + }, + { + question: "I am light as a feather, yet the strongest person cannot hold me for more than five minutes. What am I?", + answers: ["breath", "your breath", "breathing", "air"], + hint: "You need me to survive every second of every day." + }, + { + question: "What has many keys but cannot open a single lock?", + answers: ["piano", "a piano", "keyboard", "a keyboard"], + hint: "You press my keys to make music." + }, + { + question: "What goes up but never comes down?", + answers: ["age", "your age"], + hint: "Everyone has it, and it only ever increases." + }, + { + question: "I am always in front of you but can never be seen. What am I?", + answers: ["future", "the future"], + hint: "It is what has not happened yet." + }, + { + question: "What has teeth but cannot bite?", + answers: ["comb", "a comb", "saw", "a saw", "zipper", "a zipper", "gear", "a gear"], + hint: "You drag me through your hair to style it." + }, + { + question: "What runs but never walks, has a mouth but never talks, has a head but never weeps, has a bed but never sleeps?", + answers: ["river", "a river"], + hint: "Water flows through me toward the sea." + }, + { + question: "What comes once in a minute, twice in a moment, but never in a thousand years?", + answers: ["m", "the letter m", "letter m"], + hint: "Look very carefully at the letters in the words of this riddle." + }, + { + question: "What building has the most stories?", + answers: ["library", "a library"], + hint: "You borrow books for free from here." + }, + { + question: "What word is always spelled incorrectly?", + answers: ["incorrectly"], + hint: "The answer is hiding inside the riddle itself." + }, + { + question: "What can you hold in your right hand but never in your left hand?", + answers: ["left hand", "your left hand", "left elbow", "your left elbow"], + hint: "Think physically — what is literally impossible to hold in your right hand?" + }, + { + question: "I can fly without wings. I can cry without eyes. Wherever I go, darkness follows me. What am I?", + answers: ["cloud", "a cloud", "rain cloud"], + hint: "Look up at the sky on a stormy day." + }, + { + question: "What is full of holes but still holds water?", + answers: ["sponge", "a sponge"], + hint: "You might use me to wash dishes or a car." + }, + { + question: "What has words but never speaks?", + answers: ["book", "a book"], + hint: "You read me for stories, knowledge, or entertainment." + }, + { + question: "If you drop me I am sure to crack, but smile at me and I will always smile back. What am I?", + answers: ["mirror", "a mirror"], + hint: "You look at your reflection in me." + }, + { + question: "What invention lets you look right through a wall?", + answers: ["window", "a window"], + hint: "Homes and buildings have me in every room." + }, + { + question: "I am tall when I am young, and short when I am old. What am I?", + answers: ["candle", "a candle"], + hint: "I melt as I give off light and warmth." + }, + { + question: "What is so fragile that saying its name breaks it?", + answers: ["silence"], + hint: "It is the complete absence of sound." + }, + { + question: "The more there is, the less you see. What am I?", + answers: ["darkness", "dark", "fog"], + hint: "It appears when light disappears." + }, + { + question: "I have no life, but I can die. What am I?", + answers: ["battery", "a battery"], + hint: "You recharge me or replace me in your phone or remote." + }, + { + question: "What goes through towns and over hills, but never moves?", + answers: ["road", "a road", "street", "a street"], + hint: "Cars and trucks drive on me every day." + }, + { + question: "What has a neck but no head?", + answers: ["bottle", "a bottle"], + hint: "You pour liquids into and out of me." + }, + { + question: "What can you catch but cannot throw?", + answers: ["cold", "a cold", "the flu", "flu"], + hint: "You might get me from someone who sneezes near you." + }, + { + question: "What has 13 hearts but no other organs?", + answers: ["deck of cards", "a deck of cards", "deck", "cards"], + hint: "You play poker and solitaire with me." + }, + { + question: "I have cities, mountains, and water, but no living things. You can hold the entire world in your hands with me. What am I?", + answers: ["globe", "a globe"], + hint: "I am a round model of the Earth." + }, + { + question: "What has a ring but no finger?", + answers: ["telephone", "a telephone", "phone", "a phone"], + hint: "You pick me up and answer when someone calls." + } +]; diff --git a/server.js b/server.js new file mode 100644 index 0000000..6234efa --- /dev/null +++ b/server.js @@ -0,0 +1,300 @@ +const express = require('express'); +const http = require('http'); +const { Server } = require('socket.io'); +const path = require('path'); +const riddles = require('./riddles'); + +const app = express(); +const server = http.createServer(app); +const io = new Server(server); + +app.use(express.static(path.join(__dirname, 'public'))); + +const FINISH_LINE = 10; +const COLORS = ['#e74c3c', '#3498db', '#2ecc71', '#f39c12', '#9b59b6', '#1abc9c', '#e67e22', '#e91e63']; + +const rooms = {}; + +function genRoomId() { + const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789'; + let id = ''; + for (let i = 0; i < 6; i++) id += chars[Math.floor(Math.random() * chars.length)]; + return id; +} + +function shuffle(arr) { + const a = [...arr]; + for (let i = a.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [a[i], a[j]] = [a[j], a[i]]; + } + return a; +} + +function getOrdinal(n) { + const s = ['th', 'st', 'nd', 'rd']; + const v = n % 100; + return n + (s[(v - 20) % 10] || s[v] || s[0]); +} + +function normalizeAnswer(ans) { + return ans.toLowerCase().trim().replace(/^(a |an |the )/, '').replace(/[^a-z0-9\s]/g, '').replace(/\s+/g, ' '); +} + +function checkAnswer(playerAns, riddleIndex) { + const riddle = riddles[riddleIndex]; + const norm = normalizeAnswer(playerAns); + return riddle.answers.some(a => normalizeAnswer(a) === norm); +} + +function publicPlayers(room) { + return Object.entries(room.players).map(([id, p]) => ({ + id, + name: p.name, + position: p.position, + color: p.color, + finished: p.finished, + finishPosition: p.finishPosition + })); +} + +io.on('connection', (socket) => { + let roomId = null; + + socket.on('createRoom', ({ name }) => { + if (!name || name.trim().length === 0) return; + roomId = genRoomId(); + // Make sure room ID is unique + while (rooms[roomId]) roomId = genRoomId(); + + const color = COLORS[0]; + rooms[roomId] = { + host: socket.id, + state: 'lobby', + finishCount: 0, + players: { + [socket.id]: { + name: name.trim().slice(0, 20), + color, + position: 0, + queue: shuffle(Array.from({ length: riddles.length }, (_, i) => i)), + queuePos: 0, + finished: false, + finishPosition: null + } + } + }; + + socket.join(roomId); + socket.emit('roomCreated', { roomId }); + socket.emit('lobbyState', { + players: publicPlayers(rooms[roomId]), + isHost: true, + roomId + }); + }); + + socket.on('joinRoom', ({ name, code }) => { + if (!name || name.trim().length === 0) return socket.emit('joinError', 'Please enter your name.'); + const upperCode = (code || '').trim().toUpperCase(); + const room = rooms[upperCode]; + if (!room) return socket.emit('joinError', 'Room not found. Check the code and try again.'); + if (room.state !== 'lobby') return socket.emit('joinError', 'That race already started. Wait for the next one!'); + if (Object.keys(room.players).length >= 8) return socket.emit('joinError', 'Room is full (max 8 racers).'); + + const usedColors = new Set(Object.values(room.players).map(p => p.color)); + const color = COLORS.find(c => !usedColors.has(c)) || COLORS[Object.keys(room.players).length % COLORS.length]; + + room.players[socket.id] = { + name: name.trim().slice(0, 20), + color, + position: 0, + queue: shuffle(Array.from({ length: riddles.length }, (_, i) => i)), + queuePos: 0, + finished: false, + finishPosition: null + }; + + roomId = upperCode; + socket.join(upperCode); + + socket.emit('joinedRoom', { roomId: upperCode }); + socket.emit('lobbyState', { + players: publicPlayers(room), + isHost: false, + roomId: upperCode + }); + + // Tell everyone else a new racer joined + socket.to(upperCode).emit('playerUpdate', { + players: publicPlayers(room), + message: `${room.players[socket.id].name} joined the race!` + }); + }); + + socket.on('startGame', () => { + if (!roomId) return; + const room = rooms[roomId]; + if (!room || room.host !== socket.id || room.state !== 'lobby') return; + if (Object.keys(room.players).length < 1) return; + + room.state = 'playing'; + + // Send each player their first riddle individually + Object.entries(room.players).forEach(([pid, player]) => { + const riddleIdx = player.queue[player.queuePos]; + io.to(pid).emit('gameStarted', { + players: publicPlayers(room), + riddle: { + question: riddles[riddleIdx].question, + hint: riddles[riddleIdx].hint + }, + riddleNum: 1, + total: FINISH_LINE + }); + }); + }); + + socket.on('submitAnswer', ({ answer }) => { + if (!roomId) return; + const room = rooms[roomId]; + if (!room || room.state !== 'playing') return; + + const player = room.players[socket.id]; + if (!player || player.finished) return; + if (!answer || answer.trim().length === 0) return; + + const riddleIdx = player.queue[player.queuePos]; + + if (!checkAnswer(answer, riddleIdx)) { + return socket.emit('answerResult', { correct: false }); + } + + // Correct answer! + player.position++; + player.queuePos++; + + if (player.position >= FINISH_LINE) { + room.finishCount++; + player.finished = true; + player.finishPosition = room.finishCount; + + // Update track for all + io.to(roomId).emit('positionUpdate', { players: publicPlayers(room) }); + + // Announce finish to all + io.to(roomId).emit('playerFinished', { + name: player.name, + place: player.finishPosition + }); + + // Tell this player they're done + socket.emit('answerResult', { + correct: true, + finished: true, + finishPosition: player.finishPosition + }); + + // Check if everyone is done + if (Object.values(room.players).every(p => p.finished)) { + room.state = 'finished'; + const results = Object.values(room.players) + .sort((a, b) => a.finishPosition - b.finishPosition) + .map(p => ({ name: p.name, color: p.color, place: p.finishPosition })); + setTimeout(() => io.to(roomId).emit('gameOver', { results }), 1500); + } + } else { + const nextRiddleIdx = player.queue[player.queuePos]; + const nextRiddle = riddles[nextRiddleIdx]; + + // Update track for all + io.to(roomId).emit('positionUpdate', { players: publicPlayers(room) }); + + // Send next riddle to this player + socket.emit('answerResult', { + correct: true, + finished: false, + riddle: { + question: nextRiddle.question, + hint: nextRiddle.hint + }, + riddleNum: player.position + 1, + total: FINISH_LINE + }); + } + }); + + socket.on('getHint', () => { + if (!roomId) return; + const room = rooms[roomId]; + if (!room || room.state !== 'playing') return; + const player = room.players[socket.id]; + if (!player || player.finished) return; + + const riddle = riddles[player.queue[player.queuePos]]; + socket.emit('hint', { hint: riddle.hint }); + }); + + socket.on('playAgain', () => { + if (!roomId) return; + const room = rooms[roomId]; + if (!room || room.host !== socket.id) return; + + room.state = 'lobby'; + room.finishCount = 0; + + Object.values(room.players).forEach(p => { + p.position = 0; + p.queue = shuffle(Array.from({ length: riddles.length }, (_, i) => i)); + p.queuePos = 0; + p.finished = false; + p.finishPosition = null; + }); + + io.to(roomId).emit('returnToLobby', { players: publicPlayers(room) }); + }); + + socket.on('disconnect', () => { + if (!roomId || !rooms[roomId]) return; + const room = rooms[roomId]; + const player = room.players[socket.id]; + if (!player) return; + + const name = player.name; + const wasHost = room.host === socket.id; + delete room.players[socket.id]; + + if (Object.keys(room.players).length === 0) { + delete rooms[roomId]; + return; + } + + if (wasHost) { + room.host = Object.keys(room.players)[0]; + } + + io.to(roomId).emit('playerUpdate', { + players: publicPlayers(room), + message: `${name} left the race.`, + newHost: wasHost ? room.host : null + }); + + // If game was in progress and all remaining players finished, end it + if (room.state === 'playing') { + const allDone = Object.values(room.players).every(p => p.finished); + if (allDone && Object.keys(room.players).length > 0) { + room.state = 'finished'; + const results = Object.values(room.players) + .sort((a, b) => a.finishPosition - b.finishPosition) + .map(p => ({ name: p.name, color: p.color, place: p.finishPosition })); + io.to(roomId).emit('gameOver', { results }); + } + } + }); +}); + +const PORT = process.env.PORT || 3000; +server.listen(PORT, () => { + console.log(`\n🏎️ Riddle Racer is running!`); + console.log(` Open http://localhost:${PORT} in your browser\n`); +});