Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I made a game board 10 x 10 with interacting color elimination.</p> <p>I use an array to first define the grid. Below creates an array with 100 object slots.</p> <p>SAMPLE: Game at <a href="http://apps.facebook.com/AnotherGrid/" rel="nofollow">http://apps.facebook.com/AnotherGrid/</a> Just login to play and see the grid in action. This array generates 1000 grids for my game dynamicly.</p> <pre><code>&lt;?php $lvl = array( /* row0 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row1 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row2 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row3 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row4 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row5 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row6 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row7 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row8 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row9 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ); ?&gt; </code></pre> <p>then i used:</p> <pre><code>foreach ($lvl as $key =&gt; $value) { echo '&lt;div class="grid" id="'.$key.'"onclick="null"&gt;'.$value.'&lt;/div&gt;'; } </code></pre> <p>to write the grid, and used CSS to define display: inline-block to each div.</p> <p>For positioning of each is based on the position of the array object. &lt; div id="0" > would be the very first square upto 99.</p> <pre><code>&lt;?php $lvl = array( /* row0 */'black', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row1 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row2 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row3 */' ', ' ', ' ', ' ', 'yellow', ' ', ' ', ' ', ' ', ' ', /* row4 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row5 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row6 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row7 */' ', ' ', ' ', 'blue', ' ', ' ', ' ', 'green', ' ', ' ', /* row8 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* row9 */' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ); ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload