-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChance_Game_MULTYPLAYER.java
More file actions
executable file
·150 lines (114 loc) · 5.48 KB
/
Chance_Game_MULTYPLAYER.java
File metadata and controls
executable file
·150 lines (114 loc) · 5.48 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import java.io.*;
public class Chance_Game_MULTYPLAYER
{
public static void main(String args[])throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int i;
System.out.println("-------Welcome to The Bhavik's Chance Game-------");
System.out.println(" ---------- Main menu ---------- ");
System.out.println(" ");
System.out.println(" 1. Play ");
System.out.println(" 2. Help ");
System.out.println(" 3. Others ");
System.out.println("");
System.out.println("Enter Your Choise....");
int ch = Integer.parseInt(br.readLine());
System.out.println(" ");
System.out.println("=========================================================================================================================================");
System.out.println(" ");
System.out.println(" ");
if (ch==1)
{
int r;
int c1=0;
int c2=0;
for(i=1;i<=10;i++)
{
r= 1+(int)(Math.random()*5);
if(i % 2 == 1)
{
System.out.println(" _________PLAYER 1's turn_________ !! - Enter any number... ");
System.out.println("");
int no = Integer.parseInt(br.readLine());
if (no==r)
{
System.out.println(" you got your luck !!! +1* ");
System.out.println("");
System.out.println("");
System.out.println(" *** ");
c1=c1+1;
}
else
{
System.out.println(" Sorry.....it was '"+r+"' better luck next time ");
System.out.println("");
System.out.println("");
System.out.println(" *** ");
}
}
else
{
System.out.println(" _________PLAYER 2's turn_________ - Enter any number...");
System.out.println("");
int no = Integer.parseInt(br.readLine());
if (no==r)
{
System.out.println(" you got your luck !!! +1* ");
System.out.println("");
System.out.println("");
System.out.println(" *** ");
c2=c2+1;
}
else
{
System.out.println(" Sorry.....it was '"+r+"' better luck next time ");
System.out.println("");
System.out.println("");
System.out.println(" *** ");
}
}
}
System.out.println(" GAME OVER !!! ");
if ( c1 > c2)
{
System.out.println(" The Winner is --- PLAYER 1 !!! ");
System.out.println(" ");
System.out.println("=========================================================================================================================================");
}
else if (c2 > c1)
{
System.out.println(" The Winner is --- PLAYER 2 !!!");
System.out.println(" ");
System.out.println("=========================================================================================================================================");
}
else
{
System.out.println("draw match");
System.out.println(" ");
System.out.println("=========================================================================================================================================");
}
}
else if (ch==2)
{
System.out.println(" This is a multyplayer game in which 2 player can play at the same time... ");
System.out.println(" Enter a number which you guess if the number matches with the computer generated random number then +1 else 0");
System.out.println(" Just Enter a number and Press Enter !!");
System.out.println(" The turn is alternate !!");
System.out.println(" Enjoy !!!");
}
else if (ch==3)
{
System.out.println("Credits -- ");
System.out.println(" This Game is developed by Bhavik Mangla ; U can also find me at youtube- BHAVIX ");
System.out.println(" This Game uses Buffered reader and is made for Absolute beginners so that they can understand...");
System.out.println(" Please do not distribute this SourceCode without my details in the Credits...");
System.out.println(" Thanks for hopping by..... Enjoy !!!");
System.out.println(" Updated versions coming soon... to stay updated 'Subscribe'");
}
else
{
System.out.println("oops.. Wrong Input ! Please try Again.. ");
}
}
}