3 ms·
Well yeah: // then scramble var r1, r2; for( i = 0; i < numpieces>>1; i++ ) { exchange( Math.random() * numpieces >> 0, Math.random() * numpieces >> 0 )
by pharrington 15y ago
Well yeah:
// then scramble
var r1, r2;
for( i = 0; i < numpieces>>1; i++ )
{
exchange( Math.random() * numpieces >> 0, Math.random() * numpieces >> 0 );
}
Easily enough fixed by just "manually" sliding a random piece adjacent to the hole a couple thousand or so times, but yeah... Making any sort of game, no matter how simple, is harder than you think :\