redesign algorithm (end last line with end line)

fix:
003☑☑
003☑☑☑☑☑☑☑☑☑☑☐☑☑☑☑☑☑☑☑☑☑
003☑☑☑☑☑☑☑☑☑☑☒☑☑☑☑☑☑☑☑☑☑