Member Avatar

Welcome to the temporary page for the official Nightmare Productions C++ Contest. What do we hope to achieve by holding such a contest? We are attempting to spread the knowledge of C++ and hopefully get others interested in it. The contest description is below. In order to enter the contest, you must attach all of the files (.cpp, .h, and .doc files) to your reply in this topic. The deadline for entries is December 7, 2008. The winners will be announced by the 30th and will recieve their prizes. What are the prizes you ask? Well, thanks to all of the people who donate and to for hiring us, we are able to make the prize HUGE...kinda. This prize is a once in a life-time thing for us. There won't ever be another time where we will offer a prize this big. There will be 2 winners. The winners will be able to choose from three prizes:

(1)- $200 in cash. The winner can recieve this via check or PayPal.

(2)- $200 in Microsoft Points. The code will be sent via email unless the winner requests the point cards to be sent via mail.

(3)- $200 in Wii Points. See the previous prize's details for specifics.

The winners will be based on the speed that the code was recieved and the quality of the code. One winner will be chosen for being the fastest and best code while the second will be chosen for having the best quality code out of all of the entries. The winners will also have their code advertised on our Contests page (still in progress). We hope you all have fun with this. This is an easy way to get some quick spending money for the holiday. Good luck!


The files used for this contest are attached.

Please note that there is a small error in the code in order to provide more of a challenge. If you can't figure out how to fix it, feel free to send in the code with errors (I will only accept a small amount of errors). Please put your name, username, and email(optional) in the comment box at the top of your code.

BTW, I made it Simpsons themed to entertain you all more :D.

Here is what you need to do:

For this contest, a lot of my code will remain in tact. Your code for the bar classes will be the same and that for the drunk will change ever so slightly. Coooool. You will have to add some functions to the town class and some content to the TeaTotaller and police classes.

The objective of this program is to determine how much property damage that the drunks in the town will do while they are wandering about the streets interacting with the tea-totallers and the police. The interactions will begin after the drunks are booted out of the bar (bar closing) and will end when there are no longer any drunks on the streets. This will require you to write a function to add to thetown class that triggers the interactions. Let's call this function Operation_Street_Sweeper(), and it will be called by the town object after the to_the_streets function is called.

Let's layout the characters involved:

The drunks:
The drunks now need a member function that is called to "implement" the passing of time and its effect on the drunk. Call it sober() and it will reduce the bac of the object by 0.01. Thus, each time it is called, the drunk sobers a little bit (time passes, you sober up).
The police:
a name
an int to keep track of then number of drunks they have encounter (during the simulation only).
the doughnut factor, a float.
appropriate constructors
overloaded extraction operator
insertion operator
a function to increment their drunk-encounter count
a bool function that determines whether or not the officer goes for a doughnut. This function will determine that probability by multiplying the doughnut factor by the number of drunk encounters. Using the random number generator with this probability then determines whether the officer leaves the scene.
The TT class:
a float to represent their "annoyance factor".
appropriate constructors
extraction and insertion operators
a boolean function that will take a float. This parameter represents the bac of the drunk that the TT will encounter. If this bac is greater than the TT's annoyance factor, then the function returns false. Otherwise, it will reduce the annoyance factor by the bac of that drunk and return true. Call this function the tollerance funtion..
The town class:
new data:
property damage, a float. Be sure to include in your constructors!
new functions:
Operation_Street_Sweeper(). This function will:

while (there are drunks in the streets)
        	for each drunk from the array
			choose a person from one of the 3 arrays (police, drunk or TT)
			if two drunks meet
			   tally property damage.
			else if drunk meets officer
			   increase officer's drunk encounters. 
			   determine if officer goes for doughnut.
			   if so
			      remove officer from array.
			      remove the drunk from the array.
			else if drunk meets TT
			   pass the drunk's bac to the TT's tollerance function	
			   if it returns false
			      remove the TT from the array
	         have each drunk call its sober() function.
	            if bac==0
	              remove from array.

