function moveRight() {
        undraw();
        const isAtRightEdge = current.some(index => (currentPosition + index) % width === width - 1);
        if (!isAtRightEdge)
            currentPosition += 1;
        if (current.some(index => allSquares[currentPosition + index].classList.contains('block2'))) {
            currentPosition -= 1;
        }
        draw();
    }
//move left and prevent collisions with shapes moving left
move left and prevent collisions with shapes moving left
move left and prevent collisions with shapes moving left
function moveRight() {
        undraw();
        const isAtRightEdge = current.some(index => (currentPosition + index) % width === width - 1);
        if (!isAtRightEdge)
            currentPosition += 1;
        if (current.some(index => allSquares[currentPosition + index].classList.contains('block2'))) {
            currentPosition -= 1;
        }
        draw();
    }
function moveRight ( ) { undraw ( ) ; const isAtRightEdge = current . some ( index => ( currentPosition + index ) % width === width - 1 ) ; if ( ! isAtRightEdge ) currentPosition += 1 ; if ( current . some ( index => allSquares [ currentPosition + index ] . classList . contains ( 'block2' ) ) ) { currentPosition -= 1 ; } draw ( ) ; }
move left and prevent collisions with shapes moving left
move left and prevent collisions with shapes moving left