I'm doing an assignment for my intro class about a Plinko game, simulating possible outcomes. For those of you who have no idea what plinko is (like I didn't), here's a flash game version:
http://www.kongregate.com/games/StapleGun/plinko
The assignment parameters are to create a code that prompts the user to either quit, run a single chip simulator, or run a multiple chip simulator. If an invalid entry is ever entered, it is to return the user to the main menu. The program should repeat itself infinitely until the option to exit is chosen.
The plinko machine for our assignment has 12 rows of pegs, so 13 total slots including the entry slot and last slot, and 9 possible entry slots (0-8).
The single chip simulator starts with prompting the user for an entry slot. Then it simulates the chip falling through the machine, with a 50/50 chance to go either left or right for each peg it hits, with the condition that it doesn't exit the walls of the machine. When it reaches the bottom slot, the program records the slot and assigns a monetary reward value depending on which slot it ends up in. The simulation outputs the path of 13 slots the chip took to reach the bottom, then the winnings of the final slot.
The multiple chip simulator runs the same simulation, but before it does it prompts for a number of chips to drop total. It will simulate that number of chips all dropped sequentially into the same initial slot, then output only the total winnings and average winnings from that many chips.
Probability dictates that the chips should finish in slots that are closer to the initial slot more often than otherwise. So the average winnings for each slot for large numbers of chips should be different. My code is giving me very close values for average winnings regardless of the initial slot, which is an error, but I have no idea where it might be found.
Anyone have any insights?
Note that there are a few inefficient coding practices here that are mostly due to the fact that my instructors don't like people writing with more advanced tools than they've taught us, so please forgive any annoyances that might cause.
Code is split up over the next two comments since it and my intro are too long for a single submission, apparently.