// In order to shuffle the board, we are going to simulate // a certain number of clicks. This is to ensure that any // state the board gets into, it is certain that the board // can get back into a "winning" state. for (intI = 0 ; intI < 100 ; intI++){ // Select the piece that we want to "click". // We will do this by randomly selecting a row // and a column to click. jPiece = arr2DBoard[ (Math.floor( Math.random() * intRows * intRows ) % intRows) ][ (Math.floor( Math.random() * intColumns * intColumns ) % intColumns) ]; // Simulate the click. jPiece.click(); }