public c_map_node(int risk, int r, int c) { is_on_best_path = false; risk_level = risk; row = r; column = c; direction_to_end = e_map_direction.unknown; }
public void add_outgoing(e_map_direction direction) { switch (direction) { case e_map_direction.up: up = true; break; case e_map_direction.down: down = true; break; case e_map_direction.left: left = true; break; case e_map_direction.right: right = true; break; } }
public bool consider_neighbor(e_map_direction direction, c_map_node other) { if (direction_to_end != e_map_direction.end) { int total_risk_to_end_through_other = other.total_risk_to_end + other.risk_level; if (direction_to_end == e_map_direction.unknown || total_risk_to_end_through_other < total_risk_to_end) { total_risk_to_end = total_risk_to_end_through_other; direction_to_end = direction; return(true); } } return(false); }
public void mark_end() { total_risk_to_end = 0; direction_to_end = e_map_direction.end; is_on_best_path = true; }