const mister = { //object to hold combination functions useful for MisterMind blank:(n)=> Array.from({length:n},()=> -1), // an array of n blanks encoded with -1 values rand:(n,range)=> Array.from({length:n},()=> Math.floor(Math.random()*range)), // fills a parallel array with random vals codeSet:(n,range)=> Array.from({length:Math.pow(range, n)}, (_,i)=> Array.from(baseChange(i,n,range))), // complete set of codeds counts: function(code, range){ // count the number of each type in the range (used for scoring) let counts = Array.from({length:range},()=>0); code.forEach(x => counts[x]++); return counts; }, displayScore:(sc)=> Array.from({length:sc[0]+sc[1]},(_,i)=> (i>=sc[0]?0:1)).map((x)=>`
`).join(""), // html for a score array [3,1] #black and #whites (requires css styles) displayCode:(code)=> code.map((x)=>`