diff --git a/shatrizualizer.html b/shatrizualizer.html index 09c461c..a15f829 100644 --- a/shatrizualizer.html +++ b/shatrizualizer.html @@ -306,6 +306,12 @@ renderedPromotion = whiteMove ? whitePieces[promotion] : blackPieces[promotion]; } + // Are we moving the piece onto itself? + if (startLetter === endLetter && startNumber === endNumber) { + alert('Start and end squares of the move cannot be identical'); + return; + } + // Are we moving the piece from where it is located? let startSquare = document.getElementById(startLetter + startNumber); if (startSquare.childNodes.length === 0) {