Skip to content

Instantly share code, notes, and snippets.

@tkojitu
Last active December 13, 2023 06:27
Show Gist options
  • Save tkojitu/df498fd5d95fa70fcb9e5b469aaa7abe to your computer and use it in GitHub Desktop.
Save tkojitu/df498fd5d95fa70fcb9e5b469aaa7abe to your computer and use it in GitHub Desktop.
2023年明治安田生命J2リーグ最終戦で清水、磐田、ヴェルディが自動昇格枠に入れる確率
<html>
<head>
<script>
class J2ToJ1 {
constructor() {
this.points = [0, 1, 3];
this.results = [];
this.shimizu = 0;
this.iwata = 0;
this.verdy = 0;
}
calcResults() {
for (let s = 0; s < this.points.length; ++s) {
for (let i = 0; i < this.points.length; ++i) {
for (let v = 0; v < this.points.length; ++v) {
this.results.push([
this.points[s],
this.points[i],
this.points[v]
]);
}
}
}
}
printResults() {
for (let result of this.results) {
console.log(result);
}
console.log(this.results.length);
}
calcWinner() {
for (let result of this.results) {
if (result[0] == 3) {
this.winShimizu(result);
} else if (result[0] == 1) {
if (result[1] == 3) {
this.winIwata(result);
} else if (result[2] == 3) {
this.winVerdy(result);
} else {
this.winShimizu(result);
}
} else if (result[0] == 0) {
if (result[1] == 3) {
this.winIwata(result);
} else if (result[2] == 3) {
this.winVerdy(result);
} else {
this.winShimizu(result);
}
}
}
}
winShimizu(result) {
console.log("Shimizu: " + result);
++this.shimizu;
}
winIwata(result) {
console.log("Iwata: " + result);
++this.iwata;
}
winVerdy(result) {
console.log("Verdy: " + result);
++this.verdy;
}
print() {
console.log(this.results.length);
console.log("Shimizu: " + this.shimizu + ": " + this.shimizu / this.results.length);
console.log("Iwata: " + this.iwata + ": " + this.iwata / this.results.length);
console.log("Verdy: " + this.verdy + ": " + this.verdy / this.results.length);
}
calc() {
this.calcResults();
this.calcWinner();
this.print();
}
}
window.addEventListener(
"load",
function() {
new J2ToJ1().calc();
}
)
</script>
</head>
<body>
</body>
</html>
@slopegameonline
Copy link

#東京ヴェルディ #清水エスパルス #ゴール集 #2023明治安田生命J2リーグ #Jリーグ #昇格プレーオフ #サッカ slope game

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment