about summary refs log tree commit diff
path: root/src/level_gen/display.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/level_gen/display.rs')
-rw-r--r--src/level_gen/display.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/level_gen/display.rs b/src/level_gen/display.rs
new file mode 100644
index 000000000000..4472bf4fe392
--- /dev/null
+++ b/src/level_gen/display.rs
@@ -0,0 +1,17 @@
+use std::io::{self, Write};
+
+pub fn print_generated_level<W>(
+    level: &Vec<Vec<bool>>,
+    out: &mut W,
+) -> io::Result<()>
+where
+    W: Write,
+{
+    for row in level {
+        for cell in row {
+            write!(out, "{}", if *cell { "X" } else { " " })?;
+        }
+        write!(out, "\n")?;
+    }
+    Ok(())
+}