Compare commits
2 commits
bc361d191a
...
6380a9a928
Author | SHA1 | Date | |
---|---|---|---|
6380a9a928 | |||
20f2212595 |
2 changed files with 7938 additions and 105966 deletions
113885
2024/day4/part1/output.txt
113885
2024/day4/part1/output.txt
File diff suppressed because one or more lines are too long
|
@ -34,22 +34,23 @@ fn main() {
|
||||||
|
|
||||||
for y in 1..leny {
|
for y in 1..leny {
|
||||||
let widthup = y >= 4;
|
let widthup = y >= 4;
|
||||||
let widthdown = (leny - y) > 3;
|
let widthdown = (leny - y) >= 4;
|
||||||
|
|
||||||
for x in 1..lenx+1 {
|
for x in 1..lenx+1 {
|
||||||
// check if enough space left and right
|
// check if enough space left and right
|
||||||
|
|
||||||
|
let widthleft = x >= 4;
|
||||||
|
|
||||||
|
let widthright = (lenx - x) >= 3;
|
||||||
|
|
||||||
|
// search algorithm starts here
|
||||||
|
// check if the char is X
|
||||||
|
if frfrvec[y][x] == 'X' {
|
||||||
println!("x is {x}");
|
println!("x is {x}");
|
||||||
println!("y is {y}");
|
println!("y is {y}");
|
||||||
println!("width up: {}", widthup);
|
println!("width up: {}", widthup);
|
||||||
println!("width down: {}", widthdown);
|
println!("width down: {}", widthdown);
|
||||||
let widthleft = x >= 4;
|
|
||||||
println!("width left: {}", widthleft);
|
println!("width left: {}", widthleft);
|
||||||
let widthright = (lenx - x) > 3;
|
|
||||||
println!("width right: {}", widthright);
|
|
||||||
|
|
||||||
// search algorithm starts here
|
|
||||||
// check if the char is s
|
|
||||||
if frfrvec[y][x] == 'X' {
|
|
||||||
// check if going upwards
|
// check if going upwards
|
||||||
if widthup {
|
if widthup {
|
||||||
if frfrvec[y - 1][x] == 'M'
|
if frfrvec[y - 1][x] == 'M'
|
||||||
|
|
Loading…
Reference in a new issue