summaryrefslogtreecommitdiff
path: root/src/solvers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/solvers.rs')
-rw-r--r--src/solvers.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/solvers.rs b/src/solvers.rs
index 9bf0ad6..ce5568c 100644
--- a/src/solvers.rs
+++ b/src/solvers.rs
@@ -32,20 +32,18 @@ impl Wall {
pub fn output(&self, n: u32, h: u32) {
let mut stones = vec![0; n as usize];
+ let mut toggle = 0;
+ let colors = ["\x1b[31m", "\x1b[32m", "\x1b[33m", "\x1b[34m", "\x1b[35m", "\x1b[36m"];
for row in 0..h {
self.calculate_row(row, &mut stones);
for &len in stones.iter() {
- if len <= 1 {
- print!("◼");
- } else if len > 1 {
- print!("◢");
- for _ in 0..(len - 2) {
- print!("◼");
- }
- print!("◣");
+ print!("{}", colors[toggle]);
+ toggle = (toggle + 1) % colors.len();
+ for _ in 0..len {
+ print!("█");
}
}
- println!("");
+ println!("\x1b[m");
}
}
}