/// <summary>
        /// Returns false if the input was wrong.
        /// </summary>
        public static bool ProcessUserInput(IInputMethod inputMethod, out SolverInput solverInputModel)
        {
            solverInputModel = null;

            int maxIterationsCount = 0;
            int width  = 0;
            int height = 0;

            int[,] startState = null;
            int[,] finalState = null;

            try
            {
                Console.Write("Max iterations count: ");
                maxIterationsCount = Math.Abs(int.Parse(inputMethod.ReadLine()));

                Console.Write("Width: ");
                width = Math.Abs(int.Parse(inputMethod.ReadLine()));

                Console.Write("Height: ");
                height = Math.Abs(int.Parse(inputMethod.ReadLine()));

                startState = new int[height, width];
                finalState = new int[height, width];

                Console.WriteLine();
                Console.WriteLine("Max iterations count: {0}", maxIterationsCount);
                Console.WriteLine("Width: {0}", width);
                Console.WriteLine("Height: {0}", height);
                Console.WriteLine();

                Console.WriteLine("Insert the start state (line format - \"val1, val2, ...\" eg. 0, 1, 2):");
                Console.WriteLine("Value {0} is the empty space.", Solver.EMPTY_SPACE_REPRESENTATION);

                processGridInput(inputMethod, width, height, startState);

                Console.WriteLine();
                GridLogger.Log(width, height, startState.Convert2dArray2Sequence());

                Console.WriteLine("Insert the final state:");

                processGridInput(inputMethod, width, height, finalState);

                Console.WriteLine();
                GridLogger.Log(width, height, finalState.Convert2dArray2Sequence());
            }
            catch (Exception e)
            {
                Console.WriteLine(string.Format("Error: {0}", e.Message));
                return(false);
            }


            solverInputModel = new SolverInput(maxIterationsCount, width, height, startState, finalState);
            return(true);
        }
        private static void processGridInput(IInputMethod inputMethod, int width, int height, int[,] state)
        {
            for (int y = 0; y < height; y++)
            {
                Console.WriteLine("Line id {0}:", y);

                string line     = inputMethod.ReadLine();
                var    lineVals = Regex.Split(line, @",");

                if (lineVals.Length != width)
                {
                    throw new Exception("Wrong number of values.");
                }

                for (int x = 0; x < width; x++)
                {
                    state[y, x] = int.Parse(lineVals[x]);
                }
            }
        }