1
0
This commit is contained in:
2022-12-27 01:46:31 +00:00
parent 8fbaaa4bbc
commit e871837dc6
11 changed files with 110 additions and 86 deletions

View File

@ -1,13 +1,13 @@
fn do_cycle(cycle: u64, x_reg: i64) {
let col = (cycle - 1) % 40;
// println!("{} <= ")
if x_reg - 1 <= col.try_into().unwrap() && x_reg + 1 >= col.try_into().unwrap() {
print!("#");
} else {
print!(".");
}
if col == 39 {
println!();
}
@ -23,9 +23,7 @@ fn main() {
do_cycle(cycles, x_reg);
for line in INPUT.lines() {
if line.starts_with("noop") {
cycles += 1;
} else {