pattern code