upgrade vendors and chessground

pull/4736/head
Thibault Duplessis 2018-12-01 11:24:55 +07:00
parent 155a742474
commit ebd7b716f0
4 changed files with 50 additions and 37 deletions

View File

@ -17,8 +17,8 @@ export function capture(ctrl: RoundController, key: cg.Key) {
const k = util.pos2key([x, y]);
exploding.push(k);
const explodes = pieces[k] && (
k === key || pieces[k].role !== 'pawn')
if (explodes) diff[k] = null;
k === key || pieces[k]!.role !== 'pawn')
if (explodes) diff[k] = undefined;
}
}
ctrl.chessground.setPieces(diff);

View File

@ -345,7 +345,7 @@ export default class RoundController {
}
if (o.enpassant) {
const p = o.enpassant, pieces: cg.PiecesDiff = {};
pieces[p.key] = null;
pieces[p.key] = undefined;
this.chessground.setPieces(pieces);
if (d.game.variant.key === 'atomic') {
atomic.enpassant(this, p.key, p.color);
@ -355,8 +355,8 @@ export default class RoundController {
if (o.promotion) ground.promote(this.chessground, o.promotion.key, o.promotion.pieceClass);
if (o.castle && !this.chessground.state.autoCastle) {
const c = o.castle, pieces: cg.PiecesDiff = {};
pieces[c.king[0]] = null;
pieces[c.rook[0]] = null;
pieces[c.king[0]] = undefined;
pieces[c.rook[0]] = undefined;
pieces[c.king[1]] = {
role: 'king',
color: c.color

View File

@ -52,7 +52,7 @@ export function getMaterialDiff(pieces: cg.Pieces): MaterialDiff {
black: { king: 0, queen: 0, rook: 0, bishop: 0, knight: 0, pawn: 0 },
};
for (let k in pieces) {
const p = pieces[k], them = diff[opposite(p.color)];
const p = pieces[k]!, them = diff[opposite(p.color)];
if (them[p.role] > 0) them[p.role]--;
else diff[p.color][p.role]++;
}
@ -62,7 +62,7 @@ export function getMaterialDiff(pieces: cg.Pieces): MaterialDiff {
export function getScore(pieces: cg.Pieces): number {
let score = 0, k;
for (k in pieces) {
score += pieceScores[pieces[k].role] * (pieces[k].color === 'white' ? 1 : -1);
score += pieceScores[pieces[k]!.role] * (pieces[k]!.color === 'white' ? 1 : -1);
}
return score;
}

View File

@ -163,9 +163,9 @@ acorn@^6.0.2:
integrity sha512-VY4i5EKSKkofY2I+6QLTbTTN/UvEQPCo6eiwzzSaSWfpaDhOmStMCMod6wmuPciNq+XS0faCglFu2lHZpdHUtg==
ajv@^6.5.5:
version "6.5.5"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.5.tgz#cf97cdade71c6399a92c6d6c4177381291b781a1"
integrity sha512-7q7gtRQDJSyuEHjuVgHoUa2VuemFiCMrfQc9Tc08XTAc4Zj/5U1buQJ0HU6i7fKjXU09SVgSmxa4sLvuvS8Iyg==
version "6.6.1"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.6.1.tgz#6360f5ed0d80f232cc2b294c362d5dc2e538dd61"
integrity sha512-ZoJjft5B+EJBjUyu9C9Hc0OZyPZSSlOF+plzouTrg6UlA8f+e/n8NIgBFG/9tppJtpPWfthHakK7juJdNDODww==
dependencies:
fast-deep-equal "^2.0.1"
fast-json-stable-stringify "^2.0.0"
@ -827,9 +827,9 @@ chalk@^2.0.0, chalk@^2.3.0:
resolved "https://codeload.github.com/ornicar/chess.js/tar.gz/ad0709c0b07773d9d0da8e4605a9a2a28f00d249"
chessground@^7.3:
version "7.3.2"
resolved "https://registry.yarnpkg.com/chessground/-/chessground-7.3.2.tgz#b379c952e9c82cea30367b12ed1f4e8e0b7bece2"
integrity sha512-yOL4Jzsf1/KK4dh7JUDVnAVGYw9K3uqh3p0ZTbjPVum6+UBLHg79JvqX2TT50BybKzJ1+HDlwyolir13dgHrpg==
version "7.3.4"
resolved "https://registry.yarnpkg.com/chessground/-/chessground-7.3.4.tgz#71ede15345f3119a103c81b3cc69b5d66eebf7cf"
integrity sha512-nj0WkqA/6ar76aO9MRy0L2yIfVIGBLjp9emRM6abY5kXkZ/JXYdEDLQCqmIkLgRM2MBLD6R99h0SbbauoCizYA==
"chessground@github:ornicar/chessground#v4.4.0":
version "4.4.0"
@ -1605,12 +1605,13 @@ extsprintf@^1.2.0:
integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8=
fancy-log@^1, fancy-log@^1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.2.tgz#f41125e3d84f2e7d89a43d06d958c8f78be16be1"
integrity sha1-9BEl49hPLn2JpD0G2VjI94vha+E=
version "1.3.3"
resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.3.tgz#dbc19154f558690150a23953a0adbd035be45fc7"
integrity sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw==
dependencies:
ansi-gray "^0.1.1"
color-support "^1.1.3"
parse-node-version "^1.0.0"
time-stamp "^1.0.0"
fast-deep-equal@^2.0.1:
@ -2151,9 +2152,9 @@ hash-base@^3.0.0:
safe-buffer "^5.0.1"
hash.js@^1.0.0, hash.js@^1.0.3:
version "1.1.5"
resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.5.tgz#e38ab4b85dfb1e0c40fe9265c0e9b54854c23812"
integrity sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==
version "1.1.7"
resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42"
integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==
dependencies:
inherits "^2.0.3"
minimalistic-assert "^1.0.1"
@ -2825,9 +2826,9 @@ log-driver@^1.2.7:
integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==
lru-cache@^4.0.1:
version "4.1.3"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c"
integrity sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==
version "4.1.5"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd"
integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==
dependencies:
pseudomap "^1.0.2"
yallist "^2.1.2"
@ -3483,9 +3484,9 @@ package-hash@^2.0.0:
release-zalgo "^1.0.0"
pako@~1.0.5:
version "1.0.6"
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258"
integrity sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==
version "1.0.7"
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.7.tgz#2473439021b57f1516c82f58be7275ad8ef1bb27"
integrity sha512-3HNK5tW4x8o5mO8RuHZp3Ydw9icZXx0RANAOMzlMzx7LVXhMJ4mo3MOBpzyd7r/+RUu8BmndP47LXT+vzjtWcQ==
parents@^1.0.0, parents@^1.0.1:
version "1.0.1"
@ -3539,6 +3540,11 @@ parse-json@^4.0.0:
error-ex "^1.3.1"
json-parse-better-errors "^1.0.1"
parse-node-version@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/parse-node-version/-/parse-node-version-1.0.0.tgz#33d9aa8920dcc3c0d33658ec18ce237009a56d53"
integrity sha512-02GTVHD1u0nWc20n2G7WX/PgdhNFG04j5fi1OkaJzPWLTcf6vh6229Lta1wTmXG/7Dg42tCssgkccVt7qvd8Kg==
parse-passwd@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6"
@ -4083,7 +4089,7 @@ semver-greatest-satisfied-range@^1.1.0:
dependencies:
sver-compat "^1.5.0"
"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0, semver@^5.5.0:
"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.5.0, semver@^5.6.0:
version "5.6.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==
@ -4404,7 +4410,14 @@ string-width@^1.0.1, string-width@^1.0.2:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^4.0.0"
string_decoder@^1.1.1, string_decoder@~1.1.1:
string_decoder@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.2.0.tgz#fe86e738b19544afe70469243b2a1ee9240eae8d"
integrity sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==
dependencies:
safe-buffer "~5.1.0"
string_decoder@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
@ -4699,14 +4712,14 @@ tsconfig@^5.0.3:
strip-json-comments "^2.0.0"
tsify@^4, tsify@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/tsify/-/tsify-4.0.0.tgz#61f7e43cd1f1a6c79cae14428ec13d0cd283ccf8"
integrity sha512-A33g5azPh2KDo/gbcSHpSo2m8l5FYC3SdjD5qNpBT+LP758HIGXT6cLko+aJhyFDRU5nCT/zQvfIq/5GQNRsoA==
version "4.0.1"
resolved "https://registry.yarnpkg.com/tsify/-/tsify-4.0.1.tgz#b19b0ddf7f184368dbf65839293d2c5a6d48453d"
integrity sha512-ClznEI+pmwY5wmD0J7HCSVERwkD+l71ch3Dqyod2JuQLEsFaiNDI+vPjaGadsuVFVvmzgoI7HghrBtWsSmCDHQ==
dependencies:
convert-source-map "^1.1.0"
fs.realpath "^1.0.0"
object-assign "^4.1.0"
semver "^5.1.0"
semver "^5.6.0"
through2 "^2.0.0"
tsconfig "^5.0.3"
@ -4733,9 +4746,9 @@ typedarray@^0.0.6:
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typescript@^3:
version "3.1.6"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.6.tgz#b6543a83cfc8c2befb3f4c8fba6896f5b0c9be68"
integrity sha512-tDMYfVtvpb96msS1lDX9MEdHrW4yOuZ4Kdc4Him9oU796XldPYF/t2+uKoX0BBa0hXXwDlqYQbXY5Rzjzc5hBA==
version "3.2.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.1.tgz#0b7a04b8cf3868188de914d9568bd030f0c56192"
integrity sha512-jw7P2z/h6aPT4AENXDGjcfHTu5CSqzsbZc6YlUIebTyBAq8XaKp78x7VcSh30xwSCcsu5irZkYZUSFP1MrAMbg==
uglify-js@^3, uglify-js@^3.0.5, uglify-js@^3.1.4:
version "3.4.9"
@ -5076,9 +5089,9 @@ yallist@^2.1.2:
integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=
yallist@^3.0.0, yallist@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9"
integrity sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=
version "3.0.3"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9"
integrity sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==
yapool@^1.0.0:
version "1.0.0"