Advertisement
Yuvalxp8

Check For Matching Dominos MAIN

May 4th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. package defult;
  2.  
  3. import java.util.*;
  4.  
  5. public class DominMain
  6. {
  7.  
  8.     public static void main(String[] args)
  9.     {
  10.         boolean takin;
  11.         Domino[] a = new Domino[10];
  12.        
  13.         for(int i = 0 ; i < a.length ; i ++)
  14.         {
  15.             a[i] = new Domino();
  16.         }
  17.        
  18.         for(int i = 0 ; i < a.length ; i++)
  19.         {
  20.             a[i].toString();
  21.         }
  22.        
  23.         for(int i = 0 ; i < a.length-1 ; i ++)
  24.         {
  25.             takin = false;
  26.             if (a[i].getX() == a[i+1].getX() || a[i].getX() == a[i+1].getY() || a[i].getY() == a[i+1].getX() || a[i].getY() == a[i+1].getY())
  27.             {
  28.                 takin = true;
  29.                 System.out.println("Takin: " + "[" + a[i].toString() + "]" + "|" + "[" + a[i+1].toString() + "]"); 
  30.             }
  31.             else System.out.println("Lo Takin: " + "[" + a[i].toString() + "]" + "|" + "[" + a[i+1].toString() + "]"); 
  32.         }
  33.            
  34.         }
  35.        
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement