Public
Edited
Sep 28, 2024
Insert cell
# Rating
Insert cell
Insert cell
ratingA = 2000
Insert cell
ratingB = 2100
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function denominador(rtgA,rtgB){return (1+Math.pow(10, (rtgB-rtgA)/formConstant))}
Insert cell
Insert cell
Insert cell
1000/400
Insert cell
function expected_score2(rtgA,rtgB){return 1/(1+Math.pow(10, (rtgB-rtgA)/formConstant))}
Insert cell
function ratingChange(rating,ratingOpp,score,K){return +(K*(score-expected_score2(rating,ratingOpp))).toFixed(2)}
Insert cell
Insert cell
ratingChange(2105,2220,0.5,20)
Insert cell
ratingChange(ratingBase,ratingOpp,1,factorK)
Insert cell
Insert cell
viewof formConstant = Inputs.range([0, 1200], {label: "formula Constant", step: 10, value:400})
Insert cell
Insert cell
0.980/0.881
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
width:928,
height:350,
y: {
label: "↑ Rating Variation for PlayerA",
//domain: [0,1]
},
x: {
label: "Opponent Rating →",
grid: true
},
marks: [
//Plot.areaY(exmp1, {x: d=>d, y: d=>expected_score2(ratingBase,ratingBase+d), fill:"#b2cce1" }),
Plot.lineY(exmp1, {x: d=>ratingBase+d, y: d=>ratingChange(ratingBase,ratingBase+d,1,factorK), stroke:"#2d7b2d", strokeWidth:3 }),
Plot.lineY(exmp1, {x: d=>ratingBase+d, y: d=>ratingChange(ratingBase,ratingBase+d,0.5,factorK), stroke:"#ffa500", strokeWidth:3 }),
Plot.lineY(exmp1, {x: d=>ratingBase+d, y: d=>ratingChange(ratingBase,ratingBase+d,0,factorK), stroke:"#df5353", strokeWidth:3 }),
Plot.ruleY([0]),
Plot.ruleX([ratingBase]),
Plot.ruleX([ratingOpp],{stroke:"#77A"}),
Plot.dot([ratingOpp],{x:e=>e, y:e=>ratingChange(ratingBase,e,1,factorK), fill: "#2d7b2d", stroke:"black", r:5 }),
Plot.text([ratingChange(ratingBase,ratingOpp,1,factorK)],{x:ratingOpp, y:e=>e, text:e=>e, dy:15, fill: "black", stroke:"white"}),

Plot.dot([ratingOpp],{x:e=>e, y:e=>ratingChange(ratingBase,e,0.5,factorK), fill: "#ffa500", stroke:"black", r:5 }),
Plot.text([ratingChange(ratingBase,ratingOpp,0.5,factorK)],{x:ratingOpp, y:e=>e, text:e=>e, dy:15, fill: "black", stroke:"white"}),

Plot.dot([ratingOpp],{x:e=>e, y:e=>ratingChange(ratingBase,e,0,factorK), fill: "#df5353", stroke:"black", r:5 }),
Plot.text([ratingChange(ratingBase,ratingOpp,0,factorK)],{x:ratingOpp, y:e=>e, text:e=>e, dy:-15, fill: "black", stroke:"white"})
//Plot.dot(d3.extent(exmp1), {x: d=>d, y: d=>expected_score2(ratingBase,ratingBase+d), r:3, fill:"steelblue" }),
]
})
Insert cell
viewof color = Inputs.color({label: "Favorite color", value: d3.color("red").hex() })
Insert cell
d3.color("steelblue").hex()
Insert cell
d3.color.prototype
Insert cell
ratingsTop=[{name:"Ding Liren",rating:}]
Insert cell
Insert cell
lookupTableProb = []
Insert cell
//lookupTableDiff = []
Insert cell
//https://www.fide.com/component/handbook/?id=174&view=article
//https://en.wikipedia.org/wiki/Elo_rating_system#Performance_rating

//METODO FIDE
lookupTableDiff = [ [1,800], // par [p,dp], onde p é "tournament percentage score" e dp é "difference p"
[0.99, 677],[0.98, 589],[0.97, 538],[0.96, 501],[0.95, 470],[0.94, 444],[0.93, 422],[0.92, 401],[0.91, 383],[0.9, 366],
[0.89, 351],[0.88, 336],[0.87, 322],[0.86, 309],[0.85, 296],[0.84, 284],[0.83, 273],[0.82, 262],[0.81, 251],[0.8, 240],
[0.79, 230],[0.78, 220],[0.77, 211],[0.76, 202],[0.75, 193],[0.74, 184],[0.73, 175],[0.72, 166],[0.71, 158],[0.7, 149],
[0.69, 141],[0.68, 133],[0.67, 125],[0.66, 117],[0.65, 110],[0.64, 102],[0.63, 95],[0.62, 87],[0.61, 80],[0.6, 72],
[0.59, 65],[0.58, 57],[0.57, 50],[0.56, 43],[0.55, 36],[0.54, 29],[0.53, 21],[0.52, 14],[0.51, 7],[0.5, 0],
[0.49, -7],[0.48, -14],[0.47, -21],[0.46, -29],[0.45, -36],[0.44, -43],[0.43, -50],[0.42, -57],[0.41, -65],[0.4, -72],
[0.39, -80],[0.38, -87],[0.37, -95],[0.36,-102],[0.35,-110],[0.34,-117],[0.33,-125],[0.32,-133],[0.31,-141],[0.3,-149],
[0.29,-158],[0.28,-166],[0.27,-175],[0.26,-184],[0.25,-193],[0.24,-202],[0.23,-211],[0.22,-220],[0.21,-230],[0.2,-240],
[0.19,-251],[0.18,-262],[0.17,-273],[0.16,-284],[0.15,-296],[0.14,-309],[0.13,-322],[0.12,-336],[0.11,-351],[0.1,-366],
[0.09,-383],[0.08,-401],[0.07,-422],[0.06,-444],[0.05,-470],[0.04,-501],[0.03,-538],[0.02,-589],[0.01,-677],[0, -800]
];
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