VB icon

Bovine Roulette (like Russian Roulette)

Email
Submitted on: 1/1/2015 1:26:00 PM
By: Ben Jacobs (from psc cd)  
Level: Beginner
User Rating: By 3 Users
Compatibility: C
Views: 604
 
     This is the first game I ever coded. I whipped it out in a few minutes and decided that it might be useful(ha!) for other people. Should work on any compiler in any OS. Sorta fun to play if your really bored, shows use of simple random numbers.
 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
//INCLUDE files for :Bovine Roulette (like Russian Roulette)
//**************************************
<stdio.h>
<stdlib.h>
<time.h>
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Bovine Roulette (like Russian Roulette)
// Description:This is the first game I ever coded. I whipped it out in a few minutes and decided that it might be useful(ha!) for other people. Should work on any compiler in any OS. Sorta fun to play if your really bored, shows use of simple random numbers.
// By: Ben Jacobs (from psc cd)
//**************************************

/* Coded by Ben Jacobs of Nonsense Software 2000. 
 * Personal comments: I whipped this together in about half an hour and it's
 * the first game I've ever programmed in C. For some reason the random 
 * number generator doesn't work that well, I try to fix it so it works better
 * sometime. Send comments to dooberwah@crosswinds.net
 */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
	int i, r, d=0;
	char key;
	srand((unsigned)time(NULL));
	
	for(i=1;i<10;i++)
	{
		if(d==1)
			break;
		printf("\nBovine Roulette\n");
		printf("You are on cow %i of 10.\n",i);
		printf("Press \"m\" to start [m]ilking. ");
		for(;;)
		{
			key=getchar();
			if(key=='m')
				break;
		}
		r=rand()%100;
		if(r<10)
		{
			printf("Oops, you got kicked by the cow you were milking and died.\n");
			d=1;
		}
		if(r==11)
		{
			printf("The cow who you were milking's bullfriend comes to her rescue and beats you up. You die.\n");
			d=1;
		}
		if(r>12)
		{
			printf("You milk the cow without getting kicked. Onward to the next one!\n");
		}
	}
	if(d==1)
	{
		printf("Darn, it seems you have died. Check out www.nonsensesoftware.com for more \"cool\" games by");
		printf(" Nonsense Software.\n");
		getchar();
	}
	if(d==0)
	{
		printf("YAY! You won! (this should make you feal very happy for no reason at all) Check out");
		printf("www.nonsensesoftware.com for more \"cool\" games by Nonsense Software.\n");
		getchar();
	}
}


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.