rem: var i, pile; var parent = card.parentNode; var piles = parent.isNormalPile ? this.getPilesRound(parent) : this.stacks;  for(i = 0; i < piles.length; i++) { pile = piles[i]; if(stack.hasChildNodes() && this.canMoveToPile(card,pile)) return pile; }  for(i = 0; i < piles.length; i++) { pile = piles[i]; if(!stack.hasChildNodes() && this.canMoveToPile(card,pile)) return pile; }  if(parent.isFoundation) return null; for(i = 0; i < 4; i++) { pile = this.foundations[i]; if(this.canMoveToFoundation(card,pile)) return pile; } return null; 
add: var piles = card.parentNode.isNormalPile ? getPilesRound(card.parentNode) : this.stacks; return searchPiles(piles, testCanMoveToNonEmptyPile(card)) || searchPiles(piles, testPileIsEmpty) || searchPiles(this.foundations, testCanMoveToFoundation(card)); 
context:   getBestMoveForCard: function(card) {    var i, pile;    var parent = card.parentNode;    var piles = parent.isNormalPile ? this.getPilesRound(parent) : this.stacks;    // move to non-empty pile    for(i = 0; i < piles.length; i++) {      pile = piles[i];      if(stack.hasChildNodes() && this.canMoveToPile(card,pile)) return pile;    }    // move to an empty pile    for(i = 0; i < piles.length; i++) {      pile = piles[i];      if(!stack.hasChildNodes() && this.canMoveToPile(card,pile)) return pile;    }    // move to foundations    if(parent.isFoundation) return null;    for(i = 0; i < 4; i++) {      pile = this.foundations[i];      if(this.canMoveToFoundation(card,pile)) return pile;    }    return null;  },
meta: 3385	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/3385/16cf1285aa3c691e959e2aabb4cbf0501cad4a97/canfield.js/clean/canfield.js