Public
Edited
Oct 2, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
utils.groupBy(missionList, it=>it.gameMode)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
utils = {
function isRelic(obj) {
return obj?.itemName.toLowerCase().includes("relic");
}
function groupBy(list, func, groupValueNotKey = true) {
const result = {};
for (const [k, v] of list.entries()) {
let index = func(v, k);
if (!Array.isArray(result[index])) {
result[index] = [];
}
result[index].push(groupValueNotKey ? v : k);
}
return result;
}
function getAverageRotationChance(gamemode){
if(gamemode === 'Disruption') return (a,b,c)=>c
if(gamemode.toLowerCase().includes('caches')) return (a,b,c)=>(a+b+c)/3
if(gamemode.toLowerCase().includes('sabotage')) return (a,b,c)=>(a+b+c)/3
if(['Rescue', 'Spy', 'Rush'].some(it=> it === gamemode)) return (a,b,c)=>(a+b+c)/3
return (a,b,c)=>(a+a+b+c)/4
}
function getAverageRotationChanceFactor(gamemode, rotation){
if(gamemode === 'Disruption') {
if (rotation !== 'C'){
return 0
} else {
return 1
}
}
if(gamemode.toLowerCase().includes('caches')) return 1/3
if(['Rescue', 'Spy', 'Rush'].some(it=> it === gamemode)) return 1/3
// if anything else
if (rotation === 'A'){
return 0.5
} else {
return 0.25
}
}
return {
isRelic,
groupBy,
getAverageRotationChance,
getAverageRotationChanceFactor,
};
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more