-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(3Girls): add PDF and PNG files for 8 different girls in the 3Gir…
…ls folder feat(AOC2024): update import paths in Day01a, Day02a, Day02b to use utils/utils.js feat(AOC2024): add Day04b.js with solution for a puzzle and update index.html to use it
- Loading branch information
1 parent
716f51b
commit 178baff
Showing
25 changed files
with
52 additions
and
35 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { input } from "./inputs/Day04Input.js"; | ||
// const input = `MMMSXXMASM | ||
// MSAMXMSMSA | ||
// AMXSXMAAMM | ||
// MSAMASMSMX | ||
// XMASAMXAMM | ||
// XXAMMXXAMA | ||
// SMSMSASXSS | ||
// SAXAMASAAA | ||
// MAMMMXMMMM | ||
// MXMXAXMASX`; | ||
|
||
(() => { | ||
// Not mine: https://pastebin.com/X4vKGyXs | ||
const grid = input.split("\n").map((x) => x.split("")); | ||
const rows = grid.length; | ||
const cols = grid[0].length; | ||
const part2 = (grid) => { | ||
let count = 0; | ||
for (let x = 1; x < rows - 1; x++) { | ||
for (let y = 1; y < cols - 1; y++) { | ||
if (grid[x][y] === "A") { | ||
const tlbr = | ||
(grid[x - 1][y - 1] === "M" && grid[x + 1][y + 1] === "S") || | ||
(grid[x - 1][y - 1] === "S" && grid[x + 1][y + 1] === "M"); | ||
const trbl = | ||
(grid[x - 1][y + 1] === "M" && grid[x + 1][y - 1] === "S") || | ||
(grid[x - 1][y + 1] === "S" && grid[x + 1][y - 1] === "M"); | ||
if (tlbr && trbl) count++; | ||
} | ||
} | ||
} | ||
return count; | ||
}; | ||
|
||
console.log(part2(grid)); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters