Public
Edited
Apr 26
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
trie
Insert cell
foo = function ([...chars]) {
return chars
}
Insert cell
{
const bar = foo("hello")
let baz = bar.shift()
baz+= bar.shift()
return bar
}
Insert cell
//Official letters from the Big Boggle dice
letters5x5 = [
["Qu", "B", "Z", "J", "X","K"],
["T", "O", "U", "O", "T", "O"],
["O", "V", "W", "R", "G", "R"],
["A", "A", "A", "F", "S", "R"],
["A", "U", "M", "E", "E", "G"],
["H", "H", "L", "R", "D", "O"],
["N", "H", "D", "T", "H", "O"],
["L", "H", "N", "R", "O", "D"],
["A", "F", "A", "I", "S", "R"],
["Y", "I", "F", "A", "S", "R"],
["T", "E", "L", "P", "C", "I"],
["S", "S", "N", "S", "E", "U"],
["R", "I", "Y", "P", "R", "H"],
["D", "O", "R", "D", "L", "N"],
["C", "C", "W", "N", "S", "T"],
["T", "T", "O", "T", "E", "M"],
["S", "C", "T", "I", "E", "P"],
["E", "A", "N", "D", "N", "N"],
["M", "N", "N", "E", "A", "G"],
["U", "O", "T", "O", "W", "N"],
["A", "E", "A", "E", "E", "E"],
["Y", "I", "F", "P", "S", "R"],
["E", "E", "E", "E", "M", "A"],
["I", "T", "I", "T", "I", "E"],
["E", "T", "I", "L", "I", "C"]
]

Insert cell
Insert cell
letters5x5.reduce(shuffle, letters5x5)

Insert cell
shuffle = function(acc, cur, i, array) {
const arr = [...acc]
const j = (Math.floor(Math.random() * (array.length - i)) + i)

const t = [...arr[i]]
arr[i] = [...arr[j]]
arr[j] = t
console.log(acc, arr)

return arr
}
Insert cell
shuffleIndex = function(array) {
const arr = [...array]
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const temp = array[i];
array[i] = array[j];
array[j] = temp;
}

return arr
}
Insert cell
Insert cell
Insert cell
Insert cell
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