Example #1
0
        public static void Main()
        {
            int day_of_competition = 1;

            Console.WriteLine("Welcome to the Travis County Fishing Competition! You have 31 days to catch a \n" +
                              "150 lbs Carp.");
            Console.ReadLine();
            Console.WriteLine("Upgrading your rod will allow you to hold on to bigger catches, while upgrading your bait will " +
                              "allow you to catch bigger and better fish.");
            Console.ReadLine();
            Console.WriteLine("At the end of each day, you can sell your catches to earn more money. \n" +
                              "To begin press Enter");
            Console.ReadLine();


            bool loop = true;

            while (loop == true)
            {
                //Opening text each turn
                Console.WriteLine("\n\n\n\n\nWelcome to day {0} of the Travis County Fishing Competition!\n",
                                  day_of_competition);

                //Choose a Rod
                current_rod = inv.DisplayRods();

                //Choose a Bait
                current_bait = inv.DisplayBait();

                //Begin the day's fishing and return the day's catches
                inv.catch_of_the_day = pond.Cast(current_rod, current_bait);

                //Display the day's catches and sell them
                inv.sell_fish();

                Console.WriteLine("\nPress Enter to continue...");
                Console.ReadLine();

                //Check for win
                if (inv.goal_reached == true)
                {
                    Console.WriteLine("You win! You caught a 150 lbs carp in " + day_of_competition + " days!" +
                                      "\n\nPlease press Enter to exit");
                    Console.ReadLine();
                    break;
                }

                //Ending Sequence
                if (day_of_competition >= 31)
                {
                    Console.WriteLine("Sometimes the fish just aren't biting...Maybe next month!\n\nPlease press Enter to exit");
                    Console.ReadLine();
                    loop = false;
                }
                else
                {
                    day_of_competition++;
                }
            }
        }
Example #2
0
        //Determines what the player catches based on what the current rod and bait is this round
        public List <Fish> Cast(FishingRod current_rod, Bait current_bait)
        {
            caughtfish.Clear();
            string caught = "";
            double weight = 0;

            for (byte i = 1; i <= 20; i++)
            {
                int randomcatch = RandomInt.Next(1, 20 + 1);        //Check if player catches a fish at all
                if (randomcatch + current_bait.catch_chance_increase >= 20)
                {
                    int whichfish = RandomInt.Next(current_bait.min_roll, current_bait.max_roll + 1);  //Determines the kind of fish caught
                    foreach (Fish fish in pondfish)
                    {
                        if (whichfish >= fish.min_catch_roll)
                        {
                            if (whichfish <= fish.max_catch_roll)
                            {
                                Fish landedfish = new Fish(fish.name, fish.min_catch_roll,
                                                           fish.max_catch_roll, fish.min_weight,
                                                           fish.max_weight, fish.price_per_pound);
                                landedfish.weight = landedfish.min_weight + RandomDouble.NextDouble() *
                                                    (landedfish.max_weight - landedfish.min_weight);
                                if (landedfish.weight >= current_rod.max_poundage)
                                {
                                    caught = "Your rod is too small, the line broke!";
                                    weight = 0;
                                }
                                else
                                {
                                    caughtfish.Add(landedfish);
                                    caught = landedfish.name;
                                    weight = landedfish.weight;
                                }
                            }
                        }
                    }
                }
                else
                {
                    caught = "No Bite";
                    weight = 0;
                }

                string printout = ("Chance " + i + "..." + caught);
                Thread.Sleep(120);
                if (weight != 0)
                {
                    printout += (", " + Math.Round(weight, 2) + " lbs");
                }
                Console.WriteLine(printout);
            }
            return(caughtfish);
        }
