rem: box.appendChild(this.__makePile(ch)); 
add: var type = {p:"pile", f:"foundation", c:"cell", r:"reserve", w:"waste", s:"stock"}[ch]; var obj1 = this[type + "Type"]; var obj2 = this[type + "Layout"]; var arry = this.pilesByType[ch]; box.appendChild(this.__makePile(type, obj1, obj2, arry)); break;  case "a": var obj1 = this.aceFoundationType, obj2 = this.foundationLayout, arry = this.pilesByType["f"]; box.appendChild(this.__makePile("foundation", obj1, obj2, arry)); break; case "k": var obj1 = this.kingFoundationType, obj2 = this.foundationLayout, arry = this.pilesByType["f"]; box.appendChild(this.__makePile("foundation", obj1, obj2, arry)); 
context:   _buildLayout: function(container, nextBoxVertical, template) {    var box = container;    var newbox, p;    var allpiles = this.allpiles;    function startBox(type, className) {      newbox = document.createElement(type);      newbox.className = className;      box.appendChild(newbox);      box = newbox;    }    const len = template.length;    // first char is "h"/"v", not of interest here    for(var i = 1; i != len; ++i) {      var ch = template[i];      switch(ch) {      // start a box        case "[": // in opposite direction          startBox(nextBoxVertical ? "vbox" : "hbox", "");          nextBoxVertical = !nextBoxVertical;          break;        case "`": // in current direction (used by Fan)          startBox(nextBoxVertical ? "hbox" : "vbox", "");          break;        case "(":          startBox("vbox", "pyramid-rows"); break;        case "<":          startBox("hbox", "pyramid-row"); break;      // finish a box        case "]":          nextBoxVertical = !nextBoxVertical;          // fall through        case ">":        case ")":        case "'":          box = box.parentNode;          break;      // annotations: "{attrname=val}", applies to most-recent pile or box        case "{":          var i0 = i;          while(template[i] != "}") ++i;          var blob = template.substring(i0 + 1, i).split("=");          (box.lastChild || box).setAttribute(blob[0], blob[1]);          break;        case "}":          throw "BaseCardGame._buildLayout: reached a } in template (without a { first)";      // add piles        case "p":        case "f":        case "c":        case "r":        case "w":        case "s":          box.appendChild(this.__makePile(ch));          break;      // add a label (always for the stock, at present)        case "l":          var counter = document.createElement("label");          counter.className = "stockcounter";          box.appendChild(counter);          var s = this.stock;          s._counter = counter;          s.__defineGetter__("counter", function() { return this._counter._value; });          s.__defineSetter__("counter", function(val) {            const c = this._counter; return c.value = c._value = val; });          break;      // add spaces        case "-":          box.appendChild(document.createElement("halfpilespacer")); break;        case "+":        case "#":          p = document.createElement("pilespacer");          p.className = this.pilespacerClass;          box.appendChild(p);          break;        case " ":          box.appendChild(document.createElement("space")); break;        case "1":          box.appendChild(document.createElement("flex")); break;        case "2":        case "3":        case "4":        case "5":          box.appendChild(document.createElement("flex" + ch)); break;        default:          throw ("BaseCardGame.buildLayout: strange char found: " + ch);      }    }    // sanity check    if(box != container) throw "BaseCardGame._buildLayout: layout had unclosed box";  },
meta: 3385	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/3385/76838ffa1935fcad7cf2820100d0854425857cb8/cardgame.js/buggy/cardgame.js