"Solved" Day 4

Literally couldn't be assed to write out the full list of cases in Odin
syntax when it's just objectively more cumbersome than Python syntax
This commit is contained in:
2026-02-17 22:52:46 -05:00
parent 152dc04a5b
commit 07ecb2d127
3 changed files with 1060 additions and 0 deletions

Binary file not shown.

View File

@@ -7,20 +7,45 @@ check_contains :: proc(pairs: [4]int) -> bool {
c := pairs[2]
d := pairs[3]
fmt.printf("%4d,%4d,%4d,%4d\t", a, b, c, d)
// Invalid input
if a > b || c > d {
fmt.printf("false\ta > b || c > d\n")
return false
}
// A contains B
if a <= c && c <= d && d <= b {
fmt.printf("true \ta <= c && c <= d && d <= b\n")
return true
}
// B contains A
if c <= a && a <= b && b <= d {
fmt.printf("true \tc <= a && a <= b && b <= d\n")
return true
}
// A borders B, B borders A
if b == c || d == a {
fmt.printf("true \tb == c || d == a \n")
return true
}
// A overlaps B
if b >= c && b < d {
fmt.printf("true \tb >= c && b < d\n")
return true
}
// B overlaps A
if d >= a && d < b {
fmt.printf("true \td >= a && d < b\n")
return true
}
fmt.printf("false\n")
return false
}

1035
odin/day04/scratch.py Normal file

File diff suppressed because it is too large Load Diff