[CLEANUP] Some fixes so that Day4 could be deployed to firebase
This commit is contained in:
@@ -8,7 +8,7 @@ class Day4 implements Day {
|
|||||||
const { drawnNumbers, bingoCards } = this.parseInput(input);
|
const { drawnNumbers, bingoCards } = this.parseInput(input);
|
||||||
|
|
||||||
// We are done as soon as we encounter the first bingo
|
// We are done as soon as we encounter the first bingo
|
||||||
return this.playBingo(drawnNumbers, bingoCards, b => ({ isDone: true }) ).score;
|
return this.playBingo(drawnNumbers, bingoCards, _ => ({ isDone: true }) ).score;
|
||||||
}
|
}
|
||||||
|
|
||||||
part2(input: string[]): number | string {
|
part2(input: string[]): number | string {
|
||||||
@@ -24,7 +24,7 @@ class Day4 implements Day {
|
|||||||
playBingo(drawnNumbers: number[], bingoCards: BingoCard[], bingoHandler: (b: Bingo, bingoCard: BingoCard, allCards: BingoCard[]) => { isDone: boolean }): Bingo {
|
playBingo(drawnNumbers: number[], bingoCards: BingoCard[], bingoHandler: (b: Bingo, bingoCard: BingoCard, allCards: BingoCard[]) => { isDone: boolean }): Bingo {
|
||||||
|
|
||||||
for (const draw of drawnNumbers) {
|
for (const draw of drawnNumbers) {
|
||||||
for (let bingoCard of bingoCards) {
|
for (const bingoCard of bingoCards) {
|
||||||
const cardResult = bingoCard.cross(draw);
|
const cardResult = bingoCard.cross(draw);
|
||||||
if (cardResult instanceof Bingo) {
|
if (cardResult instanceof Bingo) {
|
||||||
const handleResult = bingoHandler(cardResult, bingoCard, bingoCards);
|
const handleResult = bingoHandler(cardResult, bingoCard, bingoCards);
|
||||||
|
|||||||
Reference in New Issue
Block a user