diff options
author | Nicholas Johnson <nick@nicholasjohnson.ch> | 2024-04-20 00:00:00 +0000 |
---|---|---|
committer | Nicholas Johnson <nick@nicholasjohnson.ch> | 2024-04-20 00:00:00 +0000 |
commit | 921879a6589ad457b19cd18eac1ffbb38470fa972b96ba31838da1d6dc13fd58 (patch) | |
tree | cf0b2a19e69b0f063c3b19dbdf0ee6ecc1a6453cd31ea89a9bbba3d0549c8247 /src | |
parent | 76b89fb7ea9fed087ea56abe7c0f735a38e1d5d8444ce2ffc42d8cde58a1929f (diff) | |
download | hitomezashi-rs-921879a6589ad457b19cd18eac1ffbb38470fa972b96ba31838da1d6dc13fd58.tar.gz hitomezashi-rs-921879a6589ad457b19cd18eac1ffbb38470fa972b96ba31838da1d6dc13fd58.zip |
Make first line init logic easier to read
Diffstat (limited to 'src')
-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 |