add wins to stat export

This commit is contained in:
mehbark 2023-03-29 19:35:50 -04:00
parent beb4183088
commit b8d13d31a0
3 changed files with 13 additions and 11 deletions

View file

@ -133,9 +133,9 @@
></g-chess-board>
<button style="display: none" id="finish">show me the answer please i toootally guessed already</button>
<h1 id="game-over"></h1>
<button id="play-again">&gt; play again &lt;</button>
<button title="or press `p`" id="play-again">&gt; play again &lt;</button>
<pre id="stats"></pre>
<button id="copy-stats">^ copy ^</button>
<button title="or press `c`" id="copy-stats">^ copy ^</button>
<br>
<h1>Players: (click name to toggle strikethrough)</h1>
<div id="players">

View file

@ -644,6 +644,9 @@ function show_game_over() {
}
function show_win() {
wins++;
let win_count = document.getElementById("win-count");
win_count.style.display = "block";
win_count.innerText = `You have won ${wins} time${wins == 1 ? "" : "s"} without refreshing${wins_exclamation_marks()}`;
let game_over = document.getElementById("game-over");
game_over.style.display = "block";
game_over.innerText = "YOU WIN YOU WIN YOU WIN YOU WIN HOLY CRAP";
@ -652,6 +655,7 @@ function show_win() {
let stats_text = `#elo_worldle
#ew_${todays_player.name}
pyrope.net/ew
Win #${wins}
Guesses: ${num_guesses}
Moves: ${num_moves}
${history}`;
@ -711,9 +715,6 @@ function reset() {
let play_again = document.getElementById("play-again");
play_again.style.display = "none";
play_again.onclick = _ => console.log("you can't play again again sorry :]");
let win_count = document.getElementById("win-count");
win_count.style.display = "block";
win_count.innerText = `You have won ${wins} time${wins > 1 ? "s" : ""}${wins_exclamation_marks()}`;
todays_player = get_todays_player();
game = new Chess();
board.fen = game.fen();

13
main.ts
View file

@ -779,6 +779,11 @@ function show_game_over() {
function show_win() {
wins++;
let win_count = document.getElementById("win-count");
win_count.style.display = "block";
win_count.innerText = `You have won ${wins} time${
wins == 1 ? "" : "s"
} without refreshing${wins_exclamation_marks()}`;
let game_over = document.getElementById("game-over");
game_over.style.display = "block";
@ -789,6 +794,7 @@ function show_win() {
let stats_text = `#elo_worldle
#ew_${todays_player.name}
pyrope.net/ew
Win #${wins}
Guesses: ${num_guesses}
Moves: ${num_moves}
${history}`;
@ -855,6 +861,7 @@ function wins_exclamation_marks() {
let wins_divided_by_ten = Math.floor(wins / 10);
return wins_divided_by_ten > 0 ? "!".repeat(wins_divided_by_ten) : ".";
}
// ERROR: !
// INELEGANT
// "HACK"!
@ -864,12 +871,6 @@ function reset() {
play_again.onclick = _ =>
console.log("you can't play again again sorry :]");
let win_count = document.getElementById("win-count");
win_count.style.display = "block";
win_count.innerText = `You have won ${wins} time${
wins > 1 ? "s" : ""
}${wins_exclamation_marks()}`;
todays_player = get_todays_player();
game = new Chess();
board.fen = game.fen();