tile logic