Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class Roll20
- {
- public static void main(String[] args)
- {
- int[] success=new int[Integer.parseInt(System.getenv("COLUMNS"))];
- int max=Integer.parseInt(System.getenv("LINES"))-1;
- Random rand=new Random();
- boolean donezo=false;
- while (!donezo)
- {
- int roll=0;
- while (rand.nextInt(20)!=0) roll++;
- if (roll<success.length)
- {
- success[roll]++;
- if (success[roll]==max) donezo=true;
- }
- }
- for (int row=max; row>0; row--)
- for (int x=0; x<success.length; x++)
- System.out.print(row<=success[x]?"X":" ");
- }
- }
Add Comment
Please, Sign In to add comment