With PHP number nine Gongge.

Source: Internet
Author: User
As below, the effect:
2 3 4 5 6 7 8 9 1
3 4 5 6 7 8 9 1 2
4 5 6 7 8 9 1 2 3
5 6 7 8 9 1 2 3 4
6 7 8 9 1 2 3 4 5
7 8 9 1 2 3 4 5 6
8 9 1 2 3 4 5 6 7
9 1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9


Reply to discussion (solution)

$arr 1 = Array (' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ', ' 7 ', ' 8 ', ' 9 '); for ($i =0; $i
 
  
";}

$start = 1; $arr = Array (1, 2, 3, 4, 5, 6, 7, 8, 9); $length = count ($arr); for ($stepX =0; $stepX < $length; $stepX + +) {for ($ste Py=0, $stepY < $length, $stepY + +) {echo $arr [($stepX + $stepY + $start)% $length]. ' ';} Echo '
';}

To seek the rub points.

As below, the effect:
2 3 4 5 6 7 8 9 1
3 4 5 6 7 8 9 1 2
4 5 6 7 8 9 1 2 3
5 6 7 8 9 1 2 3 4
6 7 8 9 1 2 3 4 5
7 8 9 1 2 3 4 5 6
8 9 1 2 3 4 5 6 7
9 1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9

$arr 1 = Array (' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ', ' 7 ', ' 8 ', ' 9 '); for ($i =0; $i
 
  
";}


The last one was wrong, sorry.

 
  =10) {$tmp = $tmp%10+1;} printf ("%3d", $tmp), if (($i + 1)%9==0) {echo '
';}}? >

What are you doing here?
Nine Gongge is a 3x3 matrix (fill 1-9 number)
Sudoku is a combination of 9 nine Gongge

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.