tile comparison logic using arrays