Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Plan Your Heist");
            Console.WriteLine("Enter the Bank Difficulty Level");
            var BankDifficultyLevel = int.Parse(Console.ReadLine());


            var ATeam  = new List <TeamMember>();
            var IsDone = false;

            while (!IsDone)
            {
                Console.WriteLine("What is Your Team Member's Name");
                var MemberName = Console.ReadLine();

                Console.WriteLine("What is Your Team Member's Skill Level");
                var SkillLevel = Console.ReadLine();

                string CourageFactor;
                bool   IsCourageFactorOutOfRange;
                do
                {
                    Console.WriteLine("What is Your Team Member's Courage Factor (Please enter an decimal between 0.0 and 2.0)");
                    CourageFactor             = Console.ReadLine();
                    IsCourageFactorOutOfRange = decimal.Parse(CourageFactor) < 0.0m || decimal.Parse(CourageFactor) > 2.0m;
                }while (IsCourageFactorOutOfRange);
                var TeamMember = new TeamMember(MemberName, SkillLevel, CourageFactor);
                ATeam.Add(TeamMember);

                Console.WriteLine("Would you like to add another team member? Y/N");
                var answer = (Console.ReadLine());

                if (answer.ToLower() == "n")
                {
                    IsDone = true;
                }
            }
            Console.WriteLine("Hey yo bitch, how many time you wanna do dis thang?");
            var YoBitch = Console.ReadLine();

            var SuccessfulRun = 0;
            var FailedRun     = 0;

            for (int i = 0; i < int.Parse(YoBitch); i++)
            {
                Random random    = new Random();
                var    luckValue = random.Next(-10, 11);

                var NewBankDifficultyLevel = BankDifficultyLevel + luckValue;
                int TotalSkillLevel        = 0;
                foreach (var teamMember in ATeam)
                {
                    TotalSkillLevel += int.Parse(teamMember.SkillLevel);
                }

                Console.WriteLine($"Your Team's combined skill level is {TotalSkillLevel} and the difficulty level is {NewBankDifficultyLevel}");

                if (NewBankDifficultyLevel <= TotalSkillLevel)
                {
                    SuccessfulRun += 1;
                }
                else
                {
                    FailedRun += 1;
                }
            }

            Console.WriteLine(@$ "You successfully passed {SuccessfulRun} times.
And you just plain sucked {FailedRun} times.");

            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Plan Your Heist");
            Console.WriteLine("---------------");

            TheTeam HeistCrew  = new TheTeam();
            bool    stayInLoop = true;
            string  memberName;

            int NumberOfFailures  = 0;
            int NumberOfSuccesses = 0;

            //Default bank difficulty
            int bankDifficulty = 100;

            //Bank Difficulty Levels

            //Choosing Bank Difficulty Level
            Console.WriteLine("Please choose the difficulty of bank's security:");
            Console.WriteLine(@"
                1. Can I play, Daddy?
                2. Don't hurt me
                3. Bring 'em on!
                4. I am Death incarnate!");

            Console.Write(">");
            int Choice = Int32.Parse(Console.ReadLine());

            switch (Choice)
            {
            case 1:
                bankDifficulty = 10;
                break;

            case 2:
                bankDifficulty = 50;
                break;

            case 3:
                bankDifficulty = 90;
                break;

            case 4:
                bankDifficulty = 101;
                break;
            }

            while (stayInLoop == true)
            {
                Console.WriteLine("To add a member to the team enter a name below.");
                Console.Write(">");
                memberName = Console.ReadLine();
                if (memberName != "")
                {
                    TeamMember recruit = new TeamMember(memberName);
                    Console.WriteLine("Great! now what is his skill level? (must be a number greater than 1");
                    Console.Write(">");
                    string memberSkillLevel = Console.ReadLine();
                    recruit.SkillLevel = int.Parse(memberSkillLevel);
                    Console.WriteLine("Wowweee! Look at thsoe skills! but are the courageous?");
                    Console.WriteLine("On a scale of 0.0 to 2.0....how courageous would you say they are?");
                    string courage = Console.ReadLine();
                    recruit.Courage = decimal.Parse(courage);
                    Console.WriteLine("We'll see if they are truly that courageous once bullets start flying.");
                    Console.WriteLine(".");
                    Console.WriteLine(".");
                    Console.WriteLine(".");
                    //adding the recruit to the team
                    HeistCrew.addTeamMate(recruit);
                    HeistCrew.TeamSkillTotal += recruit.SkillLevel;
                }
                else
                {
                    stayInLoop = false;
                }
            }

            Console.WriteLine("So this is what we got.");
            int numberOfMembers = HeistCrew.TeamMates.Count;

            Console.WriteLine($"You have {numberOfMembers} crew members:");
            //run  multiple times
            Console.WriteLine("Enter the number of times you would like to run this senario below.");
            Console.Write(">");
            string TrialsInput    = Console.ReadLine();
            int    NumberOfTrials = Int32.Parse(TrialsInput);

            //for loop for # of Senarios
            for (int i = 0; i < NumberOfTrials; i++)
            {
                //bank info

                Random Luck      = new Random();
                int    HeistLuck = Luck.Next(-10, 10);
                int    bankDifficultyWithLuck = bankDifficulty + HeistLuck;

                if (HeistCrew.TeamSkillTotal < bankDifficultyWithLuck)
                {
                    Console.WriteLine($@"
                    Bank difficulty: {bankDifficultyWithLuck}
                    Crew's Skill: {HeistCrew.TeamSkillTotal}");
                    Console.WriteLine("Looks like you'll be spending some time in the slammer. Better look for a day job when you get out cause you're not cut out for this.");
                    NumberOfFailures += 1;
                }
                else
                {
                    Console.WriteLine($@"
                    Bank difficulty: {bankDifficultyWithLuck}
                    Crew's Skill: {HeistCrew.TeamSkillTotal}
                    ");
                    Console.WriteLine("You and your crew made out with some goodies, but time to plan the next job!");
                    NumberOfSuccesses += 1;
                }
            }
            Console.WriteLine($@"
                After running {NumberOfTrials} trials in the simulator we have the following results:

                {NumberOfSuccesses} successes
                {NumberOfFailures} failures

                ");
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Plan Your Heist!");
            string name = null;
            //creating an empty list

            List <TeamMember> teammates = new List <TeamMember>();

            // while loop runs through the team members
            while (name != "")
            {
                Console.WriteLine("Add your new team members name, or press enter to close and see your team: ");
                //breaks code if user does not enter a name
                name = Console.ReadLine();
                if (name == "")
                {
                    break;
                }
                Console.WriteLine("Enter skill level: ");
                int skillLevel = int.Parse(Console.ReadLine());
                Console.WriteLine("Enter courage factor, pick between 0.0 - 2.0 : ");
                decimal courageFactor = int.Parse(Console.ReadLine());
                //creating the team members
                TeamMember newTeammate = new TeamMember()
                {
                    _name          = name,
                    _skillLevel    = skillLevel,
                    _courageFactor = courageFactor
                };

                teammates.Add(newTeammate);

                // foreach (TeamMember teammate in teammates)
                // {
                //     Console.WriteLine($"Team member info: {teammate._name} has a skill level of {teammate._skillLevel} and a courage factor of {teammate._courageFactor}");
                // };
                // Console.WriteLine($"Number of Teammates: {teammates.Count}");
            }
            ;

            Console.WriteLine("Enter how many times you would like to try to rob the bank with your team: ");
            int heistAttempts = int.Parse(Console.ReadLine());

            for (int num = 0; num < heistAttempts; num++)
            {
                int difficultyLevel   = 100;
                int luckyNum          = new Random().Next(-10, 10);
                int luckAndDifficulty = luckyNum + difficultyLevel;

                int teamSkillLevel = teammates.Sum(teammate => teammate._skillLevel);
                if (teamSkillLevel >= luckAndDifficulty)
                {
                    Console.WriteLine("You win! You got all the monies!");
                }
                else
                {
                    Console.WriteLine("Sorry, you got busted. Try building a stronger team next time!");
                }

                Console.WriteLine($"Team Skill Level: {teamSkillLevel}");
                Console.WriteLine($"Bank Difficulty Level: {luckAndDifficulty}");
                Console.WriteLine($"Testing View Random Luck Level: {luckyNum}");
            }
        }
Ejemplo n.º 4
0
 public void addTeamMate(TeamMember member)
 {
     TeamMates.Add(member);
 }