aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicholas Johnson <nick@nicholasjohnson.ch>2024-04-20 00:00:00 +0000
committerNicholas Johnson <nick@nicholasjohnson.ch>2024-04-20 00:00:00 +0000
commite3946801ed3c1068077be169f04770c8b38a00b66399172837e7e0b60f065e3d (patch)
treef218be18d29d1531ac2181d67673f2e5dad7c1187ae6bcb55a82dabf828c7301 /src
parent50ba16d9f8d69103b2343424ff6b7e9835d8c318393359573eeb1d8049189aee (diff)
downloadhitomezashi-rs-e3946801ed3c1068077be169f04770c8b38a00b66399172837e7e0b60f065e3d.tar.gz
hitomezashi-rs-e3946801ed3c1068077be169f04770c8b38a00b66399172837e7e0b60f065e3d.zip
Make alt_bits initialization more explicit
Diffstat (limited to 'src')
-rw-r--r--src/hitomezashi.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/hitomezashi.rs b/src/hitomezashi.rs
index b39cace..6fb785e 100644
--- a/src/hitomezashi.rs
+++ b/src/hitomezashi.rs
@@ -55,8 +55,10 @@ pub fn hitomezashi(width: usize, height: usize, skew: Option<f64>) {
let mut alt_bits: Vec<bool> = Vec::with_capacity(width);
- for col in 0..alt_bits.capacity() {
- alt_bits.push(col % 2 == 1);
+ let mut alternator: bool = false;
+ for _ in 0..alt_bits.capacity() {
+ alt_bits.push(alternator);
+ alternator = !alternator;
}
// each new row of the pattern depends on the bits directly above it