show progression in stats
This commit is contained in:
parent
3ce246e123
commit
5bb2040a5b
2 changed files with 18 additions and 2 deletions
10
main.js
10
main.js
|
@ -603,6 +603,7 @@ const board = document.getElementById("board");
|
||||||
const game = new Chess();
|
const game = new Chess();
|
||||||
function computer_move() {
|
function computer_move() {
|
||||||
num_moves++;
|
num_moves++;
|
||||||
|
history += "M";
|
||||||
return todays_player.f(game);
|
return todays_player.f(game);
|
||||||
}
|
}
|
||||||
// might want to change this when it's more wordly
|
// 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";
|
game_over.innerText = "YOU WIN YOU WIN YOU WIN YOU WIN HOLY CRAP";
|
||||||
let stats = document.getElementById("stats");
|
let stats = document.getElementById("stats");
|
||||||
stats.style.display = "block";
|
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;
|
stats.innerText = stats_text;
|
||||||
let copy_stats = document.getElementById("copy-stats");
|
let copy_stats = document.getElementById("copy-stats");
|
||||||
copy_stats.style.display = "block";
|
copy_stats.style.display = "block";
|
||||||
|
@ -627,6 +633,7 @@ function show_win() {
|
||||||
}
|
}
|
||||||
var num_guesses = 0;
|
var num_guesses = 0;
|
||||||
var num_moves = 0;
|
var num_moves = 0;
|
||||||
|
var history = "";
|
||||||
function append_players_to(n) {
|
function append_players_to(n) {
|
||||||
for (const player of players) {
|
for (const player of players) {
|
||||||
let child = document.createElement("div");
|
let child = document.createElement("div");
|
||||||
|
@ -641,6 +648,7 @@ function append_players_to(n) {
|
||||||
guess_button.innerText = "^ guess ^";
|
guess_button.innerText = "^ guess ^";
|
||||||
guess_button.onclick = _ => {
|
guess_button.onclick = _ => {
|
||||||
num_guesses++;
|
num_guesses++;
|
||||||
|
history += "G";
|
||||||
if (todays_player.name == player.name) {
|
if (todays_player.name == player.name) {
|
||||||
show_win();
|
show_win();
|
||||||
child.classList.add("correct");
|
child.classList.add("correct");
|
||||||
|
|
10
main.ts
10
main.ts
|
@ -725,6 +725,7 @@ const game = new Chess();
|
||||||
|
|
||||||
function computer_move() {
|
function computer_move() {
|
||||||
num_moves++;
|
num_moves++;
|
||||||
|
history += "M";
|
||||||
return todays_player.f(game);
|
return todays_player.f(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,7 +745,12 @@ function show_win() {
|
||||||
|
|
||||||
let stats = document.getElementById("stats");
|
let stats = document.getElementById("stats");
|
||||||
stats.style.display = "block";
|
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;
|
stats.innerText = stats_text;
|
||||||
|
|
||||||
let copy_stats = document.getElementById("copy-stats");
|
let copy_stats = document.getElementById("copy-stats");
|
||||||
|
@ -758,6 +764,7 @@ function show_win() {
|
||||||
|
|
||||||
var num_guesses = 0;
|
var num_guesses = 0;
|
||||||
var num_moves = 0;
|
var num_moves = 0;
|
||||||
|
var history = "";
|
||||||
|
|
||||||
function append_players_to(n: Node) {
|
function append_players_to(n: Node) {
|
||||||
for (const player of players) {
|
for (const player of players) {
|
||||||
|
@ -777,6 +784,7 @@ function append_players_to(n: Node) {
|
||||||
|
|
||||||
guess_button.onclick = _ => {
|
guess_button.onclick = _ => {
|
||||||
num_guesses++;
|
num_guesses++;
|
||||||
|
history += "G";
|
||||||
if (todays_player.name == player.name) {
|
if (todays_player.name == player.name) {
|
||||||
show_win();
|
show_win();
|
||||||
child.classList.add("correct");
|
child.classList.add("correct");
|
||||||
|
|
Loading…
Reference in a new issue