ye change rn
This commit is contained in:
parent
630f54811c
commit
bc361d191a
2 changed files with 824 additions and 3 deletions
821
2024/day4/part1/outputexample.txt
Normal file
821
2024/day4/part1/outputexample.txt
Normal file
|
@ -0,0 +1,821 @@
|
|||
ye the lines are ["MMMSXXMASM", "MSAMXMSMSA", "AMXSXMAAMM", "MSAMASMSMX", "XMASAMXAMM", "XXAMMXXAMA", "SMSMSASXSS", "SAXAMASAAA", "MAMMMXMMMM", "MXMXAXMASX"]
|
||||
[['0', '0', '0', '0', '0', '0', '0', '0', '0', '0'], ['0', 'M', 'M', 'M', 'S', 'X', 'X', 'M', 'A', 'S', 'M'], ['0', 'M', 'S', 'A', 'M', 'X', 'M', 'S', 'M', 'S', 'A'], ['0', 'A', 'M', 'X', 'S', 'X', 'M', 'A', 'A', 'M', 'M'], ['0', 'M', 'S', 'A', 'M', 'A', 'S', 'M', 'S', 'M', 'X'], ['0', 'X', 'M', 'A', 'S', 'A', 'M', 'X', 'A', 'M', 'M'], ['0', 'X', 'X', 'A', 'M', 'M', 'X', 'X', 'A', 'M', 'A'], ['0', 'S', 'M', 'S', 'M', 'S', 'A', 'S', 'X', 'S', 'S'], ['0', 'S', 'A', 'X', 'A', 'M', 'A', 'S', 'A', 'A', 'A'], ['0', 'M', 'A', 'M', 'M', 'M', 'X', 'M', 'M', 'M', 'M'], ['0', 'M', 'X', 'M', 'X', 'A', 'X', 'M', 'A', 'S', 'X']]
|
||||
x is 1
|
||||
y is 1
|
||||
width up: false
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 2
|
||||
y is 1
|
||||
width up: false
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 3
|
||||
y is 1
|
||||
width up: false
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 4
|
||||
y is 1
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 5
|
||||
y is 1
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
successful down right
|
||||
|
||||
|
||||
x is 6
|
||||
y is 1
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
successful right
|
||||
|
||||
|
||||
x is 7
|
||||
y is 1
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 8
|
||||
y is 1
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 9
|
||||
y is 1
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 10
|
||||
y is 1
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 1
|
||||
y is 2
|
||||
width up: false
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 2
|
||||
y is 2
|
||||
width up: false
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 3
|
||||
y is 2
|
||||
width up: false
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 4
|
||||
y is 2
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 5
|
||||
y is 2
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
successful left
|
||||
|
||||
|
||||
x is 6
|
||||
y is 2
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 7
|
||||
y is 2
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 8
|
||||
y is 2
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 9
|
||||
y is 2
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 10
|
||||
y is 2
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 1
|
||||
y is 3
|
||||
width up: false
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 2
|
||||
y is 3
|
||||
width up: false
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 3
|
||||
y is 3
|
||||
width up: false
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 4
|
||||
y is 3
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 5
|
||||
y is 3
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 6
|
||||
y is 3
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 7
|
||||
y is 3
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 8
|
||||
y is 3
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 9
|
||||
y is 3
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 10
|
||||
y is 3
|
||||
width up: false
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 1
|
||||
y is 4
|
||||
width up: true
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 2
|
||||
y is 4
|
||||
width up: true
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 3
|
||||
y is 4
|
||||
width up: true
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 4
|
||||
y is 4
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 5
|
||||
y is 4
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 6
|
||||
y is 4
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 7
|
||||
y is 4
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 8
|
||||
y is 4
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 9
|
||||
y is 4
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 10
|
||||
y is 4
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
successful down left
|
||||
successful down
|
||||
|
||||
|
||||
x is 1
|
||||
y is 5
|
||||
width up: true
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
successful right
|
||||
|
||||
|
||||
x is 2
|
||||
y is 5
|
||||
width up: true
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 3
|
||||
y is 5
|
||||
width up: true
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 4
|
||||
y is 5
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 5
|
||||
y is 5
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 6
|
||||
y is 5
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 7
|
||||
y is 5
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
successful up
|
||||
successful left
|
||||
|
||||
|
||||
x is 8
|
||||
y is 5
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 9
|
||||
y is 5
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 10
|
||||
y is 5
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 1
|
||||
y is 6
|
||||
width up: true
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
successful up right
|
||||
|
||||
|
||||
x is 2
|
||||
y is 6
|
||||
width up: true
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 3
|
||||
y is 6
|
||||
width up: true
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 4
|
||||
y is 6
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 5
|
||||
y is 6
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 6
|
||||
y is 6
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 7
|
||||
y is 6
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
successful up left
|
||||
|
||||
|
||||
x is 8
|
||||
y is 6
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 9
|
||||
y is 6
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 10
|
||||
y is 6
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 1
|
||||
y is 7
|
||||
width up: true
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 2
|
||||
y is 7
|
||||
width up: true
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 3
|
||||
y is 7
|
||||
width up: true
|
||||
width down: true
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 4
|
||||
y is 7
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 5
|
||||
y is 7
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 6
|
||||
y is 7
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 7
|
||||
y is 7
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 8
|
||||
y is 7
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 9
|
||||
y is 7
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 10
|
||||
y is 7
|
||||
width up: true
|
||||
width down: true
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 1
|
||||
y is 8
|
||||
width up: true
|
||||
width down: false
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 2
|
||||
y is 8
|
||||
width up: true
|
||||
width down: false
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 3
|
||||
y is 8
|
||||
width up: true
|
||||
width down: false
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 4
|
||||
y is 8
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 5
|
||||
y is 8
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 6
|
||||
y is 8
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 7
|
||||
y is 8
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 8
|
||||
y is 8
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 9
|
||||
y is 8
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 10
|
||||
y is 8
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 1
|
||||
y is 9
|
||||
width up: true
|
||||
width down: false
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 2
|
||||
y is 9
|
||||
width up: true
|
||||
width down: false
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 3
|
||||
y is 9
|
||||
width up: true
|
||||
width down: false
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 4
|
||||
y is 9
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 5
|
||||
y is 9
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 6
|
||||
y is 9
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 7
|
||||
y is 9
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 8
|
||||
y is 9
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 9
|
||||
y is 9
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 10
|
||||
y is 9
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 1
|
||||
y is 10
|
||||
width up: true
|
||||
width down: false
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 2
|
||||
y is 10
|
||||
width up: true
|
||||
width down: false
|
||||
width left: false
|
||||
width right: true
|
||||
successful up right
|
||||
|
||||
|
||||
x is 3
|
||||
y is 10
|
||||
width up: true
|
||||
width down: false
|
||||
width left: false
|
||||
width right: true
|
||||
|
||||
|
||||
x is 4
|
||||
y is 10
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: true
|
||||
successful up left
|
||||
successful up right
|
||||
|
||||
|
||||
x is 5
|
||||
y is 10
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: true
|
||||
|
||||
|
||||
x is 6
|
||||
y is 10
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: true
|
||||
successful up left
|
||||
successful right
|
||||
successful up right
|
||||
|
||||
|
||||
x is 7
|
||||
y is 10
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 8
|
||||
y is 10
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 9
|
||||
y is 10
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: false
|
||||
|
||||
|
||||
x is 10
|
||||
y is 10
|
||||
width up: true
|
||||
width down: false
|
||||
width left: true
|
||||
width right: false
|
||||
successful up
|
||||
successful up left
|
||||
|
||||
|
||||
18
|
|
@ -34,9 +34,9 @@ fn main() {
|
|||
|
||||
for y in 1..leny {
|
||||
let widthup = y >= 4;
|
||||
let widthdown = (leny - y) > 4;
|
||||
let widthdown = (leny - y) > 3;
|
||||
|
||||
for x in 1..lenx {
|
||||
for x in 1..lenx+1 {
|
||||
// check if enough space left and right
|
||||
println!("x is {x}");
|
||||
println!("y is {y}");
|
||||
|
@ -44,7 +44,7 @@ fn main() {
|
|||
println!("width down: {}", widthdown);
|
||||
let widthleft = x >= 4;
|
||||
println!("width left: {}", widthleft);
|
||||
let widthright = (lenx - x) > 4;
|
||||
let widthright = (lenx - x) > 3;
|
||||
println!("width right: {}", widthright);
|
||||
|
||||
// search algorithm starts here
|
||||
|
|
Loading…
Reference in a new issue