The “Perch” is a roulette betting strategy based on ignorance of the “Gambler’s Fallacy”: the gambler perches in a position where they can monitor all roulette tables; when a roulette table has had a run of red or black for the past four spins, the gambler places the minimum £10 bet on the opposite colour, reasoning that a run of five of the same colour is unlikely (the “Gambler’s Fallacy”, as the probability of the fifth spin landing on a given colour is the same as the first spin landing on a given colour); if the bet fails and the run of the colour continues, the gambler reasons that the odds of six in a row are even more unlikely, and increases their original bet by 50%; if that bet too fails, the gambler returns to the perch; the strategy ends when the gambler has either achieved their target winnings, or has insufficient money to place the £10 minimum bet.
Anyway, this {source code & compiled:Mac OS pre-X} is my solution for the fifth Programming Praxis held by The Daily WTF: a program to play roulette using the “Perch” strategy, with a user-entered number of roulette tables, starting amount of money, and target amount of money; the program ends when it has either achieved the target amount of money or has insufficient money to place the minimum £10 bet.
The solution was developed on an Apple Power Macintosh 8100 in C compiled with Metrowerks CodeWarrior IDE 2.1 (Discover Programming Edition.)