-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiceCode
More file actions
40 lines (32 loc) · 732 Bytes
/
DiceCode
File metadata and controls
40 lines (32 loc) · 732 Bytes
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
import java.util.Scanner;
public class DiceCode
{
Cave_Jungle startgame = new Cave_Jungle();
Path_Menu path = new Path_Menu();
String Roller;
public String RollDice() //Dice code to determine chance of success
{
String resp2;
char Response2;
System.out.println("\s(R)oll your fate");
do
{
Scanner input3 = new Scanner(System.in);
resp2 = input3.next();
Response2 = resp2.charAt(0);
if(Response2 == 'R' || Response2 == 'r')
{
Roller = (int)(Math.random()*10+1);
if(Roller%2 == 0)
{
return "Success";
}
else
{
return "Fail";
}
}
}while(Response2 != 'R' || Response2 != 'r');
return "Fail";
}
}