Skip to content

Commit 3e15ddd

Browse files
committed
[day10b] Fix final column
1 parent 72c7003 commit 3e15ddd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

day10b/src/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::io::Read;
22

33
fn do_cycle(cycle: i16, x: i16) {
44
let pos = cycle % 40;
5-
print!("{}", if pos >= x && pos <= x + 2 { '█' } else { ' ' });
6-
if cycle % 40 == 0 {
5+
print!("{}", if pos >= x - 1 && pos <= x + 1 { '█' } else { ' ' });
6+
if pos == 39 {
77
println!();
88
}
99
}
@@ -12,7 +12,7 @@ fn main() {
1212
let mut input = String::new();
1313
std::io::stdin().read_to_string(&mut input).unwrap();
1414

15-
let mut cycle = 1;
15+
let mut cycle = 0;
1616
let mut x = 1;
1717
for line in input.lines() {
1818
let prev_cycle = cycle;

0 commit comments

Comments
 (0)