wave_interference = function(waves) {
const data = [];
const waves_by_x = waves.map(wave => index_data_by_step(wave));
const all_x = merge_keys(waves_by_x);
for (let i = 0; i < all_x.length; i ++) {
const x = all_x[i];
let y_sum = 0;
waves_by_x.forEach(wave => {
if (x in wave) {
y_sum += wave[x];
}
})
data.push({step: parseInt(x, 10), value: y_sum});
}
return data;
}