Plink issues!!

Hello friends,
I have written some code for the game plinko. All of it works as expected and as required EXCEPT! there is an option to put multiple chips into any slot. Every time the multiple chips fall they almost always end up in the final slot of 0. I am trying to figure out why they always tend to favor landing in the 0 slot. Please help!!! thank you.
the path to follow in the code is:
2 //this takes you to the multiple chips
n chips // however many chips you want to drop
0-8 // what ever slot you want your chips to fall in.


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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
#include <iostream>
#include <string>
#include <time.h>
#include <iomanip>

using namespace std;

int main() {
	srand(time(0));
	int ans;
	int single = 1;
	int multiple = 2;
	int quit = 3;

	//random number either 0 or 1
	// 0= -.5
	// 1= +.5
	
	int bowl = 0;
	double move_left = -.5;
	double move_right = .5;
	double winnings_zero = 100.00;
	double winnings_one = 500.00;
	double winnings_two = 1000.00;
	double winnings_three = 0.00;
	double winnings_four = 10000.00;
	double winnings = 0;
	double average_winnings = 0;



	//Enter while the answer is anything but what is in the "quit" string, if the answer is equal then skip the loop.
	while (true) {
		double slot_start = 0.0;
		cout << "MENU: Please select one of the following options:\n";
		cout << "1 - Drop a single chip into one slot\n";
		cout << "2 - Drop multiple chips into one slot\n";
		cout << "3 - Quit the program\n";
		cout << "Enter your selection now: ";
		cin >> ans;


		//Enter this if the answer is equal to the "single" string
		if (ans == single) {
			cout << fixed << setprecision(1);
			

			cout << "***DROP SINGLE CHIP***\n";
			cout << "Which slot do you want to drop the chip in (0-8)?\n";
			cin >> slot_start;
			
			if ((slot_start >= 0) & (slot_start <= 8)) {
				cout << "[" << slot_start;
				for (int i = 0; i < 12; i++) {
					double direction = (rand() % 2);
					//I = 12 This is for printing out the final Bracket at the end of the chip path.
					if (i == 12){
						//you cant fall off the board to the left
						if (slot_start == 0.0) {
							slot_start = slot_start + move_right;
						}
						//you cant fall off the board to the right!
						else if (slot_start == 8.0) {
							slot_start = slot_start + move_left;
						}
						//you can play plinko though!!
						else {
							//move to the left one slot
							if (direction == 0) {
								slot_start = slot_start + move_left;
							}
							//move to the right one slot
							if (direction == 1) {
								slot_start = slot_start + move_right;
							}
						}

					}
					//I = 0-11
					//you cant fall off the board to the left!
					else if (slot_start == 0.0) {
						slot_start = slot_start + move_right;
					}
					//you cant fall off the board to the right!
					else if (slot_start == 8.0) {
						slot_start = slot_start + move_left;
					}
					//you can play plinko though!!
					else {
						//move to the left one slot
						if (direction == 0) {
							slot_start = slot_start + move_left;
						}
						//move to the right one slot
						if (direction == 1) {
							slot_start = slot_start + move_right;
						}


					}


					cout << " " << slot_start;
				}//plinko ForLoop
				cout << "]" << endl;
				
				cout << fixed;


				if (slot_start == 0 || slot_start == 8){
					cout << setprecision(2) << "$" << winnings_zero << endl;
				}
				else if (slot_start == 1 || slot_start == 7){
					cout << setprecision(2) << "$" << winnings_one << endl;
				}
				else if (slot_start == 2 || slot_start == 6){
					cout << setprecision(2) << "$" << winnings_two << endl;
				}
				else if (slot_start == 3 || slot_start == 5){
					cout << setprecision(2) << "$" << winnings_three << endl;
				}
				else {
					cout << setprecision(2) << "$" << winnings_four << endl;
			
			}//slot_number check IfF(x)
			
			}
			else {
				cout << "INVALID SLOT, slots 0-8.\n";
			}
		}
	



		//Enter this IF the answer is equal to the "multiple" string.
		else if ((ans == multiple)) {
			int slot = 0;
			cout << "***DROP MULTIPLE CHIPS***\n";
			cout << "How many chips do you want to drop >0?\n";
			cin >> bowl;
			if (bowl > 0) {
				cout << "Which slot would you like to put your chips in?\n";
				
				cin >> slot_start;
				for (int i = bowl; i > 0; i--) {
					
					
					slot = slot_start;
				
					if ((slot >= 0) && (slot <= 8)) {
						for (int i = 0; i < 12; i++) {
							double direction = (rand() % 2);
							//I = 12 This is for printing out the final Bracket at the end of the chip path.
							if (i == 12){
								//you cant fall off the board to the left
								if (slot == 0.0) {
									slot = slot + move_right;
								}
								//you cant fall off the board to the right!
								else if (slot == 8.0) {
									slot = slot + move_left;
								}
								//you can play plinko though!!
								else {
									//move to the left one slot
									if (direction == 0) {
										slot = slot + move_left;
									}
									//move to the right one slot
									else if (direction == 1) {
										slot = slot + move_right;
									}
								}

							}
							//I = 0-11
							//you cant fall off the board to the left!
							else if (slot == 0.0) {
								slot = slot + move_right;
							}
							//you cant fall off the board to the right!
							else if (slot == 8.0) {
								slot = slot + move_left;
							}
							//you can play plinko though!!
							else {
								//move to the left one slot
								if (direction == 0) {
									slot = slot + move_left;
								}
								//move to the right one slot
								else if(direction == 1) {
									slot = slot + move_right;
								}


							}


						
						}//plinko ForLoop
						cout << "thisistheslot" << slot << endl;
							if (slot == 0 || slot == 8){
								//cout << "Icamehere\n";
								winnings = winnings + winnings_zero;
							}
							else if (slot == 1 || slot == 7){
								//cout << "Icamehere\n";
								winnings = winnings + winnings_one;
							}
							else if (slot == 2 || slot == 6){
								//cout << "Icamehere\n";
								winnings = winnings + winnings_two;
							}
							else if (slot == 3 || slot == 5){
								//cout << "Icamehere\n";
								winnings = winnings + winnings_three;
							}
							else{
								//cout << "Icamehere\n";
								winnings = winnings + winnings_four;

							}//slot_number check IfF(x)



						//plinko ForLoop
						

					}//plink if
					else {
						cout << "INVALID SLOT, slots 0-8.\n";
					}
					
				}
				cout << fixed << setprecision(2) << "$" << winnings << endl;
				cout << setprecision(2) << "$" << winnings / bowl << endl;
				winnings = 0;
			}
				
				//for loop bowl#oftimes
			else {
				cout << "INVALID NUMBER OF CHIPS.\n";
			}
			
		}

		else if (ans == 3) {
			cout << "GOODBYE\n";
			system("pause");
			return 0;
		}


		//Print if user does not enter "1", "2", or "3"
		else {
			cout << "INVALID SELECTION, Please enter 1, 2 or 3.\n";

		}
		//Reprompt the user after a running single chip, multiple chips, or receiving invalid data.
		
	}

	cout << "GOODBYE\n";


	
}
Topic archived. No new replies allowed.