Public
Edited
Sep 3, 2023
1 fork
Insert cell
Insert cell
maxIterations = 5000
Insert cell
names = new Map([
[1, {name: "Lisa", maxCount: 4}],
[2, {name: "Jackie", maxCount: 15}],
[3, {name: "Maya", maxCount: 15}],
[4, {name: "Margaret", maxCount: 5}],
[5, {name: "Jane", maxCount: 12}],
[6, {name: "Pam", maxCount: 10}],
[7, {name: "Susie", maxCount: 16}],
[8, {name: "Robin", maxCount: 8}],
[9, {name: "Cindy", maxCount: 10}],
[10, {name: "Karen", maxCount: 10}],
[11, {name: "Carolyn", maxCount: 12}],
[12, {name: "Alison", maxCount: 10}],
[13, {name: "Debbie", maxCount: 4}],
[14, {name: "Gaynor", maxCount: 12}],
[15, {name: "Laura", maxCount: 5}]
])
Insert cell
tennisCombinations = {
const allCombinations = _.range(1, number_of_weeks + 1).map(d => combinations)
const allCombos = new Combinations(allCombinations);
allCombos
.applyFilter([4, 6, 7, 10, 11], "includes", [15])
.applyFilter([1, 2, 3, 5, 8, 9, _.range(13, 38)], "excludes", [15])
.applyFilter([1, 2, 3, 4], "excludes", [1])
.applyFilter(_.range(23, 30), "excludes", [2])
.applyFilter([5, 10, 11, 29, 34], "excludes", [3])
.applyFilter(_.range(1, 24), "excludes", [4])
.applyFilter([3, 12, 23, 32, 34], "excludes", [5])
.applyFilter([13, 14], "excludes", [6])
.applyFilter([24, 32], "excludes", [7])
.applyFilter([20, 24, 32], "excludes", [8])
.applyFilter([3, 5, 6], "excludes", [9])
.applyFilter([4, 10, 17, 24, 29, 32], "excludes", [10])
.applyFilter([6, 10, 13, 17, 21, 22, 26, 27, 28, 29], "excludes", [11])
.applyFilter([1, 2, 3, 4, 5, 6, 7, 8, 12], "excludes", [12])
.applyFilter([34, 35, 36, 37], "excludes", [14])
return allCombos.combinations;
}
Insert cell
spreadsheetView = {
const data = sampleCombinations(tennisCombinations, names);
const players = _.range(1, number_of_players + 1);
const weeks = data.map((d, i) => {
const week = players.reduce((acc, p) => {
let player = names.get(p).name;
let value = "";
if (d != undefined) {
value = d.includes(p) ? "x": "";
}
return {...acc, [player]: value}
}, {});
return week;
});
return weeks;
}
Insert cell
Insert cell
Insert cell
Insert cell
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