Let me guess the cards in your mind. First, we will randomly generate 27 cards. We cannot repeat three cards, remember one of them, and then click the column where the card is located, you can guess the cards you want multiple times. The specific implementation is as follows. Interested friends can refer to the following: Let me guess the cards in your mind. First, we will randomly generate 27 cards, you cannot repeat three cards, remember one of them, and click the column where the card is located to guess the card you want multiple times.
For 9 screenshots, you only need to guess twice. For 27 screenshots, you can guess three times.
Implementation Method (27 images ):
If you click the third column, that is to say, the cards must be in these nine sheets. Then, divide the nine cards in the third column into three cards in each column on average. Assume that the number is 123,456,789.
Click again. If you click the second column, the card you want to guess will be in column 456, which will be further divided into three columns: 4, 5, and 6.
Click it again to know which card it is.
Implementation Algorithm:
I use a one-dimensional array. The first time I guess the third column, I will replace the data of the third column with values 0, 1, 2, 3, 4, 5, 6, 7, and 8,
Then the number of guesses is in the first nine, and the second column replaces the three values in the column 0, 1, and 2, so the first three values are in the second column.
The output follows three columns, but the problem is that the cards will not be messy and others will know why You guessed it.
Therefore, output must be output in disorder. Only output can be in ascending or descending order.
Var random = new Array (5); // custom Two-Dimensional Disordered table
Random [0] = [5, 2, 8, 7, 1, 3, 4, 6, 0];
Random [1] = [2, 5, 8, 0, 4, 6, 3, 7, 1];
Random [2] = [6, 7, 2, 8, 0, 1, 5, 3, 4];
Random [3] = [2, 1, 6, 3, 5, 4, 7, 0, 8];
Random [4] = [0, 1, 2, 3, 4, 5, 6, 7, 8];
For more information, see www.shengshiyouxi.com.
The Code is as follows:
<! DOCTYPE html>
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>