public Square getSquare(int x, int y) throws IndexOutOfBoundsException
    {
        if ( (x < 0) || (y < 0) || (x >= gridSize) || (y >= gridSize))
            throw new IndexOutOfBoundsException("Square coordinates must be inside grid. X: "+x+", Y: "+y);
        return squares[x][y];
    }