add wins to stat export
This commit is contained in:
parent
beb4183088
commit
b8d13d31a0
3 changed files with 13 additions and 11 deletions
|
@ -133,9 +133,9 @@
|
||||||
></g-chess-board>
|
></g-chess-board>
|
||||||
<button style="display: none" id="finish">show me the answer please i toootally guessed already</button>
|
<button style="display: none" id="finish">show me the answer please i toootally guessed already</button>
|
||||||
<h1 id="game-over"></h1>
|
<h1 id="game-over"></h1>
|
||||||
<button id="play-again">> play again <</button>
|
<button title="or press `p`" id="play-again">> play again <</button>
|
||||||
<pre id="stats"></pre>
|
<pre id="stats"></pre>
|
||||||
<button id="copy-stats">^ copy ^</button>
|
<button title="or press `c`" id="copy-stats">^ copy ^</button>
|
||||||
<br>
|
<br>
|
||||||
<h1>Players: (click name to toggle strikethrough)</h1>
|
<h1>Players: (click name to toggle strikethrough)</h1>
|
||||||
<div id="players">
|
<div id="players">
|
||||||
|
|
7
main.js
7
main.js
|
@ -644,6 +644,9 @@ function show_game_over() {
|
||||||
}
|
}
|
||||||
function show_win() {
|
function show_win() {
|
||||||
wins++;
|
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");
|
let game_over = document.getElementById("game-over");
|
||||||
game_over.style.display = "block";
|
game_over.style.display = "block";
|
||||||
game_over.innerText = "YOU WIN YOU WIN YOU WIN YOU WIN HOLY CRAP";
|
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
|
let stats_text = `#elo_worldle
|
||||||
#ew_${todays_player.name}
|
#ew_${todays_player.name}
|
||||||
pyrope.net/ew
|
pyrope.net/ew
|
||||||
|
Win #${wins}
|
||||||
Guesses: ${num_guesses}
|
Guesses: ${num_guesses}
|
||||||
Moves: ${num_moves}
|
Moves: ${num_moves}
|
||||||
${history}`;
|
${history}`;
|
||||||
|
@ -711,9 +715,6 @@ function reset() {
|
||||||
let play_again = document.getElementById("play-again");
|
let play_again = document.getElementById("play-again");
|
||||||
play_again.style.display = "none";
|
play_again.style.display = "none";
|
||||||
play_again.onclick = _ => console.log("you can't play again again sorry :]");
|
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();
|
todays_player = get_todays_player();
|
||||||
game = new Chess();
|
game = new Chess();
|
||||||
board.fen = game.fen();
|
board.fen = game.fen();
|
||||||
|
|
13
main.ts
13
main.ts
|
@ -779,6 +779,11 @@ function show_game_over() {
|
||||||
|
|
||||||
function show_win() {
|
function show_win() {
|
||||||
wins++;
|
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");
|
let game_over = document.getElementById("game-over");
|
||||||
game_over.style.display = "block";
|
game_over.style.display = "block";
|
||||||
|
@ -789,6 +794,7 @@ function show_win() {
|
||||||
let stats_text = `#elo_worldle
|
let stats_text = `#elo_worldle
|
||||||
#ew_${todays_player.name}
|
#ew_${todays_player.name}
|
||||||
pyrope.net/ew
|
pyrope.net/ew
|
||||||
|
Win #${wins}
|
||||||
Guesses: ${num_guesses}
|
Guesses: ${num_guesses}
|
||||||
Moves: ${num_moves}
|
Moves: ${num_moves}
|
||||||
${history}`;
|
${history}`;
|
||||||
|
@ -855,6 +861,7 @@ function wins_exclamation_marks() {
|
||||||
let wins_divided_by_ten = Math.floor(wins / 10);
|
let wins_divided_by_ten = Math.floor(wins / 10);
|
||||||
return wins_divided_by_ten > 0 ? "!".repeat(wins_divided_by_ten) : ".";
|
return wins_divided_by_ten > 0 ? "!".repeat(wins_divided_by_ten) : ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ERROR: !
|
// ERROR: !
|
||||||
// INELEGANT
|
// INELEGANT
|
||||||
// "HACK"!
|
// "HACK"!
|
||||||
|
@ -864,12 +871,6 @@ function reset() {
|
||||||
play_again.onclick = _ =>
|
play_again.onclick = _ =>
|
||||||
console.log("you can't play again again sorry :]");
|
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();
|
todays_player = get_todays_player();
|
||||||
game = new Chess();
|
game = new Chess();
|
||||||
board.fen = game.fen();
|
board.fen = game.fen();
|
||||||
|
|
Loading…
Reference in a new issue