Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class tagil1
- {
- public static void main(String[] args){
- int[] arr = new int[30];
- Scanner in = new Scanner(System.in);
- for( int i= 0; i<1; i++){
- int rnd = (int)(Math.random()*29+1);
- arr[rnd] = 1;
- }
- int place = 0;
- while(place<30){
- int cube = (int)(Math.random()*6+1);
- System.out.println("cube: "+cube);
- place += cube;
- if(place < 30){
- if (arr[place] == 1){
- place =30;
- System.out.println("you died");
- }
- else if (place>=30){
- System.out.println("you win");
- }
- else{
- System.out.println("your place is: " + place);
- }
- }
- else System.out.println("you win");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement