created a new function to compute tile color