Merge pull request #7380 from fgehring/patch-1

Allow more promotion move inputs (#7326)
pool-hotfix
Thibault Duplessis 2020-10-03 07:40:29 +02:00 committed by GitHub
commit 4eb5873936
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -6,7 +6,7 @@ const keyRegex = /^[a-h][1-8]$/;
const fileRegex = /^[a-h]$/;
const crazyhouseRegex = /^\w?@[a-h][1-8]$/;
const ambiguousPromotionCaptureRegex = /^([a-h]x?)?[a-h](1|8)$/;
const promotionRegex = /^([a-h]x?)?[a-h](1|8)=?[nbrq]$/;
const promotionRegex = /^([a-h]x?)?[a-h](1|8)=?[nbrqNBRQ]$/;
interface Opts {
input: HTMLInputElement;
@ -128,7 +128,8 @@ function sanToUci(san: string, legalSans: SanToUci): Uci | undefined {
}
function sanCandidates(san: string, legalSans: SanToUci): San[] {
const lowered = san.toLowerCase();
// replace '=' in promotion moves (#7326)
const lowered = san.replace('=', '').toLowerCase();
return Object.keys(legalSans).filter(function(s) {
return s.toLowerCase().startsWith(lowered);
});