♫♪Oops! I did it again!♪♫ I missed a week without blogging!!! WHAT IS WRONG WITH ME?!?!?! I know what’s wrong: I’m BUSY! Very busy. But I REALLY WANTED to blog last week…
O.k let’s begin! First of all: Good news! I’ve completed a whole notebook for this class and now I’m on the second one. Yeah, it’s full of my Pseudo code and my code for all the labs. However I didn’t get a new one ’cause I didn’t feel like buying a notebook so now I’m using my old Physics lab notebook to take my trusty Comp notes! It’s fun because I’m taking mah favorite class while when I flip through the pages I see things that remind me other fun times~♪.
And now: Sad news……………. 😥 I was NOT able to finish lab 5!!!!!!!! The horror! The trauma! The drama!!!!!!! NOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!! HOW COULD THIS HAPPEN?!?!?! I’ll tell you the story from the very beginning.
It was time to start working on lab 5, the professor warned us to start early. I tried. (Did not succeed much). I asked about problem 5 in class. He gave us a very DECENT and EXPLICIT explanation of what needed to be done and lots of hints and yet I NEVER got one of the loops in one of the functions RIGHT!!!!!!! The deadline arrived, I was VERY tired: I submitted lab 5 the way it was. I was like: “What do?”. There was not much I could do. My brain wasn’t working right… But of course! I was NOT going to give up that easily! The morning after the deadline I went to the prof’s office to see if I could get some help. He gave me some ideas but… I went home I tried to work on it I had all sorts of ideas and I indeed wrote them in Pseudo code. But all to no avail… I got stuck AGAIN! The problem was still wrong……. Next Wednesday I go to his office again, I show him my driver program. It’s better than before so he starts fixing things and telling me a whole bunch of things. Then we run it, but it’s still WRONG! He tells me it’s because of the bad structure of the loop and that I should try again. I go home after a LONG DEPRESSING (depressing 4 other reasons, lol) day and I say to myself: “Shirley, you already got a 60 on Food Chemistry because you were working on these labs instead of studying for what you’re majoring in. I think we both know it’s time to forget about the puzzlers and study for Organic Chemistry because you have five tests and a Quiz next week and you haven’t looked at chapter 20 from Organic Chemistry and YOU know that class needs dedication too. (Pff not that there’s a class that doesn’t NEED dedication).” So after this inner journey I decided it was time to forget about it and I’ve done decent progress after I gave up. Now I’m moving on with other things related to other classes and with even this same class. Today I read chapter six. It was confusing and I have questions but soon I’ll blog about this chapter and I know it’ll help me sort things out in my head. I’m also doing this blog entry which is very important. I finished other things too, blah. Now I have to start working on lab 6 because the deadline is right there on my FACE! And during the week I won’t have much time and I have to make the most out of the prof’s office hours on Monday and Wednesday. Sadly he won’t have office hrs on Friday because we don’t class this Friday because of Las Justas (which is a thing were all the rapists and athletes go to and get drunk and drugged so you obviously won’t see me there. Why the heck would I put myself in danger? People are SO dumb. Just saying… I mean people die and get raped there EVERY year, come on, get real!)
As for the test…… well one of the tests I have next week (which are actually 4 because one of the prof’s changed hers, thank God!) is the second midterm for this class so I have to study for that. A LOT. And I will. Anyway I’ve made a decision: I will leave this blog up to here. This was a story post. A story about lab 5. But I’ll make another post about my notes and analysis of them. I don’t want the posts to be Soooo retardedly long because it gets boring I guess! But before I leave, I will copy paste lab 5’s 5th problem so you can all SEE the level of difficulty. Lol, jkg apparently I was one of the very few who couldn’t do that problem… Everyone else managed to solve it. Ooooooooh……….. I guess I’m the dumb one in class……..
Problem 5! (Read it, it has a story. It’s basically retarder. lol):
Problem 5 In the land of Puzzlevania, Aaron, Bob, and Charlie had an argument over
which one of them was the greatest puzzler of all time. To end the argument once and for
all, they agreed on a duel to the death. Aaron is a poor shooter and only hits his target
with a probability of 1/3. Bob is a bit better and hits his target with a probability of
1/2. Charlie is an expert marksman and never misses. A hit means a kill and the person
hit drops out of the duel.
To compensate for the inequities in their marksmanship skills, it is decided that the
contestants would fire in turns starting with Aaron, followed by Bob, and then by Charlie.
The cycle would repeat until there was one man standing. And that man would be
remembered as the greatest puzzler of all time.
(a)Write a function to simulate a single shot. It should use the following declaration:
void shoot(bool& torgetAlive, double accuracy);
This would simulate someone shooting at targetAlive with the given accuracy by
generating a random number between 0 and 1. If the random number is less than accuracy, then the target is hit and targetAlive should be set to false. Appendix
A illustrates how to generate random numbers.
For example, if Bob is shooting at Charlie, this could be invoked as:
Here, charlieAlive is a Boolean variable that indicates if Charlie is alive. Test your
function using a driver program before moving on to the next step.
(b) An obvious strategy is for each man to shoot at the most accurate shooter still alive
on the grounds that this shooter is the deadliest and has the best chance of hitting
back. Write a second function named startDuel that uses the shoot function to
simulate an entire duel using this strategy. It should loop until only one contestant
is left, invoking the shoot function with the proper target and probability of hitting
the target according to who is shooting. The function should return a variable that
indicates who won the duel.
(c) In your main function, invoke the startDuel function 1,000 times in a loop, keeping
track of how many times each contestant wins. Output the probability that each
contestant will win when everyone uses the strategy of shooting at the most accurate
shooter left alive.
(d)A counter-intuitive strategy is for Aaron to intentionally miss on his first shot. Thereafter,
everyone uses the strategy of shooting at the most accurate shooter left alive.
This strategy means that Aaron is guaranteed to live past the first round, since Bob
and Charlie will fire at each other. Modify the program to accommodate this new
strategy and output the probability of winning for each contestant.
Now I’ll show you my loops! Actually I would show them to you but I have them on my virtual box and I can’t copy paste to Windows. B.O.R.I.N.G. Still, I love my virtual box! Don’t know what I would do without it.