-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnake-Water-Gun.c
69 lines (55 loc) · 1.43 KB
/
Snake-Water-Gun.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
srand(time(0));
int player, computer = rand() % 3;
int count = 0;
printf("\t\t\t\t\t\t\tGAME STARTS NOW!!\n\n\t\t\t\t\t\t\t0)SNAKE for 0 \n\t\t\t\t\t\t\t1)WATER for 1 \n\t\t\t\t\t\t\t2)GUN__ for 2\n\n");
printf("choose any one above: \n");
scanf("%d",&player);
printf("\t\t\t\t\t\t\tYOU chose %d\n\n",player);
printf("\t\t\t\t\t\t\tCOMPUTER chose %d\n\n",computer);
if(player == 0 && computer== 0)
{
printf("\t\t\t\t\t\t\tDRAW\n");
}
else if(player == 1 && computer== 1)
{
printf("\t\t\t\t\t\t\tDRAW\n");
}
else if(player == 2 && computer== 2)
{
printf("\t\t\t\t\t\t\tDRAW\n");
}
else if(player == 0 && computer== 1)
{
printf("\t\t\t\t\t\t\tYOU WON\n");
}
else if(player == 0 && computer== 2)
{
printf("\t\t\t\t\t\t\tGAME OVER\n");
}
else if(player == 1 && computer== 0)
{
printf("\t\t\t\t\t\t\tGAME OVER\n");
}
else if(player == 1 && computer== 2)
{
printf("\t\t\t\t\t\t\tYOU WON\n");
}
else if(player == 2 && computer== 0)
{
printf("\t\t\t\t\t\t\tYOU WON\n");
}
else if(player == 2 && computer== 1)
{
printf("\t\t\t\t\t\t\tGAME OVER\n");
}
else
{
printf("\t\t\t\t\t********* ENTER NUMBER (0) (1) (2) ONLY *********\n");
return 1;
}
}