Wednesday, April 28, 2021

Puzzling

 Been thinking it would be a waste to let that playable grid on match5

not be recycled into something more general Like making a puzzle with

a difficult image...


Now having the image appear. The actual grid is still in match3 mode🤨




*     *     *

There are know algorithms for shuffling members of an array:





The array in the code is version two of Fisher-Yates. The original version

dates from 1938 and was conceived not for computers. The more recent one

has linear time complexity: it is economical in time used. the video below

illustrates it.

With reference to the code: we are picking randomly form unchosen elements

from number in the series to 2 and swapping the picked one with the last one

of our current lot. It stops when the last remaining two have been swapped and

the new arrayis delivered...



No comments: