- Joined
- Oct 10, 2013
- Messages
- 173
So I was planning to make match stick game for my friends, and then I came up with 116 line code hand written in 2 hours. Now I am facing this irritating problem Imgur: The most awesome images on the Internet
Here is the code
Please find out whats wrong, since I have been scratching my head from yesterday.
Here is the code
Code:
#include<stdio.h>
#include<conio.h>
void main()
{
char first;
int pick,second,third,fourth;
printf("Hello Human,\n you wanna play a game with me?\nReply with Y to play, or else press any other key to exit\n");
scanf("%c",first);
if(first=='y'||first=='Y')
{
printf("Ok I say see you want to play with me\n The rules are simple.\nWe have total of 21 matchsticks, and we will pick matchsticks amount from 0 to 5 at every pick\n The player who gets the last 21th matchstick will loose\n");
printf("Since you are puny, I will grant you first pick for fair play\n");
printf("Select an amount of matchsticks, from 0 to 5. Note that you cannot pick 0 or 5 match stick\n");
scanf("%d",&pick);
if(pick==1)
{
printf("Hmm, In this case I shall pick ||||(4) matchstick\n");
printf("Now, there are ||||||||||||||||(16) matchsticks are left.Lets continue the game\n");
}
if(pick==2)
{
printf("Hmm, In this case I shall pick |||(3) Matchstick\n");
printf("Now, there are ||||||||||||||||(16) matchsticks are left.Lets continue the game\n");
}
if(pick==3)
{
printf("Hmm, In this case I shall pick ||(2) Matchstick\n");
printf("Now, there are ||||||||||||||||(16) matchsticks are left.Lets continue the game\n");
}
if(pick==4)
{
printf("Hmm, In this case I shall pick |(1) Matchstick\n");
printf("Now, there are ||||||||||||||||(16) matchsticks are left.Lets continue the game\n");
}
printf("Time for round 2, Human Lets go\nType in your amount of matchstick\n");
scanf("%d",&second);
if(second==1)
{
printf("Oh, Now I will take ||||(4) match stick\n");
printf("Amazing Human,You have played well now |||||||||||(11) matchsticks are left.Lets continue this game");
}
if(second==2)
{
printf("Oh, Now I will take |||(3) match stick\n");
printf("Amazing Human,You have played well now |||||||||||(11) matchsticks are left.Lets continue this game");
}
if(second==3)
{
printf("Oh, Now I will take ||(2) match stick\n");
printf("Amazing Human,You have played well now |||||||||||(11) matchsticks are left.Lets continue this game");
}
if(second=4)
{
printf("Oh, Now I will take |(1) match stick\n");
printf("Amazing Human,You have played well now |||||||||||(11) matchsticks are left.Lets continue this game\n");
}
printf("Well played human, two more rounds are left to see the winner\n");
printf("Take your sticks");
scanf("%d",&third);
if(third==1)
{
printf("Woah, I will take ||||(4) sticks now\n");
printf("Now humans ||||||(6) matchsticks are left\n");
}
if(third==2)
{
printf("Woah, I will take |||(3) stick now\n");
printf("Now humans ||||||(6) matchsticks are left\n");
}
if(third==3)
{
printf("Woah, I will take ||(3) stick now\n");
printf("Now humans ||||||(6) matchsticks are left\n");
}
if(third==4)
{
printf("Woah, I will take ||(3) stick now\n");
printf("Now humans ||||||(6) matchsticks are left\n");
}
printf("And so ends the third round, lets move to last round human\n");
printf("You know the drill\n");
scanf("%d",fourth);
if(fourth==1)
{
printf("Gotcha,I take ||||(4) match. Since you got one match, you are LOOSER");
}
if(fourth==2)
{
printf("Gotcha,I take |||(3) match. Since you got one match, you are LOOSER");
}
if(fourth==3)
{
printf("Gotcha,I take ||(2) match. Since you got one match, you are LOOSER");
}
if(fourth==4)
{
printf("Gotcha,I take ||||(4) match. Since you got one match, you are LOOSER");
}
}
else
{
printf("OK BYE, THE CREATOR CREATED ME WITH LOVE FOR YOU");
}
}