finish the coding of circular pattern