Program: 35752
Project: 35752
Buggy source:
/** 
 * Determines whether the sepcified coordinates are an acceptable location for a wire to be placed. A location is acceptable if all of the following are true: - The location is inside the buffer, above the bottom level. - The location is not a wire in the frontier node's path. - The location is empty. - The location below is empty and safe to place a block, or it contains a block that redstone wire can be placed on. - Any adjacent wire or repeater is the parent wire (this includes blocks above or below in certain cases). - There's a clear signal from the parent wire to the location.
 */
private boolean canPlaceWire(BlockBuffer buffer,Net net,Node node,Net.Terminal dest,int x,int y,int z){
  if (!buffer.isInRange(x,y,z) || y == 0) {
    return false;
  }
 else   if (isInPath(node,x,y,z,true,true)) {
    return false;
  }
 else   if (buffer.getBlock(x,y,z).block != Blocks.air && !isDest(x,y,z,buffer,net,dest)) {
    return false;
  }
  Block blockBelow=buffer.getBlock(x,y - 1,z).block;
  if (blockBelow != Blocks.air && !isPlaceableSurface(blockBelow)) {
    log("String_Node_Str");
    return false;
  }
 else   if (y == 1) {
  }
 else {
    Block blockBelowBelow=buffer.getBlock(x,y - 2,z).block;
    if (blockBelowBelow == Blocks.redstone_torch || blockBelowBelow == Blocks.unlit_redstone_torch) {
      log("String_Node_Str");
      return false;
    }
 else     if (blockBelowBelow == Blocks.redstone_wire || isInPath(node,x,y - 2,z,false,false)) {
      return false;
    }
  }
  Block blockAbove=buffer.getBlock(x,y + 1,z).block;
  log("String_Node_Str" + getCoordText(x,y,z) + "String_Node_Str"+ getCoordText(node.wire.x,node.wire.y,node.wire.z));
  boolean foundParent=false;
  for (int i=0; i < 4; i++) {
    int x2=x;
    int z2=z;
switch (i) {
case 0:
      x2++;
    break;
case 1:
  x2--;
break;
case 2:
z2--;
break;
case 3:
z2++;
break;
}
log("String_Node_Str" + getCoordText(x2,y,z2));
if (!buffer.isInRange(x2,y,z2)) {
continue;
}
Block blockAdj=buffer.getBlock(x2,y,z2).block;
boolean destFound=isDest(x2,y,z2,buffer,net,dest);
if (blockAdj == Blocks.air) {
if (node.wire.x == x2 && node.wire.y == y && node.wire.z == z2) {
foundParent=true;
}
 else {
Block blockBelowAdj=buffer.getBlock(x2,y - 1,z2).block;
if (blockBelowAdj == Blocks.redstone_wire) {
return false;
}
 else if (node.wire.x == x2 && node.wire.y == y - 1 && node.wire.z == z2) {
foundParent=true;
}
}
}
 else if (blockAdj == Blocks.redstone_wire || blockAdj == Blocks.powered_repeater || blockAdj == Blocks.unpowered_repeater) {
log("String_Node_Str");
return false;
}
 else if (blockAdj == Blocks.redstone_torch || blockAdj == Blocks.unlit_redstone_torch || blockAdj == Blocks.powered_comparator || blockAdj == Blocks.unpowered_comparator) {
log("String_Node_Str");
return false;
}
 else if (isPlaceableSurface(blockAdj)) {
if (blockAbove == Blocks.air) {
Block blockAboveAdj=buffer.getBlock(x2,y + 1,z2).block;
if (blockAboveAdj == Blocks.redstone_wire) {
return false;
}
 else if (node.wire.x == x2 && node.wire.y == y + 1 && node.wire.z == z2) {
foundParent=true;
}
}
}
}
if (!foundParent) {
return false;
}
log("String_Node_Str" + getCoordText(x,y,z) + "String_Node_Str");
return true;
}

Fixed version (ground truth):
/** 
 * Determines whether the sepcified coordinates are an acceptable location for a wire to be placed. A location is acceptable if all of the following are true: - The location is inside the buffer, above the bottom level. - The location is not a wire in the frontier node's path. - The location is empty. - The location below is empty and safe to place a block, or it contains a block that redstone wire can be placed on. - Any adjacent wire or repeater is the parent wire (this includes blocks above or below in certain cases). - There's a clear signal from the parent wire to the location.
 */
private boolean canPlaceWire(BlockBuffer buffer,Net net,Node node,Net.Terminal dest,int x,int y,int z){
  if (!buffer.isInRange(x,y,z) || y == 0) {
    return false;
  }
 else   if (isInPath(node,x,y,z,true,true)) {
    return false;
  }
 else   if (buffer.getBlock(x,y,z).block != Blocks.air && !isDest(x,y,z,buffer,net,dest)) {
    return false;
  }
  Block blockBelow=buffer.getBlock(x,y - 1,z).block;
  if (blockBelow != Blocks.air && !isPlaceableSurface(blockBelow)) {
    log("String_Node_Str");
    return false;
  }
 else   if (y == 1) {
  }
 else {
    Block blockBelowBelow=buffer.getBlock(x,y - 2,z).block;
    if (blockBelowBelow == Blocks.redstone_torch || blockBelowBelow == Blocks.unlit_redstone_torch) {
      log("String_Node_Str");
      return false;
    }
 else     if (blockBelowBelow == Blocks.redstone_wire || isInPath(node,x,y - 2,z,false,false)) {
      return false;
    }
  }
  Block blockAbove=buffer.getBlock(x,y + 1,z).block;
  log("String_Node_Str" + getCoordText(x,y,z) + "String_Node_Str"+ getCoordText(node.wire.x,node.wire.y,node.wire.z));
  boolean foundParent=false;
  for (int i=0; i < 4; i++) {
    int x2=x;
    int z2=z;
switch (i) {
case 0:
      x2++;
    break;
case 1:
  x2--;
break;
case 2:
z2--;
break;
case 3:
z2++;
break;
}
log("String_Node_Str" + getCoordText(x2,y,z2));
if (!buffer.isInRange(x2,y,z2)) {
continue;
}
Block blockAdj=buffer.getBlock(x2,y,z2).block;
if (blockAdj == Blocks.air) {
if (node.wire.x == x2 && node.wire.y == y && node.wire.z == z2) {
foundParent=true;
}
 else {
Block blockBelowAdj=buffer.getBlock(x2,y - 1,z2).block;
if (blockBelowAdj == Blocks.redstone_wire) {
return false;
}
 else if (node.wire.x == x2 && node.wire.y == y - 1 && node.wire.z == z2) {
foundParent=true;
}
Block blockAboveAdj=buffer.getBlock(x2,y - 1,z2).block;
if (node.wire.x == x2 && node.wire.y == y - 1 && node.wire.z == z2) {
foundParent=true;
}
}
}
 else if (blockAdj == Blocks.redstone_wire || blockAdj == Blocks.powered_repeater || blockAdj == Blocks.unpowered_repeater) {
log("String_Node_Str");
return false;
}
 else if (blockAdj == Blocks.redstone_torch || blockAdj == Blocks.unlit_redstone_torch || blockAdj == Blocks.powered_comparator || blockAdj == Blocks.unpowered_comparator) {
log("String_Node_Str");
return false;
}
 else if (isPlaceableSurface(blockAdj)) {
if (blockAbove == Blocks.air) {
Block blockAboveAdj=buffer.getBlock(x2,y + 1,z2).block;
if (blockAboveAdj == Blocks.redstone_wire) {
return false;
}
 else if (node.wire.x == x2 && node.wire.y == y + 1 && node.wire.z == z2) {
foundParent=true;
}
}
}
}
if (!foundParent) {
return false;
}
log("String_Node_Str" + getCoordText(x,y,z) + "String_Node_Str");
return true;
}