Beispiel #1
0
    public void TraverseVillages(Village CurrentVillage)
    {
        if (Hugi.FoundAstrilde)
        {
            return;
        }

        // Here Hugi records his travels, as any Norse Hero will do:
        Hugi.HugiJournal.Add(new JournalEntry(CurrentVillage.VillageName, CurrentVillage.distanceFromPreviousVillage));

        Console.WriteLine("I am in {0}", CurrentVillage.VillageName);

        if (CurrentVillage.isAstrildgeHere)
        {
            Console.WriteLine("I found Dear Astrildge in {0}", CurrentVillage.VillageName);
            Console.WriteLine("**** FEELING HAPPY!!! ******");
            Console.WriteLine("Astrilde, I walked {0} vika to find you. Will you marry me?", Hugi.CalculateDistanceWalked());
            Hugi.FoundAstrilde = true;
        }

        // TO DO: Complete this section to make the Recursion work
        else
        {
            Console.WriteLine("I didn't find astrildge in {0}", CurrentVillage.VillageName);
            Console.WriteLine("I've walked {0}", Hugi.CalculateDistanceWalked());
            Hugi.FoundAstrilde = false;
        }
    }
Beispiel #2
0
    public void TraverseVillages(Village CurrentVillage)
    {
        if (Hugi.FoundAstrilde)
        {
            return;
        }


        Hugi.HugiJournal.Add(new JournalEntry(CurrentVillage.VillageName, CurrentVillage.distanceFromPreviousVillage));
        try
        {
            Console.WriteLine("I am in {0}", CurrentVillage.VillageName);

            if (CurrentVillage.isAstrildgeHere)
            {
                Console.WriteLine("I found Dear Astrildge in {0}", CurrentVillage.VillageName);
                Console.WriteLine("**** FEELING HAPPY!!! ******");
                Console.WriteLine("Astrilde, I walked {0} vika to find you. Will you marry me?", Hugi.CalculateDistanceWalked());
                Hugi.FoundAstrilde = true;
            }

            TraverseVillages(CurrentVillage.west);
            TraverseVillages(CurrentVillage.east);
        }
        catch (NullReferenceException) { }
    }
    public void TraverseVillages(Village CurrentVillage)
    {
        try{
            if (Hugi.FoundAstrilde)
            {
                return;
            }

            // Here Hugi records his travels, as any Norse Hero will do:
            // TO DO : How does Hugi journal his visit to each village?
            Hugi.HugiJournal.Add(new JournalEntry(CurrentVillage.VillageName, CurrentVillage.distanceFromPreviousVillage));

            Console.WriteLine("I am in {0}", CurrentVillage.VillageName);



            if (CurrentVillage.isAstrildgeHere)
            {
                Console.WriteLine("I found Dear Astrildge in {0}", CurrentVillage.VillageName);
                Console.WriteLine("**** FEELING HAPPY!!! ******");
                Console.WriteLine("Astrilde, I walked {0} vika to find you. Will you marry me?", Hugi.CalculateDistanceWalked());
                Hugi.FoundAstrilde = true;
            }

            // TO DO: Complete this section to make the Recursion work
            TraverseVillages(CurrentVillage.west);
            TraverseVillages(CurrentVillage.east);
        }
        catch (NullReferenceException)
        {
        }
    }
Beispiel #4
0
    public void TraverseVillages(Village CurrentVillage)
    {
        if (Hugi.FoundAstrilde)
        {
            return;
        }
        // Here Hugi records his travels, as any Norse Hero will do:

        Hugi.HugiJournal.Add(new JournalEntry(CurrentVillage.VillageName, CurrentVillage.distanceFromPreviousVillage));
        Console.WriteLine("I am in {0}", CurrentVillage.VillageName);

        try
        {
            if (CurrentVillage.isAstrildgeHere)
            {
                Console.WriteLine("I found Dear Astrildge in {0}", CurrentVillage.VillageName);
                Console.WriteLine("**** FEELING HAPPY!!! ******");
                Console.WriteLine("Astrilde, I walked {0} vika to find you. Will you marry me?", Hugi.CalculateDistanceWalked());
                Console.WriteLine("Press Enter key to continue");
                Console.ReadLine();
                Hugi.FoundAstrilde = true;
            }
            TraverseVillages(CurrentVillage.west);
            TraverseVillages(CurrentVillage.east);
        }
        catch (Exception nre)
        {
        }
    }
    public void TraverseVillages(Village CurrentVillage)
    {
        if (Hugi.FoundAstrilde)
        {
            return;
        }

        // Here Hugi records his travels, as any Norse Hero will do:
        // TO DO : How does Hugi journal his visit to each village?

        Console.WriteLine("I am in {0}", CurrentVillage.VillageName);

        if (CurrentVillage.isAstrildgeHere)
        {
            Console.WriteLine("I found Dear Astrildge in {0}", CurrentVillage.VillageName);
            Console.WriteLine("**** FEELING HAPPY!!! ******");
            Console.WriteLine("Astrilde, I walked {0} vika to find you. Will you marry me?", Hugi.CalculateDistanceWalked());
            Hugi.FoundAstrilde = true;
        }

        // TO DO: Complete this section to make the Recursion work
    }