From ef2936f2390cb44af811daada625e7d9abf4486a Mon Sep 17 00:00:00 2001 From: natrixaeria Date: Fri, 20 Dec 2019 06:47:23 +0100 Subject: Add a `from_heights` function to `Wall` --- src/solvers.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/solvers.rs') diff --git a/src/solvers.rs b/src/solvers.rs index 24b7e2c..669fb6e 100644 --- a/src/solvers.rs +++ b/src/solvers.rs @@ -3,6 +3,10 @@ pub struct Wall { } impl Wall { + pub fn from_heights(heights: Vec) -> Self { + Self { heights } + } + fn create_empty(w: u32) -> Self { let heights = if w == 0 { vec![] @@ -14,7 +18,6 @@ impl Wall { v.push(1); v }; - let heights = vec![0, 1, 0, 2, 1, 0, 2, 2, 1]; Self { heights } } -- cgit v1.2.3-54-g00ecf