Example #3
0
        public Bait DisplayBait()
        {
            bool loop = true;

            while (loop == true)
            {
                byte counter = 1;
                Console.WriteLine("\n\n   " + "Bait" + "\t\t\t" + " Cost\n");
                foreach (Bait bait in current_bait)
                {
                    StringBuilder amount_of_space = new StringBuilder(" ");
                    amount_of_space.Length = (20 - bait.name.Length) + 4;
                    Console.WriteLine(counter + " " + bait.name + amount_of_space + "$" + bait.cost);
                    counter++;
                }
                Console.WriteLine("\n" + "Choose Today's Bait:" + "\t\t     Wallet: $" + Math.Round(wallet, 2));

                string   baitchoice      = Console.ReadLine();
                string[] possiblechoices = { "1", "2", "3", "4", "5" };

                foreach (string choice in possiblechoices)
                {
                    if (baitchoice == choice)
                    {
                        Byte bytechoice = Convert.ToByte(choice);
                        foreach (Bait bait in current_bait)
                        {
                            bait.current = false;
                        }
                        Bait chosenbait = current_bait[bytechoice - 1];

                        if (chosenbait.cost <= wallet)
                        {
                            chosenbait.current = true;
                            wallet            -= chosenbait.cost;
                            return(chosenbait); // Return the chosen bait
                        }
                    }
                }
            }
            return(current_bait[0]);
        }
        //Determines what the player catches based on what the current rod and bait is this round
        public List<Fish> Cast(FishingRod current_rod, Bait current_bait)
        {
            caughtfish.Clear();
            string caught = "";
            double weight = 0;
            for (byte i = 1; i <= 20; i++)
            {
                int randomcatch = RandomInt.Next(1, 20 + 1);        //Check if player catches a fish at all
                if (randomcatch + current_bait.catch_chance_increase >= 20)
                {
                    int whichfish = RandomInt.Next(current_bait.min_roll, current_bait.max_roll + 1);  //Determines the kind of fish caught
                    foreach (Fish fish in pondfish)
                    {
                        if (whichfish >= fish.min_catch_roll)
                        {
                            if (whichfish <= fish.max_catch_roll)
                            {
                                Fish landedfish = new Fish(fish.name, fish.min_catch_roll,
                                                           fish.max_catch_roll, fish.min_weight,
                                                           fish.max_weight, fish.price_per_pound);
                                landedfish.weight = landedfish.min_weight + RandomDouble.NextDouble() *
                                                   (landedfish.max_weight - landedfish.min_weight);
                                if (landedfish.weight >= current_rod.max_poundage)
                                {
                                    caught = "Your rod is too small, the line broke!";
                                    weight = 0;
                                }
                                else
                                {
                                    caughtfish.Add(landedfish);
                                    caught = landedfish.name;
                                    weight = landedfish.weight;
                                }
                            }
                        }
                    }

                }
                else
                {
                    caught = "No Bite";
                    weight = 0;

                }

                string printout = ("Chance " + i + "..." + caught);
                Thread.Sleep(120);
                if (weight != 0)
                    printout += (", " + Math.Round(weight, 2) + " lbs");
                Console.WriteLine(printout);

            }
            return caughtfish;
        }
        public static void Main()
        {
            int day_of_competition = 1;

            Console.WriteLine("Welcome to the Travis County Fishing Competition! You have 31 days to catch a \n" +
                              "150 lbs Carp.");
            Console.ReadLine();
            Console.WriteLine("Upgrading your rod will allow you to hold on to bigger catches, while upgrading your bait will " +
                              "allow you to catch bigger and better fish.");
            Console.ReadLine();
            Console.WriteLine("At the end of each day, you can sell your catches to earn more money. \n" +
                              "To begin press Enter");
            Console.ReadLine();

            bool loop = true;
            while (loop == true)
            {
                //Opening text each turn
                Console.WriteLine("\n\n\n\n\nWelcome to day {0} of the Travis County Fishing Competition!\n",
                                    day_of_competition);

                //Choose a Rod
                current_rod = inv.DisplayRods();

                //Choose a Bait
                current_bait = inv.DisplayBait();

                //Begin the day's fishing and return the day's catches
                inv.catch_of_the_day = pond.Cast(current_rod, current_bait);

                //Display the day's catches and sell them
                inv.sell_fish();

                Console.WriteLine("\nPress Enter to continue...");
                Console.ReadLine();

                //Check for win
                if (inv.goal_reached == true)
                {
                    Console.WriteLine("You win! You caught a 150 lbs carp in " + day_of_competition + " days!" +
                                      "\n\nPlease press Enter to exit");
                    Console.ReadLine();
                    break;
                }

                //Ending Sequence
                if (day_of_competition >= 31)
                {
                    Console.WriteLine("Sometimes the fish just aren't biting...Maybe next month!\n\nPlease press Enter to exit");
                    Console.ReadLine();
                    loop = false;
                }
                else
                    day_of_competition ++;
            }
        }