OK, here's my situation...
I would like to use a multi-dimensional array to store map info for a game I'm writing. I have used multi-dim arrays before but this one would require 144 'slots' for a 10X10 hex map (including borders). I'd use the array to store info on whatever is in the hex... images, characters, etc. and use it for basic AI and calculating where things get dropped and range for attacks.
Here's my problem. I'm trying to place some logic inside of of two nested for() statements to loop through the X and Y coords of the map and insert relevant info into the array, but it keeps hogging the CPU and timing out the script (120 sec should be more than enough).
The Question... Can someone toss up a simple code sample to create a two-dimensional array using nested
for($x=0; $x<=11;$x++) {
for($y=0; $y<=11;$y++){
...logic to create $y in $map[$x][$y]...
}
...Add $y to the appropriate $x in $map[$x][$y]...
}
statements? Or at least clue me in as to what I screwed up in this short code?