From 2d6b107bf637ab1efa6c6ae5f89887932c672c14 Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Wed, 13 Dec 2023 16:16:01 -0300 Subject: [PATCH] [REFACTOR] Some logs fixed --- src/projecteuler/problem0006.ts | 2 +- src/projecteuler/problem0018.ts | 14 +++++++++----- src/projecteuler/problem0020.ts | 2 +- src/projecteuler/problem0021.ts | 4 ++-- src/projecteuler/problem0022.ts | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/projecteuler/problem0006.ts b/src/projecteuler/problem0006.ts index e8160bd9..1b0e11b0 100644 --- a/src/projecteuler/problem0006.ts +++ b/src/projecteuler/problem0006.ts @@ -38,7 +38,7 @@ function problem0006(_bottom = 1, _top = 100): number { }` ); - console.log('Problem 0006 result: %i', answer); + console.log(`Problem 0006 result: ${answer}`); return answer; } diff --git a/src/projecteuler/problem0018.ts b/src/projecteuler/problem0018.ts index 4e6f5e84..12b2b859 100644 --- a/src/projecteuler/problem0018.ts +++ b/src/projecteuler/problem0018.ts @@ -9,10 +9,13 @@ const rootCoordinateI = 0; const rootCoordinateJ = 0; export function problem0018(_triangle: number[][]): number { - console.debug('_triangle', _triangle); + console.debug(`_triangle: ${_triangle}`); console.debug( - '_triangle', - JSON.stringify(BNodeBuilder.buildBNodeTree(_triangle, 0, 0), null, 4) + `_triangle: ${JSON.stringify( + BNodeBuilder.buildBNodeTree(_triangle, 0, 0), + null, + 4 + )}` ); const leafs: number[] = []; @@ -24,8 +27,9 @@ export function problem0018(_triangle: number[][]): number { leafs ); - console.debug('_triangle', JSON.stringify(weightsTree, null, 4)); - console.debug('leafs count', leafs.length, 'leafs', leafs); + console.debug(`_triangle: ${JSON.stringify(weightsTree, null, 4)}`); + console.debug(`leafs count: ${leafs.length}`); + console.debug(`leafs: ${leafs}`); const max = leafs.reduce((a, b) => (a > b ? a : b)); diff --git a/src/projecteuler/problem0020.ts b/src/projecteuler/problem0020.ts index 6b11766c..e8b28637 100644 --- a/src/projecteuler/problem0020.ts +++ b/src/projecteuler/problem0020.ts @@ -16,7 +16,7 @@ import { bigFactorial, bigSumMany } from './helpers'; export function problem0020(_limit: number): string { const strFactorial = bigFactorial(_limit); - console.log(`Factorial of ${_limit}!:`, strFactorial); + console.log(`Factorial of ${_limit}!: ${strFactorial}`); const digits = strFactorial.split(''); diff --git a/src/projecteuler/problem0021.ts b/src/projecteuler/problem0021.ts index 3cde715b..4dfd3148 100644 --- a/src/projecteuler/problem0021.ts +++ b/src/projecteuler/problem0021.ts @@ -40,8 +40,8 @@ export function problem0021(_start: number, _limit: number): string { } }); - console.log(`result`, properDivisorsOf); - console.log(`amicableNumbers`, amicableNumbers); + console.log(`result: ${properDivisorsOf}`); + console.log(`amicableNumbers: ${amicableNumbers}`); return bigSumMany(amicableNumbers); } diff --git a/src/projecteuler/problem0022.ts b/src/projecteuler/problem0022.ts index 68510c0a..f1fca53b 100644 --- a/src/projecteuler/problem0022.ts +++ b/src/projecteuler/problem0022.ts @@ -15,7 +15,7 @@ export function problem0022(listOfNames: string[]): number { result += (i + 1) * wordScore(listOfNames[i]); } - console.log(`result`, result); + console.log(`result: ${result}`); return result; }