Advertisement
Guest User

Untitled

a guest
Nov 13th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function hasMatch():Boolean {
  2.     var currentCellType = getType(i, j);
  3.    
  4.     for (var i:int = 0; i < 5; i++) {
  5.         for (var j:int = 0; j < 5; j++) {
  6.        
  7.             if (i > 0) {
  8.                 var nextCellType = getType(i + 2, j);
  9.                 var hasHorizontalMatch:Boolean = nextCellType == currentCellType;
  10.                 if (hasHorizontalMatch && getType(i + 1) == currentCellType) {
  11.                     return true;
  12.                 }
  13.             }
  14.            
  15.             if (i < 5) {
  16.                 nextCellType = getType(i - 2, j);
  17.                 hasHorizontalMatch = nextCellType == currentCellType;
  18.                
  19.                 if (hasHorizontalMatch && getType(i - 1) == currentCellType) {
  20.                     return true;
  21.                 }
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement