Support promotions without the = as well
This commit is contained in:
parent
f8d47a3b73
commit
3c5c1ff1bc
|
@ -348,11 +348,11 @@
|
||||||
if (move.slice(index, index + 1) === '=') {
|
if (move.slice(index, index + 1) === '=') {
|
||||||
index++;
|
index++;
|
||||||
switch (move.slice(index, index + 1)) {
|
switch (move.slice(index, index + 1)) {
|
||||||
|
case 'K':
|
||||||
case 'Q':
|
case 'Q':
|
||||||
case 'B':
|
case 'B':
|
||||||
case 'N':
|
case 'N':
|
||||||
case 'R':
|
case 'R':
|
||||||
case 'K':
|
|
||||||
case 'P':
|
case 'P':
|
||||||
promotion = move.slice(index, index + 1);
|
promotion = move.slice(index, index + 1);
|
||||||
break;
|
break;
|
||||||
|
@ -360,6 +360,9 @@
|
||||||
return {error: 'Unrecognized piece: ' + move.slice(index, index + 1)};
|
return {error: 'Unrecognized piece: ' + move.slice(index, index + 1)};
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
|
} else if (['K', 'Q', 'B', 'N', 'R', 'P'].includes(move.slice(index, index + 1))) {
|
||||||
|
promotion = move.slice(index, index + 1);
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check(mate)
|
// Check(mate)
|
||||||
|
|
Loading…
Reference in New Issue