Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- public class MainClass {
- public static void main(String[] args) {
- int sum = 0;
- int number = 0;
- int places[][] = new int[27][6];
- for (int i = 0; i < 26; i++) {
- for (int k = 0; k < 6; k++) {
- Random r = new Random();
- number = r.nextInt(3) + 1;
- Scanner sc = new Scanner(System.in);
- while(!sc.nextLine().equals(""));
- sum += number;
- System.out.println(number);
- if (sum > 156) {
- sum -= number;
- }
- if(number==1){
- int h=0;
- for(int m=0;m<i;m++){
- for(int n=0;n<k;n++){
- if(places[m][n]==0){
- places[m][n]=1;
- h=1;
- }
- }
- }
- if(h==0){
- places[i][k]=1;
- }
- }
- if(number==2){
- int h=0;
- for(int m=0;m<(i-1);m++){
- for(int n=0;n<(k-1);n++){
- if(places[m][n]==0){
- places[m][n]=1;
- places[m][n+1]=1;
- h=1;
- }
- }
- }
- if(h==0){
- if(k==2){
- places[i][3]=1;
- places[i][4]=1;
- }else if(k==5){
- places[i+1][0]=1;
- places[i+1][1]=1;
- }else{
- places[i][k]=1;
- places[i][k+1]=1;
- }
- }
- }
- if(number==3){
- if((k==0)||(k==3)){
- places[i][k]=1;
- places[i][k+1]=1;
- places[i][k+2]=1;
- }
- }
- }
- }
- for (int i = 0; i < 26; i++) {
- for (int k = 0; k < 6; k++) {
- System.out.print(places[i][k]);
- if (k==2){
- System.out.print(" ");
- }
- }
- System.out.println();
- }
- }
- }
Add Comment
Please, Sign In to add comment