advent-of-code-2023/day_7/parser.ts
2023-12-08 03:20:36 +08:00

16 lines
316 B
TypeScript

import * as fs from "fs";
export interface HandBid {
hand: string;
bid: number;
}
export const read_file = (): HandBid[] =>
fs
.readFileSync("input", "ascii")
.split("\n")
.map((line) => {
const [hand, bid] = line.split(" ");
return { hand: hand, bid: Number.parseInt(bid) };
});