示例#1
0
文件: Day_15.cs 项目: LEPT0N/toybox
 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;
 }
示例#2
0
文件: Day_15.cs 项目: LEPT0N/toybox
            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;
                }
            }
示例#3
0
文件: Day_15.cs 项目: LEPT0N/toybox
            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);
            }
示例#4
0
文件: Day_15.cs 项目: LEPT0N/toybox
 public void mark_end()
 {
     total_risk_to_end = 0;
     direction_to_end  = e_map_direction.end;
     is_on_best_path   = true;
 }