I have this array, which I show in a table, how I can use user input to move the currently 0 assigned to each array, but I plan to assign other values to the array:
my question is: how can I move up, down, right, left and move diagonally inside the array using user input
Array ( [0] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 ) [1] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 ) [2] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 ) [3] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 ) [4] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 ) [5] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 ) [6] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 ) [7] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 ) ); array(0,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0), array(0,0,0,0,0,0,0,0),
This is for playing checkers without mysql.
I can already serialize the array to a text file, but the text files should contain the starting position, and when each player makes a move, put the location where the element moves to the text file, then call back to the display
and I already mapped the array to the html table
I also try to restrict movement to an illegal area, but what is a logical problem, I need to work for myself
this loop will work with the code below
$row = 0; print "<form>"; print "<table border = 1>"; while ($row < 8){ // Counts to 8. (from 0...7 = 8 times. 0 ... 8 = 9 times) print "<tr>"; $row++; $col = 0; // reset column to 0 each time printing one row. while ($col < 8){ print "<td>"; if($board[$row][$col] == 0) { print "<input type=\"checkbox\" name=\"box[]\" value=\"$value\">"; // Add \ before " otherwise it will treat as the end of the quote. } print "</td>"; $col++; } print "</tr>"; } print "</table>"; print "</form>";
I have already created a database for assessment, but this will be completed after that