[Turn on line numbering]arg left, right; var x, str, out, cards, last; left = .break_cards(left); right = .break_cards(right); if (left[2].length() != right[2].length()) throw(~invrel, "Left side cards differ from the right side."); str = ""; for x in (left[1]) { if (type(x) == 'string) str += x; else if (str && str[strlen(str)] == "*") str += " *"; else str += "*"; } // and now for some sanity... cards = #[]; for x in (left[2]) { if (x != last + 1) throw(~invcard, "Left side cards are not in sequence (%" + x + " before %" + (x - 1) + ")."); last = x; cards = dict_add(cards, x, 1); } // move to the right side out = [str, @left]; str = ""; for x in (right[1]) { if (type(x) == 'string) str += x; else str += "*"; } // final sanity check... for x in (right[2]) { if (!dict_contains(cards, x)) throw(~invcard, "Card %" + x + " does not exist on the left side!"); } // good... return [out, [str, @right]];
// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit