예제 #1
0
        static void Main(string[] args)
        {
            /*
             * for (int i = 0; i < 10; i++)
             * {
             *  Console.Clear();
             *  ShowRandom();
             *  Console.ReadLine();
             *  Show();
             *  Console.ReadLine();
             * }
             */
            ShowRandom();

            for (int j = 0; j < 10; j++)
            {
                Console.WriteLine("Choose line to change (max = " + lines_body.Count + ")");
                int index = int.Parse(Console.ReadLine()) - 1;
                Console.WriteLine("Choose left ends (dot / arrow / rhomb)");
                string left = Console.ReadLine();

                if (left == "")
                {
                    left = "dot";
                }

                Console.WriteLine("Choose right ends (dot / arrow / rhomb)");
                string right = Console.ReadLine();

                if (right == "")
                {
                    right = "dot";
                }

                if (index < lines_body.Count && index >= 0 && (left == "dot" || left == "arrow" || left == "rhomb") && (right == "dot" || right == "arrow" || right == "rhomb"))
                {
                    EndOfLines leftE = null, rightE = null;

                    switch (left)
                    {
                    case "dot":
                        leftE = new Dot();
                        break;

                    case "arrow":
                        leftE = new Arrow();
                        break;

                    case "rhomb":
                        leftE = new Rhomb();
                        break;

                    default:
                        break;
                    }

                    switch (right)
                    {
                    case "dot":
                        rightE = new Dot();
                        break;

                    case "arrow":
                        rightE = new Arrow();
                        break;

                    case "rhomb":
                        rightE = new Rhomb();
                        break;

                    default:
                        break;
                    }

                    lines_body[index].changeLeft(leftE);
                    lines_body[index].changeRight(rightE);
                }
                else
                {
                    Console.WriteLine("No, sorry");
                }
            }
        }