Attempting all possible pairs on a grid and keep a record for improvements to sides matches
<p>Please go easy if I fail to explain anything.</p>

<p>Basically I wish to find out how I can keep a record of swapping all points in a tetravex grid. [ref: http://gamegix.com/tetravex/game].</p>

<p>I've created the grid and added the tiles from a random solution. I can currently swap ONE pair of USER-generated tiles but cannot do this as an automatic process.</p>

<p>How would one generally automate the process of swapping items automatically? AND keep a record of the "good" swaps</p>

<p>The swap method accepts the following parameters:</p>

<pre><code>ems.swap(i1, j1, i2, j2);
</code></pre>

<p>Where <code>i1,j1</code> is the first tile which you want to swap and <code>i2,j2</code> is the second  tile you want to swap.</p>

<p>Once this is done, the tiles are assessed,</p>

<pre><code> public static int AssessSwapTiles(EdgeMatchSolution ems, EdgeMatch em)
{
    int a = em.getRows();
    int b = em.getColumns();
    int swaptotal = 0;

    for (int i = 0; i &lt; a; i++)
    {
        for (int j = 0; j &lt; b; j++)
        {
            int numSides = ems.sidesMatched(i,j);
            System.out.print(numSides + " ");
            swaptotal += numSides;
        }
        System.out.println();
    }
    System.out.println(swaptotal);
    return swaptotal;
}
</code></pre>

<p>This method is called once before the swap and again AFTER the swap.</p>

<p>Apologies for a long explanation, it was only for those who would stumble upon on this in the future.</p>