Now, we are leaving it up to you to determine how and by how much the property damage is caused. Think about this and make it logical....and interesting....and funny! Document PROMINENTLY your implementation for the grader.
The main function will be the same as the previous assignment's, but will have the town call its Operation_Street_Sweeper function.
Output: After the to_the_streets function is called, output the contents of the three arrays (labelled and easy to read. Also, as any person (police, TT, or drunk) is removed from their respective arrays (signifying they are no longer on the scene), output a simple message stating who left, their pertinent stats (e.g. a drunk leaves, include his/her bac) and why. Finally, output the property damage in the town due to the drunks. You must decide when and how to implement these output functions. Make them wise decisions.

Optionals: You may include some funny stuff when you satisfy all the above requirements. For example, you could have each charact utter some funny comment randomly chosen from a file of (appropriate) comments every time they are removed from the street. If you add stuff, put a big comment block at the beginning of the main function explaining to your grader what you have done extra.

The Others:
Police: (name and doughnut factor) NOTE: In no way is this assignment meant to denegrate the police in reality.

Wiggum, Chief 0.05
		The_cop, Lou 0.06
		The_cop, Eddie 0.08
		Guy, Comicbook 4.5
		Chalmers, Superintendant 4.0
		Man, Bumblebee 3.7
		Stu, Disco 4.1
		Flanders, Maude 6.7
		Frink, John 2.3
		Hutz, Lionel 4.1
		Lovejoy, Helen 6.1
		Malibu, Stacy 4.8
		Smithers, Waylon  7.1

Recommended Answers

All 12 Replies

Member Avatar

Thanks for putting this back up!!

You should make the rules less restricitve andjust include the objective: "to determine how much property damage that the drunks in the town will do while they are wandering about the streets interacting with the tea-totallers and the police" What a rediculous objective. Is this to be console based? No graphics whatsoever? If it is console based, I'd say that the contest is much too easy and find it hard to believe that an award is really being offered. What a rediculous objective. Is this to be console based? No graphics whatsoever? If it is console based, I'd say that the contest is much too easy and find it hard to believe that an award is really being offered.

Then why don't you cry about it? Oh wait, you did.

(Graphics??? WTF are you thinking?)

Member Avatar

The reason for the restrictions as CPPRULZ was asking about, is in order to provide more of a challenge. As skatamatic said, this is a very easy contest. And in reply to the rest of his post, this contest was MEANT to be easy. This isn't for personal gain or to promote myself. This is to promote C++ programming. I have a degree in Computer Science and love programming. However, it disappoints me to see how few people know about C++. In order to try to get the word out, I'm hosting this contest and then displaying the results on my website as well as on a future video that I make for If you don't like the minimal challenge it provides then feel free to pass it up. However, if you think it's so easy then you shouldn't have any problem in completing this and possibly winning $200. I've done these contests before(although the prizes were considerable smaller) and they've all gone over well. Also, like Rashakil Fol said, Graphics??? WTF are you thinking? lol I personally hope that someone from daniweb wins because I constantly use these forums to get help with personal projects that I do.

commented: I applaud the effort and his restraint in answering ;) +1

Lol. well if it really is a genuine contest then I suppose I should probably make an entry. When's the deadline? And by graphics, I meant having a display of a bunch of drunks walking around with police, and having damage being done to property :P What else would i be thinking?

Member Avatar

Well, the official deadline is November 7th. I was thinking about pushing it back a little bit since I'm going out of town for a couple days. I'm going to be interviewing Rich Taylor(Senior Vice President of Communications for the Entertainment Software Association and creator of E3). I think I'll just keep the date though as I'd like to be able to go over it while I'm sitting in the hotel. If you do submit an entry, which is sincerely hope you do, please don't put graphics or anything special. It'll make it harder to go over and judge along side the other entries. Just keep it basic. As long as the code is good, you should stand a good chance. Good luck!

Member Avatar

Time is almost up!! If your gonna enter any code then you should do it soon. BTW, seeing as how this contest is doing decently well there is a chance I'll be holding another quick contest (with a significantly smaller prize of course).

Member Avatar

lmao, my bad. Forgot the date XP. Keep working, then!! You all still got a week!

It's too bad it's finals week. I don't think I'll have time!

hey... i m new to this forum .... seems the deadline is over....are there any other contests in pipeline....

Member Avatar

Actually, the deadline isn't over. In one of my previous posts I put November when I meant to put December. Sorry about that XP. This contest is still open. Feel free to enter. I still stand by what I said about anyone who sends correctly working code is bound to win. Good luck in the contest abhijitm!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.