const path = require('path');
const args = require('yargs').argv;

function init() {
	const scoresA = require(path.resolve(__dirname, args.a));
	const scoresB = require(path.resolve(__dirname, args.b));

	const sum = {};

	[scoresA, scoresB].forEach((record) => {
		Object.entries(record).forEach(([game, scores]) => {
			if (!sum[game]) {
				sum[game] = {};
			}

			Object.entries(scores).forEach(([id, score]) => {
				sum[game][id] = (sum[game][id] || 0) + score;
			});
		});
	});

	console.log(JSON.stringify(sum, null, 4));
}

init();