All pastes #285405 Raw Edit

Miscellany

public text v1 · immutable
#285405 ·published 2006-12-19 20:35 UTC
rendered paste body
import java.util.Random;

public class Roulette {

	public static void main(String[] args) {
		int money = 10000;
		for (int x = 0; x < 12; x++) {
			Random gen = new Random();
			int r = gen.nextInt(49);
			Random gen2 = new Random();
			int r2 = gen2.nextInt(2);
			if (r % 2 == 0) {
				// Even
				money = (money - 100);
				// Bet = $100
			} else {
				money = (money + 100);
			}
			if (r2 == 0) {
				// Black
				money = (money - 100);

			} else {
				// Red
				money = (money + 100);
			}
			System.out.println("Your Money:" + money);
		}

	}
}

// <[twisti]> make a roulette 'game'
// <[twisti]> let it run 100 times or so
// <[twisti]> make it red/black
// <[twisti]> random number from 0 to 49 (i think ?)
// <[twisti]> if its 0, you lose
// <[twisti]> if its even, you lose
// <[twisti]> if its odd, you win
// <[twisti]> and double your money
// <[twisti]> then when you have that working
// <[twisti]> make it run a dozen times