commit bf2f2cd290390ee9af0ad61dd56dd671ed9a5b40 Author: Alex Date: Thu May 12 16:05:32 2022 -0700 Update npm lockfile to v2. diff --git a/package-lock.json b/package-lock.json index b089b05..53f875c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,1980 @@ { - "name": "1dchess", - "version": "1.0.0", - "lockfileVersion": 1, + "name": "draft-chess", + "version": "0.0.1", + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "draft-chess", + "version": "0.0.1", + "license": "ISC", + "devDependencies": { + "@tsconfig/recommended": "^1.0.1", + "@types/node": "^17.0.5", + "@typescript-eslint/eslint-plugin": "^5.15.0", + "@typescript-eslint/parser": "^5.15.0", + "eslint": "^8.11.0", + "http-server": "^14.1.0", + "typescript": "^4.6.2" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.1.tgz", + "integrity": "sha512-bxvbYnBPN1Gibwyp6NrpnFzA3YtRL3BBAyEAFVIpNTm2Rn4Vy87GA5M4aSn3InRrlsbX5N0GW7XIx+U4SAEKdQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.3.1", + "globals": "^13.9.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@eslint/eslintrc/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", + "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@tsconfig/recommended": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/recommended/-/recommended-1.0.1.tgz", + "integrity": "sha512-2xN+iGTbPBEzGSnVp/Hd64vKJCJWxsi9gfs88x4PPMyEjHJoA3o5BY9r5OLPHIZU2pAQxkSAsJFqn6itClP8mQ==", + "dev": true + }, + "node_modules/@types/json-schema": { + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.10.tgz", + "integrity": "sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A==", + "dev": true + }, + "node_modules/@types/node": { + "version": "17.0.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.5.tgz", + "integrity": "sha512-w3mrvNXLeDYV1GKTZorGJQivK6XLCoGwpnyJFbJVK/aTBQUxOCaa/GlFAAN3OTDFcb7h5tiFG+YXCO2By+riZw==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.15.0.tgz", + "integrity": "sha512-u6Db5JfF0Esn3tiAKELvoU5TpXVSkOpZ78cEGn/wXtT2RVqs2vkt4ge6N8cRCyw7YVKhmmLDbwI2pg92mlv7cA==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/type-utils": "5.15.0", + "@typescript-eslint/utils": "5.15.0", + "debug": "^4.3.2", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.1.8", + "regexpp": "^3.2.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.15.0.tgz", + "integrity": "sha512-NGAYP/+RDM2sVfmKiKOCgJYPstAO40vPAgACoWPO/+yoYKSgAXIFaBKsV8P0Cc7fwKgvj27SjRNX4L7f4/jCKQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/typescript-estree": "5.15.0", + "debug": "^4.3.2" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.15.0.tgz", + "integrity": "sha512-EFiZcSKrHh4kWk0pZaa+YNJosvKE50EnmN4IfgjkA3bTHElPtYcd2U37QQkNTqwMCS7LXeDeZzEqnsOH8chjSg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.15.0.tgz", + "integrity": "sha512-KGeDoEQ7gHieLydujGEFLyLofipe9PIzfvA/41urz4hv+xVxPEbmMQonKSynZ0Ks2xDhJQ4VYjB3DnRiywvKDA==", + "dev": true, + "dependencies": { + "@typescript-eslint/utils": "5.15.0", + "debug": "^4.3.2", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@typescript-eslint/types": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.15.0.tgz", + "integrity": "sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.15.0.tgz", + "integrity": "sha512-Hb0e3dGc35b75xLzixM3cSbG1sSbrTBQDfIScqdyvrfJZVEi4XWAT+UL/HMxEdrJNB8Yk28SKxPLtAhfCbBInA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@typescript-eslint/utils": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.15.0.tgz", + "integrity": "sha512-081rWu2IPKOgTOhHUk/QfxuFog8m4wxW43sXNOMSCdh578tGJ1PAaWPsj42LOa7pguh173tNlMigsbrHvh/mtA==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/typescript-estree": "5.15.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.15.0.tgz", + "integrity": "sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.15.0", + "eslint-visitor-keys": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "dev": true, + "dependencies": { + "lodash": "^4.17.14" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "dev": true, + "dependencies": { + "safe-buffer": "5.1.2" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/corser": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz", + "integrity": "sha1-jtolLsqrWEDc2XXOuQ2TcMgZ/4c=", + "dev": true, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.11.0.tgz", + "integrity": "sha512-/KRpd9mIRg2raGxHRGwW9ZywYNAClZrHjdueHcrVDuO3a6bj83eoTirCCk0M0yPwOjWYKHwRVRid+xK4F/GHgA==", + "dev": true, + "dependencies": { + "@eslint/eslintrc": "^1.2.1", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.6.0", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/espree": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", + "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==", + "dev": true, + "dependencies": { + "acorn": "^8.7.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "node_modules/fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", + "dev": true + }, + "node_modules/follow-redirects": { + "version": "1.14.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", + "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globals": { + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", + "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "dev": true, + "dependencies": { + "whatwg-encoding": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/http-server": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/http-server/-/http-server-14.1.0.tgz", + "integrity": "sha512-5lYsIcZtf6pdR8tCtzAHTWrAveo4liUlJdWc7YafwK/maPgYHs+VNP6KpCClmUnSorJrARVMXqtT055zBv11Yg==", + "dev": true, + "dependencies": { + "basic-auth": "^2.0.1", + "chalk": "^4.1.2", + "corser": "^2.0.1", + "he": "^1.2.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy": "^1.18.1", + "mime": "^1.6.0", + "minimist": "^1.2.5", + "opener": "^1.5.1", + "portfinder": "^1.0.28", + "secure-compare": "3.0.1", + "union": "~0.5.0", + "url-join": "^4.0.1" + }, + "bin": { + "http-server": "bin/http-server" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dev": true, + "dependencies": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, + "node_modules/mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "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==", + "dev": true + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node_modules/object-inspect": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/opener": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "dev": true, + "bin": { + "opener": "bin/opener-bin.js" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/portfinder": { + "version": "1.0.28", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz", + "integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==", + "dev": true, + "dependencies": { + "async": "^2.6.2", + "debug": "^3.1.1", + "mkdirp": "^0.5.5" + }, + "engines": { + "node": ">= 0.12.0" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "dev": true, + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "dev": true + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "node_modules/secure-compare": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/secure-compare/-/secure-compare-3.0.1.tgz", + "integrity": "sha1-8aAymzCLIh+uN7mXTz1XjQypmeM=", + "dev": true + }, + "node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/union": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/union/-/union-0.5.0.tgz", + "integrity": "sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==", + "dev": true, + "dependencies": { + "qs": "^6.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", + "dev": true + }, + "node_modules/v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "dev": true, + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + }, "dependencies": { "@eslint/eslintrc": { "version": "1.2.1", @@ -289,7 +2261,8 @@ "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true + "dev": true, + "requires": {} }, "ajv": { "version": "6.12.6", @@ -331,9 +2304,9 @@ "dev": true }, "async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", "dev": true, "requires": { "lodash": "^4.17.14" @@ -1038,9 +3011,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "mkdirp": { commit 8feb547a8d36cd2bddede01d748174febf72150c Author: alex Date: Wed Apr 20 18:04:12 2022 -0400 Improve SimplePiece getLegalmoves performance. diff --git a/.gitignore b/.gitignore index 0a8a33b..f1f738a 100755 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules/ dist *:Zone.Identifier lib/img +vscode-profile-*.cpuprofile diff --git a/core/perf/minimaxPerformance.ts b/core/perf/minimaxPerformance.ts index fe1a788..7f7fabb 100644 --- a/core/perf/minimaxPerformance.ts +++ b/core/perf/minimaxPerformance.ts @@ -1,4 +1,5 @@ import { minimaxAI } from "../ai/minimax"; +import { minimaxAlphaBetaAI } from "../ai/minimaxAB"; import MyopicMiniMax from "../ai/myopic_minimax"; import randomAI from "../ai/random"; import { BoardState, Player, Square } from "../models"; @@ -27,8 +28,8 @@ export function versus(runs: number) { } -export function boardValue(strength: number, runs: number, board: BoardState, rules: RuleSet): [number, number, number] { - const cpu1 = new minimaxAI(strength); +export function boardValue(strength: number, runs: number, board: BoardState, rules: RuleSet, prune: boolean): [number, number, number] { + const cpu1 = prune ? new minimaxAlphaBetaAI(strength) : new minimaxAI(strength); const cpu2 = new MyopicMiniMax(new randomAI(), 0.5); let wins = 0, losses = 0, max_turns = 0; for (let index = 0; index < runs; index++) { @@ -43,12 +44,12 @@ export function boardValue(strength: number, runs: number, board: BoardState, ru return [wins, losses, max_turns]; } -export function testBoards(dim: Square, boards: number, runs: number, pieces: number, strength: number, rules: RuleSet) { +export function testBoards(dim: Square, boards: number, runs: number, pieces: number, strength: number, rules: RuleSet, prune: boolean) { const board_wrs = []; for (let i = 0; i < boards; i++) { const board = generateBoard(dim, pieces, true); printBoard(board); - const [wins, losses, max_moves] = boardValue(strength, runs, board, rules); + const [wins, losses, max_moves] = boardValue(strength, runs, board, rules, prune); console.log("wins: %d, losses: %d, ties: %d, winrate: %f", wins, losses, runs - wins - losses, wins / runs); board_wrs.push([board, wins, losses, max_moves]); } @@ -57,7 +58,7 @@ export function testBoards(dim: Square, boards: number, runs: number, pieces: nu -testBoards({ 'file': 2, 'rank': 9 }, 100, 50, 3, 4, new SimpleRuleSet()).forEach(([b, w, l, m]) => { +testBoards({ 'file': 2, 'rank': 9 }, 100, 50, 3, 4, new SimpleRuleSet(), true).forEach(([b, w, l, m]) => { printBoard(b as BoardState); console.log(w, l, m); });; diff --git a/core/rules/simplePieces.ts b/core/rules/simplePieces.ts index f8e0bb3..d95e8d0 100644 --- a/core/rules/simplePieces.ts +++ b/core/rules/simplePieces.ts @@ -1,5 +1,5 @@ import { boardToState } from "../game/conversions.js"; -import { nextPlayer } from "../game/gameModel.js"; +import { Game, nextPlayer } from "../game/gameModel.js"; import { PiecePosition, Square, Move, Player, PieceType, Rules, BoardState } from "../models.js"; import { GameBoard } from "../game/GameBoard"; import { blocked, enumeratePositions, pieceAtLocation } from "../utils.js"; @@ -17,9 +17,12 @@ export abstract class SimplePiece implements GamePiece { this.state.position = location; } abstract legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean; + potentialMoves(position: GameBoard): Square[] { + return enumeratePositions(position.boardDimensions); + } getLegalMoves(considerCheck: boolean, position: GameBoard): Square[] { - return enumeratePositions(position.boardDimensions).filter(x => this.legalMove(x, considerCheck, position)); + return this.potentialMoves(position).filter(x => this.legalMove(x, considerCheck, position)); } locationToMove(to: Square): Move { return { "from": this.state.position, "to": to }; @@ -34,6 +37,10 @@ function emptyOrOpponent(position: GameBoard, location: Square, current_player: return pieceAtLocation(position, location)?.state.player !== current_player; } +function onBoard(s: Square, boardDims: Square) { + return s.file >= 0 && s.file <= boardDims.file && s.rank >= 0 && s.rank <= boardDims.rank; +} + export function pieceToGamePiece(piece: PiecePosition): GamePiece { return piece.piece === PieceType.Bishop ? new SimpleBishop(piece.position, piece.player) : piece.piece === PieceType.King ? new SimpleKing(piece.position, piece.player) @@ -44,7 +51,22 @@ export function pieceToGamePiece(piece: PiecePosition): GamePiece { } export class SimpleKing extends SimplePiece { - legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean { + override potentialMoves(position: GameBoard): Square[] { + const pos = this.state.position; + const out = [ + { 'file': pos.file - 1, 'rank': pos.rank - 1 }, + { 'file': pos.file - 1, 'rank': pos.rank }, + { 'file': pos.file - 1, 'rank': pos.rank + 1 }, + { 'file': pos.file, 'rank': pos.rank - 1 }, + { 'file': pos.file, 'rank': pos.rank + 1 }, + { 'file': pos.file + 1, 'rank': pos.rank - 1 }, + { 'file': pos.file + 1, 'rank': pos.rank }, + { 'file': pos.file + 1, 'rank': pos.rank + 1 } + ]; + return out.filter(s => onBoard(s, position.boardDimensions)); + } + + override legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean { return Math.abs(this.state.position.file - location.file) <= 1 && Math.abs(this.state.position.rank - location.rank) <= 1 && emptyOrOpponent(position, location, this.state.player) @@ -56,7 +78,21 @@ export class SimpleKing extends SimplePiece { } export class SimpleKnight extends SimplePiece { - legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean { + override potentialMoves(position: GameBoard): Square[] { + const pos = this.state.position; + const out = [ + { 'file': pos.file - 2, 'rank': pos.rank - 1 }, + { 'file': pos.file - 2, 'rank': pos.rank + 1 }, + { 'file': pos.file - 1, 'rank': pos.rank - 2 }, + { 'file': pos.file - 1, 'rank': pos.rank + 2 }, + { 'file': pos.file + 1, 'rank': pos.rank - 2 }, + { 'file': pos.file + 1, 'rank': pos.rank + 2 }, + { 'file': pos.file + 2, 'rank': pos.rank - 1 }, + { 'file': pos.file + 2, 'rank': pos.rank + 1 }, + ]; + return out.filter(s => onBoard(s, position.boardDimensions)); + } + override legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean { return (Math.abs(this.state.position.file - location.file) === 2 && Math.abs(this.state.position.rank - location.rank) === 1 || Math.abs(this.state.position.file - location.file) === 1 && Math.abs(this.state.position.rank - location.rank) === 2) && emptyOrOpponent(position, location, this.state.player) @@ -68,7 +104,7 @@ export class SimpleKnight extends SimplePiece { } export class SimpleBishop extends SimplePiece { - legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean { + override legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean { return (this.state.position.file - this.state.position.rank === location.file - location.rank || this.state.position.file + this.state.position.rank === location.file + location.rank) && emptyOrOpponent(position, location, this.state.player) @@ -81,7 +117,7 @@ export class SimpleBishop extends SimplePiece { } export class SimpleQueen extends SimplePiece { - legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean { + override legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean { return (this.state.position.file - this.state.position.rank === location.file - location.rank || this.state.position.file + this.state.position.rank === location.file + location.rank || this.state.position.file === location.file || this.state.position.rank === location.rank) @@ -95,7 +131,7 @@ export class SimpleQueen extends SimplePiece { } export class SimpleRook extends SimplePiece { - legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean { + override legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean { return (this.state.position.file === location.file || this.state.position.rank === location.rank) && emptyOrOpponent(position, location, this.state.player) && !blocked(boardToState(position), this.state.position, location) @@ -107,7 +143,19 @@ export class SimpleRook extends SimplePiece { } export class SimplePawn extends SimplePiece { - legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean { + override potentialMoves(position: GameBoard): Square[] { + const rankMult: -1 | 1 = this.state.player === Player.White ? 1 : -1; + const pos = this.state.position; + const out = [ + { 'file': pos.file, 'rank': pos.rank + rankMult }, + { 'file': pos.file, 'rank': pos.rank + rankMult * 2 }, + { 'file': pos.file - 1, 'rank': pos.rank + rankMult }, + { 'file': pos.file + 1, 'rank': pos.rank + rankMult }, + ]; + return out.filter(s => onBoard(s, position.boardDimensions)); + } + + override legalMove(location: Square, considerCheck: boolean, position: GameBoard): boolean { const rankMult: -1 | 1 = this.state.player === Player.White ? 1 : -1; const twoMoveRank = this.state.player === Player.White ? 1 : position.boardDimensions.rank - 2; const curPos: Square = this.state.position; diff --git a/core/utils.ts b/core/utils.ts index 875eca0..7023a3d 100755 --- a/core/utils.ts +++ b/core/utils.ts @@ -1,15 +1,17 @@ -import { BoardState, Square, Player, PiecePosition } from "./models.js"; +import { fileToLetter, unparsePieceColour } from "./game/conversions.js"; import { GameBoard } from "./game/GameBoard"; +import { BoardState, PiecePosition, Player, Square } from "./models.js"; import { GamePiece } from "./rules/piece.js"; -import { fileToLetter, unparsePieceColour } from "./game/conversions.js"; -// Return a list of possible positions within dimensions +// Return a list of possible positions within dimensions. +// Iterative implementation is much faster than functional implementation export function enumeratePositions(dimensions: Square): Square[] { - const ranks = range(dimensions.rank); - const files = range(dimensions.file); - // 2-ary Cartesian product - return ranks.flatMap(x => files.map(y => { return { rank: x, file: y } as Square })); + const out = []; + for (let i = 0; i < dimensions.file; i++) + for (let j = 0; j < dimensions.rank; j++) + out.push({ 'file': i, 'rank': j }); + return out; } commit bcd581d22a277d2f7e8766219f96412f516418af Author: alex Date: Wed Apr 20 16:59:00 2022 -0400 Add minimaxAB tests. Refactor AI, myopic minimax AI. Add deterministic AI. diff --git a/.vscode/launch.json b/.vscode/launch.json index d597a6b..644a546 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -46,6 +46,17 @@ "type": "pwa-node", "preLaunchTask": "build core" }, + { + "name": "Test Minimax pruning", + "program": "${workspaceFolder}/core/perf/test_minimaxPruning.ts", + "request": "launch", + "console": "integratedTerminal", + "skipFiles": [ + "/**" + ], + "type": "pwa-node", + "preLaunchTask": "build core" + }, { "name": "Minimax Performance", "program": "${workspaceFolder}/core/perf/minimaxPerformance.ts", diff --git a/core/ai/interface.ts b/core/ai/base.ts similarity index 66% rename from core/ai/interface.ts rename to core/ai/base.ts index 1d3ecac..8a904f0 100755 --- a/core/ai/interface.ts +++ b/core/ai/base.ts @@ -4,10 +4,13 @@ import { GameBoard } from "../game/GameBoard"; export abstract class AIPlayer { - protected difficulty: number; - constructor(difficulty: number) { + protected readonly difficulty: number[]; + constructor(...difficulty: number[]) { this.difficulty = difficulty; } + protected difficulty_param(index: number): number { + return this.difficulty[index] || 0; + } abstract move(position: GameBoard, player: Player): Move; abstract draft(rules: DraftRules, board: BoardState, player: Player, points: number): PiecePosition; } diff --git a/core/ai/deterministic.ts b/core/ai/deterministic.ts new file mode 100755 index 0000000..c701cc8 --- /dev/null +++ b/core/ai/deterministic.ts @@ -0,0 +1,29 @@ +import { DraftRules } from "../draft/draftRules.js"; +import { GameBoard } from "../game/GameBoard"; +import { BoardState, Move, PiecePosition, PieceType, Player, Square } from "../models.js"; +import { nextEmptySquare } from "../utils.js"; +import { AIPlayer } from "./base.js"; + + +export default class determinsticAI extends AIPlayer { + private randomState = this.difficulty_param(0) || 1; + + move(position: GameBoard, player: Player): Move { + const b = position.gamePieces.filter(p => p.state.player === player) + .flatMap(p => p.getLegalMoves(position.rules.rules.kingCheck, position) + .map(to => { return { 'from': p.state.position, 'to': to }; })); + return b[Math.floor(this.prng() * b.length)] as Move; + } + + draft(rules: DraftRules, board: BoardState, player: Player, points: number): PiecePosition { + const pieces = Object.values(PieceType).filter(p => rules.pieceCost[p] <= points); + const piece = pieces[Math.floor(this.prng() * pieces.length)] as PieceType; + return { 'piece': piece, 'player': player, 'position': nextEmptySquare(board, player) as Square }; + } + + // simple PRNG taken from https://stackoverflow.com/a/19303725/9074788 + private prng() { + const x = Math.sin(this.randomState++) * 10000; + return x - Math.floor(x); + } +} \ No newline at end of file diff --git a/core/ai/minimax.ts b/core/ai/minimax.ts index 941e5dc..7fb387e 100755 --- a/core/ai/minimax.ts +++ b/core/ai/minimax.ts @@ -1,10 +1,8 @@ -import { DraftRules } from "../draft/draftRules.js"; import { boardToState } from "../game/conversions.js"; -import { checkGameState, cloneBoard, GameStatus, nextPlayer, updateWithMove } from "../game/gameModel.js"; -import { Player, Move, BoardState, PiecePosition } from "../models.js"; import { GameBoard } from "../game/GameBoard"; +import { checkGameState, cloneBoard, GameStatus, nextPlayer, updateWithMove } from "../game/gameModel.js"; +import { Move, Player } from "../models.js"; import { countPieces, printBoard } from "../utils.js"; -import { AIPlayer } from "./interface.js"; import randomAI from "./random.js"; interface MoveVal { @@ -14,16 +12,16 @@ interface MoveVal { const DEBUG = false; -export class minimaxAI extends AIPlayer { - move(position: GameBoard, player: Player): Move { - const move = this._minimax(position, player, 0, this.difficulty) as MoveVal; +export class minimaxAI extends randomAI { + public val = 0; + + override move(position: GameBoard, player: Player): Move { + const move = this._minimax(position, player, 0, this.difficulty_param(0)) as MoveVal; DEBUG && console.log("Eval:", move.val); + this.val = move.val; return move.move; } - draft(rules: DraftRules, board: BoardState, player: Player, points: number): PiecePosition { - return random.draft(rules, board, player, points); - } _minimax(position: GameBoard, player: Player, depth: number, max_depth: number): number | MoveVal { const state = checkGameState(position, player); @@ -68,9 +66,8 @@ export class minimaxAI extends AIPlayer { } } -const random = new randomAI(0); -function possibleMoves(position: GameBoard, player: Player): Move[] { +export function possibleMoves(position: GameBoard, player: Player): Move[] { return position.gamePieces .filter(p => p.state.player === player) .flatMap(p => p.getLegalMoves(position.rules.rules.kingCheck, position) diff --git a/core/ai/minimaxAB.ts b/core/ai/minimaxAB.ts index 16d2e74..12e2614 100755 --- a/core/ai/minimaxAB.ts +++ b/core/ai/minimaxAB.ts @@ -1,10 +1,7 @@ -import { DraftRules } from "../draft/draftRules.js"; -import { boardToState } from "../game/conversions.js"; -import { checkGameState, cloneBoard, GameStatus, nextPlayer, updateWithMove } from "../game/gameModel.js"; -import { Player, Move, BoardState, PiecePosition } from "../models.js"; import { GameBoard } from "../game/GameBoard"; -import { countPieces, printBoard } from "../utils.js"; -import { AIPlayer } from "./interface.js"; +import { checkGameState, cloneBoard, nextPlayer, updateWithMove } from "../game/gameModel.js"; +import { Move, Player } from "../models.js"; +import { evaluate, possibleMoves } from "./minimax.js"; import randomAI from "./random.js"; interface MoveVal { @@ -12,26 +9,23 @@ interface MoveVal { val: number } -const DEBUG = true; +const DEBUG = false; -export class minimaxAlphaBetaAI extends AIPlayer { +export class minimaxAlphaBetaAI extends randomAI { private skips = 0; private visits = 0; + public val = 0; - move(position: GameBoard, player: Player): Move { + override move(position: GameBoard, player: Player): Move { this.skips = 0; this.visits = 0; - - const move = this.minimax(position, player, 0, this.difficulty, -Infinity, Infinity) as MoveVal; + const move = this.minimax(position, player, 0, this.difficulty_param(0), -Infinity, Infinity) as MoveVal; DEBUG && console.log("Eval:", move.val); DEBUG && console.log("Visited %d, skipped %d", this.visits, this.skips); + this.val = move.val; return move.move; } - draft(rules: DraftRules, board: BoardState, player: Player, points: number): PiecePosition { - return random.draft(rules, board, player, points); - } - private minimax(position: GameBoard, player: Player, depth: number, max_depth: number, alpha: number, beta: number): number | MoveVal { const state = checkGameState(position, player); // leaf node @@ -75,26 +69,3 @@ export class minimaxAlphaBetaAI extends AIPlayer { } } } - -const random = new randomAI(0); - - -function possibleMoves(position: GameBoard, player: Player): Move[] { - return position.gamePieces - .filter(p => p.state.player === player) - .flatMap(p => p.getLegalMoves(position.rules.rules.kingCheck, position) - .map(to => { return { 'from': p.state.position, 'to': to }; })); -} - -// evaluate game state based on advantage for White -export function evaluate(position: GameBoard, player: Player, status?: GameStatus): number { - status = status || checkGameState(position, player); - const board = boardToState(position); - const max_val = board.boardDimensions.file * board.boardDimensions.rank; - if (status.status === "draw") - return 0; - else if (status.status === "loss") - return player === Player.White ? -max_val : max_val; - else - return 2 * (position.gamePieces.length / 2 - countPieces(board, p => p.player === Player.Black)); -} diff --git a/core/ai/myopic_minimax.ts b/core/ai/myopic_minimax.ts new file mode 100755 index 0000000..a72ebd1 --- /dev/null +++ b/core/ai/myopic_minimax.ts @@ -0,0 +1,25 @@ +import { DraftRules } from "../draft/draftRules.js"; +import { Player, Move, BoardState, PiecePosition } from "../models.js"; +import { GameBoard } from "../game/GameBoard"; +import { AIPlayer } from "./base.js"; +import randomAI from "./random.js"; +import { minimaxAlphaBetaAI } from "./minimaxAB.js"; + + + + +export default class MyopicMiniMax extends minimaxAlphaBetaAI { + private ai; + constructor(ai: AIPlayer = new randomAI(), ...difficulty: number[]) { + super(1, ...difficulty); + this.ai = ai; + } + override move(position: GameBoard, player: Player): Move { + return Math.random() > this.difficulty_param(1) ? this.ai.move(position, player) : super.move(position, player); + } + + draft(rules: DraftRules, board: BoardState, player: Player, points: number): PiecePosition { + return this.ai.draft(rules, board, player, points); + } + +} \ No newline at end of file diff --git a/core/ai/myopic_minimax_random.ts b/core/ai/myopic_minimax_random.ts deleted file mode 100755 index c56e580..0000000 --- a/core/ai/myopic_minimax_random.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { DraftRules } from "../draft/draftRules.js"; -import { Player, Move, BoardState, PiecePosition } from "../models.js"; -import { GameBoard } from "../game/GameBoard"; -import { AIPlayer } from "./interface.js"; -import randomAI from "./random.js"; -import { minimaxAI } from "./minimax.js"; - -const random = new randomAI(0); -const myopicMiniMax = new minimaxAI(1); - -export default class MyopicMiniMaxRandom extends AIPlayer { - move(position: GameBoard, player: Player): Move { - return Math.random() > this.difficulty ? random.move(position, player) : myopicMiniMax.move(position, player); - } - - draft(rules: DraftRules, board: BoardState, player: Player, points: number): PiecePosition { - return random.draft(rules, board, player, points); - } - -} \ No newline at end of file diff --git a/core/ai/random.ts b/core/ai/random.ts index 67353d8..779d413 100755 --- a/core/ai/random.ts +++ b/core/ai/random.ts @@ -2,7 +2,7 @@ import { DraftRules } from "../draft/draftRules.js"; import { Player, Move, BoardState, PiecePosition, PieceType, Square } from "../models.js"; import { GameBoard } from "../game/GameBoard"; import { nextEmptySquare, randItem } from "../utils.js"; -import { AIPlayer } from "./interface.js"; +import { AIPlayer } from "./base.js"; export default class randomAI extends AIPlayer { diff --git a/core/draft/draftController.ts b/core/draft/draftController.ts index 9993570..2335168 100644 --- a/core/draft/draftController.ts +++ b/core/draft/draftController.ts @@ -1,4 +1,4 @@ -import { AIPlayer } from "../ai/interface.js"; +import { AIPlayer } from "../ai/base.js"; import randomAI from "../ai/random.js"; import { unparseSquare } from "../game/conversions.js"; import { BoardState, PiecePosition, Player } from "../models.js"; @@ -18,7 +18,7 @@ export function validateDraftChoice(rules: DraftRules, board: BoardState, player // this is a draft controller. It's really only useful for CLI games - do not use this for event-driven uses export async function runAIDraft(draftRules: DraftRules, board: BoardState, choosePiece: (rules: DraftRules, board: BoardState, player: Player, points: number) => Promise): Promise { - const ai: AIPlayer = new randomAI(0); + const ai: AIPlayer = new randomAI(); const draft = new Draft(board, draftRules, Player.White); for (let round = 0; round < draftRules.rounds; round++) { diff --git a/core/game/gameCLI.ts b/core/game/gameCLI.ts index b52e80b..132dbda 100644 --- a/core/game/gameCLI.ts +++ b/core/game/gameCLI.ts @@ -1,4 +1,4 @@ -import { AIPlayer } from "../ai/interface.js"; +import { AIPlayer } from "../ai/base.js"; import randomAI from "../ai/random.js"; import { BoardState, Move, Player } from "../models.js"; import { RuleSet } from "../rules/piece.js"; diff --git a/core/perf/AIVersusGame.ts b/core/perf/AIVersusGame.ts index 3b30025..388ed6c 100644 --- a/core/perf/AIVersusGame.ts +++ b/core/perf/AIVersusGame.ts @@ -1,4 +1,4 @@ -import { AIPlayer } from "../ai/interface.js"; +import { AIPlayer } from "../ai/base.js"; import { Game, GameStatus } from "../game/gameModel.js"; import { BoardState, Player } from "../models.js"; import { RuleSet } from "../rules/piece.js"; diff --git a/core/perf/minimaxPerformance.ts b/core/perf/minimaxPerformance.ts index db3225f..fe1a788 100644 --- a/core/perf/minimaxPerformance.ts +++ b/core/perf/minimaxPerformance.ts @@ -1,5 +1,5 @@ import { minimaxAI } from "../ai/minimax"; -import MyopicMiniMaxRandom from "../ai/myopic_minimax_random"; +import MyopicMiniMax from "../ai/myopic_minimax"; import randomAI from "../ai/random"; import { BoardState, Player, Square } from "../models"; import X8_rooks_knight from "../positions/2x8_rooks_knight"; @@ -10,14 +10,9 @@ import runAIVersus from "./AIVersusGame"; import generateBoard from "./generateBoard"; - - - - - export function versus(runs: number) { const cpu1 = new minimaxAI(5); - const cpu2 = new randomAI(3); + const cpu2 = new randomAI(); let wins = 0, losses = 0; for (let index = 0; index < runs; index++) { const result = runAIVersus(X8_rooks_knight(), new SimpleRuleSet(), cpu1, cpu2); @@ -34,7 +29,7 @@ export function versus(runs: number) { export function boardValue(strength: number, runs: number, board: BoardState, rules: RuleSet): [number, number, number] { const cpu1 = new minimaxAI(strength); - const cpu2 = new MyopicMiniMaxRandom(0.5); + const cpu2 = new MyopicMiniMax(new randomAI(), 0.5); let wins = 0, losses = 0, max_turns = 0; for (let index = 0; index < runs; index++) { const result = runAIVersus(board, rules, cpu1, cpu2); diff --git a/core/perf/test_minimaxPruning.ts b/core/perf/test_minimaxPruning.ts new file mode 100644 index 0000000..d9b302a --- /dev/null +++ b/core/perf/test_minimaxPruning.ts @@ -0,0 +1,40 @@ +import deterministicAI from "../ai/deterministic"; +import { minimaxAI } from "../ai/minimax"; +import { minimaxAlphaBetaAI } from "../ai/minimaxAB"; +import MyopicMiniMax from "../ai/myopic_minimax"; +import { Game, GameStatus } from "../game/gameModel.js"; +import { BoardState, Player } from "../models.js"; +import { RuleSet } from "../rules/piece.js"; +import { SimpleRuleSet } from "../rules/simplePieces"; +import { moveEq } from "../tests/utils/moveEq"; +import newBoard from "./generateBoard.js"; + + +// both players make a ply -> 1 move +const MAX_MOVES = 100; + +export function testMiniMaxes(board: BoardState, ruleSet: RuleSet, depth: number): [GameStatus, number] { + + const minimax = new minimaxAI(depth); + const minimaxAB = new minimaxAlphaBetaAI(depth); + const cpu3 = new MyopicMiniMax(new deterministicAI(1), 0.7); + const game: Game = new Game(ruleSet, board); + let move_count = 0; + while (game.gameStatus.status === "playing" && move_count < MAX_MOVES) { + const move1 = minimax.move(game.gameBoard, Player.White); + const move2 = minimaxAB.move(game.gameBoard, Player.White); + console.assert(moveEq, "", move1, move2); + console.assert(minimax.val === minimaxAB.val, "", minimax.val, minimaxAB.val); + console.log("passed", move_count); + game.makeMove(Player.White, move1); + if (game.gameStatus.status !== "playing") + break; + game.makeMove(Player.Black, cpu3.move(game.gameBoard, Player.Black)); + move_count++; + } + if (move_count === MAX_MOVES) + game.gameStatus.status = "draw"; + return [game.gameStatus, move_count]; +} + +testMiniMaxes(newBoard({ 'file': 3, 'rank': 9 }, 6, true), new SimpleRuleSet(), 3); \ No newline at end of file diff --git a/core/tests/test_parseSquare.ts b/core/tests/test_parseSquare.ts index b4fcc9c..40dbb6e 100644 --- a/core/tests/test_parseSquare.ts +++ b/core/tests/test_parseSquare.ts @@ -1,6 +1,8 @@ import { parseMove, parseSquare } from "../game/conversions.js"; import { Move, Square } from "../models.js"; +import { moveEq } from "./utils/moveEq"; +import { squareEq } from "./utils/squareEq"; export default () => { @@ -54,16 +56,3 @@ export default () => { } -function squareEq(s1: Square | null, s2: Square | null) { - return s1 && s2 - && s1.file === s2.file - && s1.rank === s2.rank; -} - -function moveEq(m1: Move | null, m2: Move | null) { - return m1 && m2 - && m1.from && m1.to - && m2.from && m2.to - && squareEq(m1.from, m2.from) - && squareEq(m1.to, m2.to); -} \ No newline at end of file diff --git a/core/tests/utils/moveEq.ts b/core/tests/utils/moveEq.ts new file mode 100644 index 0000000..dcdfe0a --- /dev/null +++ b/core/tests/utils/moveEq.ts @@ -0,0 +1,10 @@ +import { Move } from "../../models.js"; +import { squareEq } from "./squareEq"; + +export function moveEq(m1: Move | null, m2: Move | null) { + return m1 && m2 + && m1.from && m1.to + && m2.from && m2.to + && squareEq(m1.from, m2.from) + && squareEq(m1.to, m2.to); +} diff --git a/core/tests/utils/squareEq.ts b/core/tests/utils/squareEq.ts new file mode 100644 index 0000000..02e777f --- /dev/null +++ b/core/tests/utils/squareEq.ts @@ -0,0 +1,8 @@ +import { Square } from "../../models.js"; + + +export function squareEq(s1: Square | null, s2: Square | null) { + return s1 && s2 + && s1.file === s2.file + && s1.rank === s2.rank; +} diff --git a/front-end/controller.ts b/front-end/controller.ts index 58c460c..523ef34 100644 --- a/front-end/controller.ts +++ b/front-end/controller.ts @@ -1,24 +1,32 @@ -import chessboard from "../lib/chessboard.js"; -import { Game, MoveStatus } from "../core/game/gameModel.js"; +import { AIPlayer } from "../core/ai/base.js"; +import randomAI from "../core/ai/random.js"; +import draftRules1D from "../core/draft/1dDraftRules.js"; +import { Draft } from "../core/draft/draftModel.js"; +import { DraftRules } from "../core/draft/draftRules.js"; import { parseSquare, unparseMove, unparseSquare } from "../core/game/conversions.js"; -import starting_position from "../core/positions/1d_standard.js"; -import empty_position from "../core/positions/1x8_empty.js"; +import { Game, MoveStatus } from "../core/game/gameModel.js"; import { BoardState, Player } from "../core/models.js"; -import { Draft } from "../core/draft/draftModel.js"; -import { AIPlayer } from "../core/ai/interface.js"; -import randomAI from "../core/ai/random.js"; +import empty_position from "../core/positions/empty"; +import starting_position from "../core/positions/normal_chess"; import { RuleSet } from "../core/rules/piece.js"; import { SimpleRuleSet1D } from "../core/rules/simplePieces1D.js"; +import chessboard from "../lib/chessboard.js"; import { objToBoardObj, parseObjPiece, unparseObjPiece } from "./core_adapter.js"; -import { DraftRules } from "../core/draft/draftRules.js"; -import draftRules1D from "../core/draft/1dDraftRules.js"; type action = "snapback" | "trash" | "drop"; +// global state +let game: Game; +let draft: Draft; +const CPU: AIPlayer = new randomAI(); +const draftRules: DraftRules = draftRules1D; +let _element: Node | string; +let destroy: { (): void } | undefined; + // When a move is made via the UI, send that move and wait for a response move function onMove(source: string, target: string, _piece: string, @@ -59,15 +67,6 @@ function checkStatus() { } - -// global state -let game: Game; -let draft: Draft; -const CPU: AIPlayer = new randomAI(0); -const draftRules: DraftRules = draftRules1D; -let _element: Node | string; -let destroy: { (): void } | undefined; - export function startGame(element: string | Node) { const files = 1; const ranks = 8; @@ -91,7 +90,7 @@ export function startDraftGame(element: string | Node) { const files = 1; const ranks = 8; - const board: BoardState = empty_position(); + const board: BoardState = empty_position({ 'file': files, 'rank': ranks }); const draftConfig = { 'columns': files, 'rows': ranks, commit 39512adde34a5ece411a7ef67a363fa33a333f45 Author: alex Date: Wed Apr 20 15:10:00 2022 -0400 Add AB pruning for MiniMax diff --git a/core/ai/minimaxAB.ts b/core/ai/minimaxAB.ts new file mode 100755 index 0000000..16d2e74 --- /dev/null +++ b/core/ai/minimaxAB.ts @@ -0,0 +1,100 @@ +import { DraftRules } from "../draft/draftRules.js"; +import { boardToState } from "../game/conversions.js"; +import { checkGameState, cloneBoard, GameStatus, nextPlayer, updateWithMove } from "../game/gameModel.js"; +import { Player, Move, BoardState, PiecePosition } from "../models.js"; +import { GameBoard } from "../game/GameBoard"; +import { countPieces, printBoard } from "../utils.js"; +import { AIPlayer } from "./interface.js"; +import randomAI from "./random.js"; + +interface MoveVal { + move: Move + val: number +} + +const DEBUG = true; + +export class minimaxAlphaBetaAI extends AIPlayer { + private skips = 0; + private visits = 0; + + move(position: GameBoard, player: Player): Move { + this.skips = 0; + this.visits = 0; + + const move = this.minimax(position, player, 0, this.difficulty, -Infinity, Infinity) as MoveVal; + DEBUG && console.log("Eval:", move.val); + DEBUG && console.log("Visited %d, skipped %d", this.visits, this.skips); + return move.move; + } + + draft(rules: DraftRules, board: BoardState, player: Player, points: number): PiecePosition { + return random.draft(rules, board, player, points); + } + + private minimax(position: GameBoard, player: Player, depth: number, max_depth: number, alpha: number, beta: number): number | MoveVal { + const state = checkGameState(position, player); + // leaf node + if (depth === max_depth || state.status !== "playing") { + this.visits++; + const val = evaluate(position, player, state); + if (DEBUG) { + console.log("Evaluation:", val); + // printBoard(boardToState(position)); + } + return val; + } + else { + const moves = possibleMoves(position, player); + const moveVal = moves.reduce((prev, cur) => { + if (alpha >= beta) { + this.skips++; + DEBUG && console.log("Skipped at depth", depth); + return prev; + } + const move_board = cloneBoard(position); + updateWithMove(move_board, cur); + const result = this.minimax(move_board, nextPlayer(player), depth + 1, max_depth, alpha, beta); + const resultVal = typeof result === "number" ? result : result.val; // need to absorb leaf node values + // get min/max move value + if (player === Player.White && resultVal > alpha) { + DEBUG && console.log("Found better MAX: %d > %d", resultVal, alpha); + alpha = resultVal; + return { 'move': cur, 'val': resultVal }; + } + else if (player === Player.Black && resultVal < beta) { + DEBUG && console.log("Found better MIN: %d < %d", resultVal, beta); + beta = resultVal; + return { 'move': cur, 'val': resultVal }; + } + else { + return prev; + } + }, { 'move': { 'from': { 'file': 0, 'rank': 0 }, 'to': { 'file': 0, 'rank': 0 } }, 'val': player === Player.White ? alpha : beta }); + return moveVal; + } + } +} + +const random = new randomAI(0); + + +function possibleMoves(position: GameBoard, player: Player): Move[] { + return position.gamePieces + .filter(p => p.state.player === player) + .flatMap(p => p.getLegalMoves(position.rules.rules.kingCheck, position) + .map(to => { return { 'from': p.state.position, 'to': to }; })); +} + +// evaluate game state based on advantage for White +export function evaluate(position: GameBoard, player: Player, status?: GameStatus): number { + status = status || checkGameState(position, player); + const board = boardToState(position); + const max_val = board.boardDimensions.file * board.boardDimensions.rank; + if (status.status === "draw") + return 0; + else if (status.status === "loss") + return player === Player.White ? -max_val : max_val; + else + return 2 * (position.gamePieces.length / 2 - countPieces(board, p => p.player === Player.Black)); +} diff --git a/core/perf/minimaxPerformance.ts b/core/perf/minimaxPerformance.ts index 3759b87..db3225f 100644 --- a/core/perf/minimaxPerformance.ts +++ b/core/perf/minimaxPerformance.ts @@ -54,7 +54,7 @@ export function testBoards(dim: Square, boards: number, runs: number, pieces: nu const board = generateBoard(dim, pieces, true); printBoard(board); const [wins, losses, max_moves] = boardValue(strength, runs, board, rules); - console.log("wins: %d, losses: %d, ties: %d, winrate: %f", wins, losses, runs - wins + losses, wins / runs); + console.log("wins: %d, losses: %d, ties: %d, winrate: %f", wins, losses, runs - wins - losses, wins / runs); board_wrs.push([board, wins, losses, max_moves]); } return board_wrs; commit a9b7171d2eb0164592e20e39d9f126412a44964f Author: alex Date: Mon Apr 18 15:48:17 2022 -0400 Add proper test to look for interesting boards diff --git a/core/ai/myopic_minimax_random.ts b/core/ai/myopic_minimax_random.ts new file mode 100755 index 0000000..c56e580 --- /dev/null +++ b/core/ai/myopic_minimax_random.ts @@ -0,0 +1,20 @@ +import { DraftRules } from "../draft/draftRules.js"; +import { Player, Move, BoardState, PiecePosition } from "../models.js"; +import { GameBoard } from "../game/GameBoard"; +import { AIPlayer } from "./interface.js"; +import randomAI from "./random.js"; +import { minimaxAI } from "./minimax.js"; + +const random = new randomAI(0); +const myopicMiniMax = new minimaxAI(1); + +export default class MyopicMiniMaxRandom extends AIPlayer { + move(position: GameBoard, player: Player): Move { + return Math.random() > this.difficulty ? random.move(position, player) : myopicMiniMax.move(position, player); + } + + draft(rules: DraftRules, board: BoardState, player: Player, points: number): PiecePosition { + return random.draft(rules, board, player, points); + } + +} \ No newline at end of file diff --git a/core/perf/generateBoard.ts b/core/perf/generateBoard.ts index 43a603d..c20d65e 100644 --- a/core/perf/generateBoard.ts +++ b/core/perf/generateBoard.ts @@ -1,9 +1,9 @@ -import { PieceType, Player, Square } from "../models"; +import { BoardState, PieceType, Player, Square } from "../models"; import empty from "../positions/empty"; import { nextEmptySquare, randItem } from "../utils"; -export default (dim: Square, pieces: number, symmetric: boolean) => { +export default (dim: Square, pieces: number, symmetric: boolean): BoardState => { const board = empty(dim); board.pieces.push({ 'piece': PieceType.King, 'player': Player.White, 'position': nextEmptySquare(board, Player.White) as Square }); board.pieces.push({ 'piece': PieceType.King, 'player': Player.Black, 'position': nextEmptySquare(board, Player.Black) as Square }); @@ -19,8 +19,11 @@ export default (dim: Square, pieces: number, symmetric: boolean) => { const piece2 = randItem(Object.values(PieceType)); board.pieces.push({ 'piece': piece2, 'player': Player.Black, 'position': nextEmptySquare(board, Player.Black) as Square }); } + pieces--; } catch (error) { console.error(error); + break; } } + return board; } \ No newline at end of file diff --git a/core/perf/minimaxPerformance.ts b/core/perf/minimaxPerformance.ts index 6b3b319..3759b87 100644 --- a/core/perf/minimaxPerformance.ts +++ b/core/perf/minimaxPerformance.ts @@ -1,9 +1,13 @@ import { minimaxAI } from "../ai/minimax"; +import MyopicMiniMaxRandom from "../ai/myopic_minimax_random"; import randomAI from "../ai/random"; -import { Player } from "../models"; +import { BoardState, Player, Square } from "../models"; import X8_rooks_knight from "../positions/2x8_rooks_knight"; +import { RuleSet } from "../rules/piece"; import { SimpleRuleSet } from "../rules/simplePieces"; +import { printBoard } from "../utils"; import runAIVersus from "./AIVersusGame"; +import generateBoard from "./generateBoard"; @@ -11,7 +15,7 @@ import runAIVersus from "./AIVersusGame"; -export default function run(runs: number) { +export function versus(runs: number) { const cpu1 = new minimaxAI(5); const cpu2 = new randomAI(3); let wins = 0, losses = 0; @@ -24,8 +28,41 @@ export default function run(runs: number) { else wins++; } - console.log("wins: %s, losses: %s, winrate: %f", wins, losses, wins/runs); + console.log("wins: %s, losses: %s, winrate: %f", wins, losses, wins / runs); } -run(100); +export function boardValue(strength: number, runs: number, board: BoardState, rules: RuleSet): [number, number, number] { + const cpu1 = new minimaxAI(strength); + const cpu2 = new MyopicMiniMaxRandom(0.5); + let wins = 0, losses = 0, max_turns = 0; + for (let index = 0; index < runs; index++) { + const result = runAIVersus(board, rules, cpu1, cpu2); + console.log(index, result); + if (result[0].status === "loss") + if (result[0].player === Player.Black) + wins++; + else losses++; + max_turns = Math.max(max_turns, result[1]); + } + return [wins, losses, max_turns]; +} + +export function testBoards(dim: Square, boards: number, runs: number, pieces: number, strength: number, rules: RuleSet) { + const board_wrs = []; + for (let i = 0; i < boards; i++) { + const board = generateBoard(dim, pieces, true); + printBoard(board); + const [wins, losses, max_moves] = boardValue(strength, runs, board, rules); + console.log("wins: %d, losses: %d, ties: %d, winrate: %f", wins, losses, runs - wins + losses, wins / runs); + board_wrs.push([board, wins, losses, max_moves]); + } + return board_wrs; +} + + + +testBoards({ 'file': 2, 'rank': 9 }, 100, 50, 3, 4, new SimpleRuleSet()).forEach(([b, w, l, m]) => { + printBoard(b as BoardState); + console.log(w, l, m); +});;