diff options
-rw-r--r-- | src/hitomezashi.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hitomezashi.rs b/src/hitomezashi.rs index 02baff7..2b1e9ea 100644 --- a/src/hitomezashi.rs +++ b/src/hitomezashi.rs @@ -63,16 +63,16 @@ pub fn hitomezashi(width: usize, height: usize, skew: Option<f64>) { let mut above_bits: Vec<bool> = Vec::with_capacity(width); above_bits.push(init_bit); - print_square(above_bits[0]); - for col in 1..width { + for col in 0..(width - 1) { /* each square in the first row is derived from the square to its left. the column bits * represent whether there's a stitch between the two squares. if there's a stitch, the squares * are different, otherwise they are the same. */ - above_bits.push(above_bits[col - 1] ^ col_bits[col - 1]); print_square(above_bits[col]); + above_bits.push(above_bits[col] ^ col_bits[col]); } + print_square(above_bits[width - 1]); println!(); // height-1 because the first row has already been printed |