Ball and Chain code