Due: Wednesday, April 11, 2018 at 12:00 p.m. 100 pts.
For this assignment you will submit (in the usual way) multiple files. These files will contain a C++ program that you have named appropriately; each file with an appropriate name and appropriate extension as well as input files to your program. Also, you may work on this program with a partner. If you do (it is not required that you do), then submit ONLY UNDER ONE NAME/ACCOUNT. Make sure that both of your names are in the headers. The only rule is the you and your partner must have the same instructor for the course.
This program is to give you practice using:functions
loops
null-terminated character arrays
file I/O
the system's random number generator
everything else we've covered up till now
Background: So, as you all suspected, BoJack has a mother. This is completely believable. Personally, I have never met her, but I digress. But it is well known that Beatrice, for that is her name, is old and getting older rapidly and needs to be "put out to pasture". She has become "rather disagreeable", argumentative, and even borderline profanely abusive. Every week, she and her son talk with each other on the phone. Their conversations are sometimes rather heated, but always difficult. Beatrice will go off and BoJack will always get a bit frustrated with her.
Details:
Remember that you can work with a partner, but you have to have the same instructor. No exceptions! None!!
Each of the bingo card files is formatted as 5 single (lowercase) words on 5 lines (that's 25 total words), each word separated by a comma, no spaces; each word can be at most 15 chars long; no comma after each fifth word.
Each of the sayings files is formatted with the first line containing an integer indicating how many sayings there are in the file, and the remaining lines each have a saying of at most 256 chars.
If the "bad" word begins with an uppercase letter in the saying, then the "good" word it is replaced with must also begin with an uppercase letter in the saying.
Each of the two contestants must check for words in the (sanitized) sayings in their bingo cards; and, for a match, case doesn't matter.
The telephone conversation (and hence the game) ends when either one of the players gets BINGO or 20 rounds (NOT individual utterances) of Beatrice and BoJack saying something have been completed.
At the end of the conversation (and hence the game), Beatrice and BoJack should say 'goodbye' to each other, and you should output the results of the Bingo game; the Bingo game can end in 1 of 3 possible ways: (1) no one won (i.e., it was over because 20 rounds of the telephone conversation finished), or (2) one of the contestants got BINGO (see below), or (3) both of the contestants got BINGO in the same round (so it was a tie).
How someone wins at BINGO:
You match all words in a row, or
You match all words in a column, or
You match all words in a major diagonal.
Note: Any position that has the word "*" in it is an automatic match
Output: In addition to displaying on the screen who the winner is, you must write the contents of that person's Bingo card to both the screen and a file. If that is the first contestant, write it to a file named winningBingoCard1.dat. If it is the second contestant, write it to a file named winningBingoCard2.dat. If there was a tie, write both files. If no one won, you don't have to write either of these files. In any case, indication of the outcome needs to go to the screen.
When you output (file and screen) a winning card, write each of the 5 words of a row of the Bingo card to a line separated by at least one space. Put [ ]'s around the words that were involved in the winning Bingo combination for that card so that we can see how the contestant won (i.e., which row, column, or diagonal entries they matched).
Now one last thing...any winner of anything deserves a prize. Wouldn't you agree? So, if there is either a single winner or a tie (two winners), then your code should pick at random a prize (or prizes) from the WinnersPrize.dat file and announce it for the one (or the pair). The format of the prize file is that each prize will be on a single line no more than 100 characters, and there is no indication in the file as to how many prizes are in the file. You can count on there being a newline char at the end of each line. You are not to modify the file.
Now for the data files: There are five (5) files that you need for this assignment. To save you the trouble (aren't we kind?!) of creating them, I've created them in my directory and I'm giving you a method to download them easily into your directory. First, create in your sdrive a directory for your hw8 files. Then change into that directory and type the following commands at the unix prompt:
wget http://web.mst.edu/~price/1570/bingoCard1.dat
wget http://web.mst.edu/~price/1570/bingoCard2.dat
wget http://web.mst.edu/~price/1570/BojackSayings.dat
wget http://web.mst.edu/~price/1570/BeatriceSayings.dat
wget http://web.mst.edu/~price/1570/WinnersPrize.dat
You should issue the ls command at the end of this to check to see that you have indeed obtained those files. Open them to make sure the data is there, but don't alter it!
But wait, there's more! You are required to use only null-terminated character arrays (c-strings) for this assignment (not std strings). Furthermore, you are NOT to read in all the contents at one time of any sentence or prize file and store them internally in your program. Of course, you need to read in the bingo card files at once and store them.
When you submit: As you develop your code, seed the rng with time. But when you submit, seed with this magic value: 1522258756. And, use the names "Todd" and "Mr. Peanutbutter" as the players.
Note: Don't underestimate the difficulty of this assignment. Start early!
One final note: We would like to make it clear that no horse-headed animated creatures were harmed in the making of this web page. Perhaps a few were insulted, but they most certainly deserved it. The SPCA (Society for the Prevention of Cruelty to Animations) has give their blessings to this exercise.
In this assignment, you are going to write code that will generate a conversation between BoJack and Beatrice by randomly selecting phrases and sentences from files, then altering them before output (details below). Furthermore, your program will simulate a BINGO game/contest between two people. They will each have a bingo card that has a 5 x 5 array of words on it, and they each will "scan" the output of our two heroes for those words. If one of their words is in BoJack's or Beatrices utterances, then they will note that. If they win, they yell BINGO and the game ends...as will the conversation.Specifications: Your code should first input from the user (players of the bingo game) their names. Then each is to be "issued a bingo card". This means that each player will have a 5 x 5 array associated with (just) them and it is filled with words from a file, bingoCard1.dat and bingoCard2.dat. Below you will be shown how to download these files so that you don't have to create them. (And a warning: DON'T COPY AND PASTE THEM. Just follow the directions below.) Also below, you will be given specs on the format of the files. Your code will start the conversation between BoJack and Beatrice by having BoJack say "hello" (it's him who makes the call). This is to be followed alternately by Beatrice and then BoJack saying something. Each thing they say will be chosen at random from their respective files, BojackSayings.dat and BeatriceSayings.dat. But before each saying is displayed to the screen, they are to be altered by your code in the following manner. Some words need to be "sanitized" for the general public (you never know, this could become a TV show!). Each "bad" word is to be replace with a "good" word. Here's how they are to be replaced:
bitch - > mean person
dammit - > darn it
shit - > poop
crap - > poopie
damn - > hoot
After each time BoJack or Beatrice says something, each player will determine if that speaker has uttered one of the words on their bingo card (check each word in a sanitized saying to see if it matches any word in their 5 x 5 array of words). They will note any match (in some fashion - that's up to you how you code that) and yell BINGO at any point in time they have satisfied the requirements for a win.