Collectively intelligent bricks figure out if they’re in a boat, chair or guitar