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