|
@@ -23,7 +23,7 @@ fn main() {
|
|
|
|
|
|
let get_cell = |x: usize, y: usize| {
|
|
|
let idx = x + y * rows;
|
|
|
- MAP[idx]
|
|
|
+ MAP.get(idx)
|
|
|
};
|
|
|
|
|
|
for (x, y) in iproduct!(0..rows-1, 0..cols-1) {
|
|
@@ -31,7 +31,9 @@ fn main() {
|
|
|
let yc = y_offset + y as f64 * N;
|
|
|
let d = N / 5.0;
|
|
|
let cs = N / 10.0;
|
|
|
- if get_cell(x, y) != get_cell(x + 1, y) {
|
|
|
+ if get_cell(x, y)
|
|
|
+ .and_then(|l| get_cell(x + 1, y)
|
|
|
+ .and_then(|r| l != r)).unwrap_or(false) {
|
|
|
drawing.add(gt::line(xc+N, yc).to(xc+N, yc+N));
|
|
|
|
|
|
let xt = if get_cell(x, y) == '0' as u8 {
|
|
@@ -44,7 +46,7 @@ fn main() {
|
|
|
drawing.add(gt::line(xc+N, yt).to(xt, yt));
|
|
|
}
|
|
|
|
|
|
- } else if get_cell(x, y) == '1' as u8 {
|
|
|
+ } else if get_cell(x, y).unwrap() == '1' as u8 {
|
|
|
for n in 1..5 {
|
|
|
drawing.add(gt::line(xc+N, yc + d * n as f64));
|
|
|
}
|
|
@@ -63,7 +65,7 @@ fn main() {
|
|
|
drawing.add(gt::line(xt, yc+N).to(xt, yt));
|
|
|
}
|
|
|
|
|
|
- } else if get_cell(x, y) == '1' as u8 {
|
|
|
+ } else if get_cell(x, y).unwrap() == '1' as u8 {
|
|
|
for n in 1..5 {
|
|
|
drawing.add(gt::line(xc + d * n as f64, yc+N));
|
|
|
}
|