Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ideas / todo / etc #15

Open
1 of 6 tasks
rooklift opened this issue Jun 23, 2021 · 9 comments
Open
1 of 6 tasks

Ideas / todo / etc #15

rooklift opened this issue Jun 23, 2021 · 9 comments
Labels
enhancement New feature or request

Comments

@rooklift
Copy link
Owner

rooklift commented Jun 23, 2021

Stuff might be edited in and out of this comment as we go... note that these are ideas and suggestions, not necessarily things I actually want or will implement...

  • Deltas graph (not sure if want)
  • Allow the 2 or 3 numbers on the board to be anything (maybe split into 3 config vars)
  • Easier reordering of subtrees, e.g. cut and paste
  • Search restrictions, i.e. via allowMoves or avoidMoves
  • Distinguish between next move markers (primary and variation, when 2+ are present)
  • Timers / timing
@rooklift rooklift added the enhancement New feature or request label Jun 23, 2021
@rooklift
Copy link
Owner Author

Basic swing (delta) code:

	__draw_swings: function(node, vals, linewidth, colour) {

		let graph_length = node.graph_length_knower.val;

		let deltas = [];

		for (let n = 0; n < vals.length; n++) {
			if (typeof vals[n - 1] === "number" && typeof vals[n] === "number") {
				let d = vals[n] - vals[n - 1];
				deltas.push(d);
			} else {
				deltas.push(0);
			}
		}

		// Draw...

		let ctx = this.ctx;
		ctx.lineWidth = linewidth;
		ctx.strokeStyle = colour;

		for (let n = 0; n < deltas.length; n++) {

			if (!deltas[n]) continue;

			let gx = this.draw_x_offset + (this.drawable_width * 0.5);
			let gy = this.draw_y_offset + (this.drawable_height * n / graph_length);

			ctx.beginPath();
			ctx.moveTo(gx, gy);

			ctx.lineTo(gx + (deltas[n] * this.drawable_width), gy);
			ctx.stroke();
		}
	},

@rooklift
Copy link
Owner Author

rooklift commented Apr 17, 2022

Possibly prevent KataGo from illegally retaking a ko when we're not sending any history:

if (moves.length === 0) {

	// KataGo won't be able to infer the player to move without a history...

	o.initialPlayer = query_node.get_board().active.toUpperCase();

	// KataGo won't be able to infer any ko prohibition without a history...

	if (query_node.get_board().ko && query_node.get_board().ko_ban_player === query_node.get_board().active) {
		o.avoidMoves = [
			{
				player: query_node.get_board().active.toUpperCase(),
				moves: [query_node.get_board().gtp(query_node.get_board().ko)],
				untilDepth: 1,
			}
		];
	}
}

But hmm, went with a different solution instead: e7d2263 - don't have such kos in the first place.

@rooklift
Copy link
Owner Author

rooklift commented Aug 10, 2022

For delayed mouseover PV...

"mouseover" events -->

  • Immediately draw standard
  • Set some variables saying which point, and time (performance.now()) of mouseover
  • Create a setTimeout that checks if the point is still the same? Or use a spinner?
  • The setTimeout / spinner calls draw_pv(), not caring if it fails

"mouseleave" from the board (already present in __handlers.js) needs to now:

  • Draw standard
  • Clear the variables

Problem: when new data comes in from the engine it will draw instantly (too soon).

@rooklift
Copy link
Owner Author

rooklift commented Aug 10, 2022

If the info panel will change for translation.

It's kind of baked-in at a fairly deep level. Well, not really, but I used monospace fonts as a lazy man's layout engine, and making things aesthetic with translations will be troublesome. I'm kind of happy to leave it for now...

Now for the change komi 7.5 to 6.5

I suppose it's not obvious but one can get from 7.5 to 6.5 by right clicking the number twice.

There are certainly too many options, it's true.

@rooklift
Copy link
Owner Author

rooklift commented Sep 5, 2022

KillerDucky's comments:

  • Force GUI to show stats/color for all next moves in sgf file
  • katrain like color scheme
  • katrain like mistake dots on last N moves
  • Set a cap on max visits for a node -- so that if I have continuous on and walk away it doesn't run forever. e.g I would set it to something like 10,000 because I basically never need more than that.
  • Insert (pair of) moves -- super useful especially when you record a game and forget a forcing sequence from 50 moves before. Katrain does insert, KGS you can cut/paste a variation which allows a similar thing
  • Everything included (katrain, weights, and it just runs automatically).

@rooklift
Copy link
Owner Author

rooklift commented Sep 6, 2022

Drawing score delta on the graph:

let s = node.depth.toString();

let parent_score = null;
let node_score = null;

if (node.parent) {
	if (node.parent.has_valid_analysis()) {
		parent_score = node.parent.analysis.rootInfo.scoreLead;
	} else {
		let ogsc = node.parent.get("OGSC");
		if (ogsc) {
			let score = parseFloat(ogsc);
			if (!Number.isNaN(score)) {
				parent_score = score;
			}
		}
	}
}

if (node.has_valid_analysis()) {
	node_score = node.analysis.rootInfo.scoreLead;
} else {
	let ogsc = node.get("OGSC");
	if (ogsc) {
		let score = parseFloat(ogsc);
		if (!Number.isNaN(score)) {
			node_score = score;
		}
	}
}

if (typeof parent_score === "number" && typeof node_score === "number") {
	s = ${Math.abs(node_score - parent_score).toFixed(1)}`;
}

Edit: this can be much more concise now that node.stored_score() and node.stored_winrate() exist.

@rooklift
Copy link
Owner Author

rooklift commented Sep 6, 2022

ctx.textAlign = "left";

if (!hub.__autoanalysis && !hub.__backanalysis && !hub.__autoplay && !hub.__play_colour) {
	if (node.parent) {
		if (config.graph_type === 1) {
			let parent_winrate = node.parent.stored_winrate();
			let node_winrate = node.stored_winrate();
			if (typeof parent_winrate === "number" && typeof node_winrate === "number") {
				let delta = (node_winrate - parent_winrate) * 100;
				ctx.fillText(
					"Δ " + Math.abs(delta).toFixed(1),
					this.draw_x_offset,
					this.draw_y_offset + (this.drawable_height * node.depth / graph_depth) + 4
				);
			}
		} else if (config.graph_type === 2) {
			let parent_score = node.parent.stored_score();
			let node_score = node.stored_score();
			if (typeof parent_score === "number" && typeof node_score === "number") {
				let delta = node.stored_score() - node.parent.stored_score();
				ctx.fillText(
					"Δ " + Math.abs(delta).toFixed(1),
					this.draw_x_offset,
					this.draw_y_offset + (this.drawable_height * node.depth / graph_depth) + 4
				);
			}
		}
	}
}

@ParmuzinAlexander
Copy link
Contributor

How to translate something in " " ?
s2 += ${override_moveinfo ? "${translate("INFO_PANEL_THIS")}" : "${translate("INFO_PANEL_BEST")}"}: <span class="white">${pad(move, 6)}</span>;
Not work.

@rooklift
Copy link
Owner Author

rooklift commented Apr 8, 2023

To do that sort of templating stuff the string needs to be formatted with the ` character, also you don't need some of the " characters, I think in this exact case it should be...

s2 += `${override_moveinfo ? translate("INFO_PANEL_THIS") : translate("INFO_PANEL_BEST")}: <span class="white">${pad(move, 6)}</span>`;

Uh I have to warn you I can't guarantee I'll ever translate the infobox - it uses whitespace as a sort of lazy man's formatting tool and it won't work with different lengths of text, maybe...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants