-
Notifications
You must be signed in to change notification settings - Fork 0
/
Roulette Game
47 lines (35 loc) · 1.26 KB
/
Roulette Game
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
import java.util.Scanner;
public class Roulette {
static int starting_money = 100;
static int bet;
public static void main(String[] args) {
Scanner place_bet = new Scanner(System.in);
System.out.println("Hello and Welcome to the game LOSE YOUR MONEY TONIGHT!");
System.out.println("You Start the game with 100 euros");
while (starting_money > 0) {
//player inputs his bet
System.out.println("Please Place Your Bet:");
bet = place_bet.nextInt();
while (bet > starting_money) {
System.out.println("You cant bet more than you've got,pal");
bet = place_bet.nextInt();
}
// player inputs the number he bets on
Scanner reader = new Scanner(System.in);
System.out.println("Please Choose a number to bet on:");
int number = reader.nextInt();
// RNG spin number
int spin_number = (int) (Math.random() * ((36 - 0) + 1));
System.out.println("Time to spin");
System.out.println("The spin is " + spin_number);
if (spin_number == number) {
starting_money = starting_money * 4;
System.out.println("Your new balance is" + (starting_money));
} else {
starting_money = starting_money - bet;
System.out.println("You lost the bet");
System.out.println("You now have" + starting_money + "euros");
}
}
}
}