aboutsummaryrefslogtreecommitdiffstats
path: root/planning/planning.cpp
diff options
context:
space:
mode:
authorSteinar H. Gunderson <sgunderson@bigfoot.com>2014-04-11 01:18:18 +0200
committerSteinar H. Gunderson <sgunderson@bigfoot.com>2014-04-11 01:18:18 +0200
commitb51c4c51dede657dd76a1bb7901e3168247da603 (patch)
tree32207314f23e1d990f3f77d55e321a7aea5dab19 /planning/planning.cpp
parentc2e877bbc91df29185fbf3a81b4a76f014a7cfb3 (diff)
Refuse to pull cable between Game and Sector 8.
Diffstat (limited to 'planning/planning.cpp')
-rw-r--r--planning/planning.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/planning/planning.cpp b/planning/planning.cpp
index f39e8e0..b36f4ba 100644
--- a/planning/planning.cpp
+++ b/planning/planning.cpp
@@ -46,7 +46,7 @@ struct Switch {
};
struct Inventory {
- Inventory() : num_10m(0), num_30m(0), num_50m(0), extensions(0), horiz_gap_crossings(0) {}
+ Inventory() : num_10m(0), num_30m(0), num_50m(0), extensions(0), horiz_gap_crossings(0), vert_chasm_crossings(0) {}
Inventory& operator+= (const Inventory& other)
{
@@ -55,6 +55,7 @@ struct Inventory {
this->num_50m += other.num_50m;
this->extensions += other.extensions;
this->horiz_gap_crossings += other.horiz_gap_crossings;
+ this->vert_chasm_crossings += other.vert_chasm_crossings;
return *this;
}
@@ -88,7 +89,7 @@ struct Inventory {
}
unsigned num_10m, num_30m, num_50m;
- unsigned extensions, horiz_gap_crossings;
+ unsigned extensions, horiz_gap_crossings, vert_chasm_crossings;
};
// Data structures for flow algorithm.
@@ -218,6 +219,11 @@ Inventory Planner::find_inventory(Switch from_where, unsigned distro)
inv.horiz_gap_crossings = 1;
}
+ // The gap between Game and Sector 8 is unsurmountable.
+ if ((abs(distro_placements[distro]) <= 5) == (from_where.row >= 6)) {
+ inv.vert_chasm_crossings = 1;
+ }
+
return inv;
}
@@ -246,6 +252,9 @@ unsigned Planner::find_cost(Switch from_where, unsigned distro)
cost += HORIZ_GAP_COST * inv.horiz_gap_crossings;
}
+ // Also, the gap between Game and Sector 8 is unsurmountable.
+ cost += _INF * inv.vert_chasm_crossings;
+
return cost;
}