Rated Tactics

Post your suggestions of plugin improvements here. All suggestions are much appreciated.
Post Reply
Posts: 25
Joined: Tue Feb 28, 2017 2:40 pm

Rated Tactics

Post by chessnagar » Mon Apr 10, 2017 6:32 pm

Hi Alf:
Thanks for the great feature "Rated" Tactics. If you don't mind can you please provide some high level details about how the elo is calculated?

By using this feature, now the free(without login) un-rated tactics are no loner available. So we have to publish two posts, one for rated and another for unrated. I am wondering if you can just switch the rated vs unrated based on the logged-in status? This way we can post one post with the template-2 but depending on what user wants, either they can login and get rated or not login and do tactics without getting rated.

Chess Nagar

Site Admin
Posts: 111
Joined: Sat Feb 18, 2017 11:02 pm

Re: Rated Tactics

Post by alf » Mon Apr 10, 2017 8:03 pm

Hi Chess Nagar,

I'm glad you liked the new feature. Please keep posting suggestions :)

The new tactics feature should not break the old one as far as I have tested.

However, you have a great suggestion here. This is what I have done.

You now have a new attribute called "fallback_tpl"

[chess tactics="1" tpl="2" fallback_tpl="1" db="1"]

The fallback_tpl will be used instead of tpl when a user is not logged in.

Of course, this will force tpl 1 to be used when a user is not logged in. I will think about how I can make this a choice for not-logged-in users.

Site Admin
Posts: 111
Joined: Sat Feb 18, 2017 11:02 pm

Re: Rated Tactics

Post by alf » Mon Apr 10, 2017 8:13 pm

I forgot to tell you about the ELO.

Well, this is a work in progress and is open for improvements.

* First of all, you gain(or lose) double rating points(simple provisional implementation) on the first 8 games.
* The simple formula for puzzle elo(Opponent) is:

Code: Select all

		$elo = 1000 + ($moves * 250);
		if($msToSolve){ // milliseconds 1/1000 seconds spent on the puzzle
			$sec = round($msToSolve / 1000); // get seconds
			$elo -= ($sec * 4); // subract second * 4
		return max(800, $elo);
i.e. 1000 + (250 per moves), so 1250 for a mate in 1.

Then 4 rating points is subtracted for each second spent solving the puzzle. Finally, max(800,elo) is returned, i.e. calculated elo should not be below 800.

When I know the two elo's (mine and opponent), I'm using a standard ELO formula with a K factor of 30 (i.e. total of 30 rating points awarded)

This is the code if you're very interested :)

Code: Select all

	public function eloChange( $whiteElo, $blackElo, $result ) {
		$expected = $this->getExpectedScore( $whiteElo, $blackElo );

		return self::K * ( $result - $expected );

	private function getExpectedScore( $ratingA, $ratingB ) {

		$qa = pow( 10, $ratingA / 400 );
		$qb = pow( 10, $ratingB / 400 );

		return $qa / ( $qa + $qb );
If you have any suggestions how to improve it, I will be happy to hear your thoughts :)

btw: I have created an automatic puzzle parser, i.e. a html page which you configure to walk through a pgn with positions and find the forced checkmates(using StockfishJS) and save the result in a different pgn. The reason I mention this, is that when I'm saving the result, I'm also saving how long time StockfishJS used to find the checkmate. This may be used as an indicator for how difficult the puzzle is to solve.

btw: the parser can be seen at http://dhtmlchess.com/api/demo/auto-par ... index.html

It's part of the standard dhtml-chess which you can download from dhtmlchess.com. At the moment, it is not developed for the public since you need to do some coding to configure it, but if this is something which is interesting to you or others, I will of course spend some time making it easier to do and explain how to use it.


Posts: 57
Joined: Wed Mar 08, 2017 8:17 am

Re: Rated Tactics

Post by Idochesswork » Sat Jun 03, 2017 8:58 am

Hi alf,

There is one small thing that can be improved, I thought.
When user made a wrong move in rated tactics, the piece would stay on the square that it's recently move there. That would be a little hard for user to imagine. I think it should be automatic dragged back to where it was, just like the normal tactics template. :)

All best,

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests