Advertisement
Guest User

Sudoku.php

a guest
Feb 4th, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5. <title> Sudoku </title>
  6. <link type="text/css" rel="stylesheet" href="sudoku.css">
  7. </head>
  8.  
  9. <body>
  10.  
  11. <h2 id = "title" class="center"> Sudoku </h2>
  12.  
  13. <table>
  14.  
  15. <?php
  16.  
  17. $cells = array_fill(0, 9, array_fill(0, 9, 9));
  18.  
  19. for($i=0; $i<9; $i++){
  20. for($k=0; $k<9; $k++) {
  21. $cells[$i][$k] = 'c' . "$i" . "$k";
  22. }
  23. } // fill $cells with XY coordinates of each cell
  24.  
  25. for($i=0;$i<9;$i++){
  26. echo "<tr>";
  27. for($k=0;$k<9;$k++){
  28. echo '<td><div class = "cell" id="' . $cells[$i][$k] . '">' . '</div>';
  29. }
  30. } // creates the grid, each cell containing a <div> with an ID
  31.  
  32. ?>
  33.  
  34. </table>
  35. <script src = "sudoku.js"> </script>
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement