graph.js
function goDown(arrStartUnits){
		conn.query(
			"SELECT unit, level, latest_included_mc_index, main_chain_index, is_on_main_chain \n\
			FROM parenthoods JOIN units ON child_unit=unit \n\
			WHERE parent_unit IN(?) AND latest_included_mc_index<? AND level<=?",
			[arrStartUnits, objEarlierUnitProps.main_chain_index, max_later_level],
			function(rows){
				var arrNewStartUnits = [];
				for (var i=0; i<rows.length; i++){
					var objUnitProps = rows[i];
					//if (objUnitProps.latest_included_mc_index >= objEarlierUnitProps.main_chain_index)
					//    continue;
					//if (objUnitProps.level > max_later_level)
					//    continue;
					arrNewStartUnits.push(objUnitProps.unit);
					if (objUnitProps.main_chain_index !== null && objUnitProps.main_chain_index <= max_later_limci) // exclude free balls!
						arrLandedUnits.push(objUnitProps.unit);
					else
						arrUnlandedUnits.push(objUnitProps.unit);
				}
				(arrNewStartUnits.length > 0) ? goDown(arrNewStartUnits) : handleUnits(arrLandedUnits, arrUnlandedUnits);
			}
		);
	}
function goDown(arrStartUnits){
		conn.query(
			"SELECT unit, level, latest_included_mc_index, main_chain_index, is_on_main_chain \n\
			FROM parenthoods JOIN units ON child_unit=unit \n\
			WHERE parent_unit IN(?) AND latest_included_mc_index<? AND level<=?",
			[arrStartUnits, objEarlierUnitProps.main_chain_index, max_later_level],
			function(rows){
				var arrNewStartUnits = [];
				for (var i=0; i<rows.length; i++){
					var objUnitProps = rows[i];
					//if (objUnitProps.latest_included_mc_index >= objEarlierUnitProps.main_chain_index)
					//    continue;
					//if (objUnitProps.level > max_later_level)
					//    continue;
					arrNewStartUnits.push(objUnitProps.unit);
					if (objUnitProps.main_chain_index !== null && objUnitProps.main_chain_index <= max_later_limci) // exclude free balls!
						arrLandedUnits.push(objUnitProps.unit);
					else
						arrUnlandedUnits.push(objUnitProps.unit);
				}
				(arrNewStartUnits.length > 0) ? goDown(arrNewStartUnits) : handleUnits(arrLandedUnits, arrUnlandedUnits);
			}
		);
	}
function goDown ( arrStartUnits ) { conn . query ( "SELECT unit, level, latest_included_mc_index, main_chain_index, is_on_main_chain \n\
			FROM parenthoods JOIN units ON child_unit=unit \n\
			WHERE parent_unit IN(?) AND latest_included_mc_index<? AND level<=?" , [ arrStartUnits , objEarlierUnitProps . main_chain_index , max_later_level ] , function ( rows ) { var arrNewStartUnits = [ ] ; for ( var i = 0 ; i < rows . length ; i ++ ) { var objUnitProps = rows [ i ] ; //if (objUnitProps.latest_included_mc_index >= objEarlierUnitProps.main_chain_index) //    continue; //if (objUnitProps.level > max_later_level) //    continue; arrNewStartUnits . push ( objUnitProps . unit ) ; if ( objUnitProps . main_chain_index !== null && objUnitProps . main_chain_index <= max_later_limci ) // exclude free balls! arrLandedUnits . push ( objUnitProps . unit ) ; else arrUnlandedUnits . push ( objUnitProps . unit ) ; } ( arrNewStartUnits . length > 0 ) ? goDown ( arrNewStartUnits ) : handleUnits ( arrLandedUnits , arrUnlandedUnits ) ; } ) ; }
direct shoots to later units, without touching the MC
direct shoots to later units without touching the MC