show progression in stats

This commit is contained in:
mehbark 2023-03-28 23:15:10 -04:00
parent 3ce246e123
commit 5bb2040a5b
2 changed files with 18 additions and 2 deletions

10
main.js
View file

@ -603,6 +603,7 @@ const board = document.getElementById("board");
const game = new Chess();
function computer_move() {
num_moves++;
history += "M";
return todays_player.f(game);
}
// might want to change this when it's more wordly
@ -618,7 +619,12 @@ function show_win() {
game_over.innerText = "YOU WIN YOU WIN YOU WIN YOU WIN HOLY CRAP";
let stats = document.getElementById("stats");
stats.style.display = "block";
let stats_text = `#elo_worldle\n#ew_${todays_player.name}\npyrope.net/ew\nGuesses: ${num_guesses}\nMoves: ${num_moves}`;
let stats_text = `#elo_worldle
#ew_${todays_player.name}
pyrope.net/ew
Guesses: ${num_guesses}
Moves: ${num_moves}
${history}`;
stats.innerText = stats_text;
let copy_stats = document.getElementById("copy-stats");
copy_stats.style.display = "block";
@ -627,6 +633,7 @@ function show_win() {
}
var num_guesses = 0;
var num_moves = 0;
var history = "";
function append_players_to(n) {
for (const player of players) {
let child = document.createElement("div");
@ -641,6 +648,7 @@ function append_players_to(n) {
guess_button.innerText = "^ guess ^";
guess_button.onclick = _ => {
num_guesses++;
history += "G";
if (todays_player.name == player.name) {
show_win();
child.classList.add("correct");

10
main.ts
View file

@ -725,6 +725,7 @@ const game = new Chess();
function computer_move() {
num_moves++;
history += "M";
return todays_player.f(game);
}
@ -744,7 +745,12 @@ function show_win() {
let stats = document.getElementById("stats");
stats.style.display = "block";
let stats_text = `#elo_worldle\n#ew_${todays_player.name}\npyrope.net/ew\nGuesses: ${num_guesses}\nMoves: ${num_moves}`;
let stats_text = `#elo_worldle
#ew_${todays_player.name}
pyrope.net/ew
Guesses: ${num_guesses}
Moves: ${num_moves}
${history}`;
stats.innerText = stats_text;
let copy_stats = document.getElementById("copy-stats");
@ -758,6 +764,7 @@ function show_win() {
var num_guesses = 0;
var num_moves = 0;
var history = "";
function append_players_to(n: Node) {
for (const player of players) {
@ -777,6 +784,7 @@ function append_players_to(n: Node) {
guess_button.onclick = _ => {
num_guesses++;
history += "G";
if (todays_player.name == player.name) {
show_win();
child.classList.add("correct");