add 2025
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
import { open } from 'node:fs/promises';
|
||||
|
||||
|
||||
const file = await open('./2025/inputs/1');
|
||||
let angle = 50
|
||||
let count = 0
|
||||
for await (const line of file.readLines()) {
|
||||
const prefix = line[0]
|
||||
const value = Number(line.slice(1))
|
||||
if (prefix == "L" && angle != 0) {
|
||||
angle = Math.abs(100 - angle)
|
||||
}
|
||||
|
||||
angle += value
|
||||
|
||||
let triggers = Math.floor(Math.abs(angle) / 100)
|
||||
count += triggers
|
||||
|
||||
angle %= 100
|
||||
|
||||
if (prefix == "L" && angle != 0) {
|
||||
angle = Math.abs(100 - angle)
|
||||
}
|
||||
}
|
||||
console.log(count)
|
||||
Reference in New Issue
Block a user