Request for a feature

Ask questions regarding general use of DHTML Chess
chessnagar
Posts: 25
Joined: Tue Feb 28, 2017 2:40 pm

Re: Request for a feature

Post by chessnagar » Thu Mar 16, 2017 7:46 pm

>>> It's not as straight forward with random puzzles since you can't just do +1 and -1 for going to next and previous.
Actually, it is not complicated as we think.

In the old dhtml chess, I added that functionality to my site using an additional variable. right after solving the puzzle, we have to store the game index value in this variable so that it will be available after the next game is loaded. So after the next game loaded, if the user clicks "Prev", then we can pass this index value to load the previous game.

Limitation is that it will only load one previous game and at the beginning you can't go back to previous game (as there is none). But it should be fine as most of the times user want to review the previous tactic as it was amazing or surprising or unbelievable.

Some sample code from previous version:
var gameIndexCache; //defined globally
function switchGame()
{
document.getElementById('hintInner').innerHTML='Well done - problem solved.';
if(slideShowStarted){
setTimeout('displayLoadMessage()',1000);
setTimeout("chessObj.showRandomGame()",2500); // Wait two seconds before displaying next game
}else{
chessObj.showRandomGame(); // Show it immidieately if it's the first game
slideShowStarted=true;
}
gameIndexCache = chessObj.getCurrentGameIndex(); ///ADDED THIS
}
function loadRandomGame()
{
chessObj.showRandomGame(); // Show it immidieately if it's the first game
gameIndexCache = chessObj.getCurrentGameIndex(); ///////ADDED THIS
}

<input type="button" value="< Prev" onclick="chessObj.showGame(gameIndexCache);return false">

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

Re: Request for a feature

Post by alf » Thu Mar 16, 2017 9:02 pm

You're right, it might be sufficient to just go back one game. I will take care of that one tomorrow. A commaseparated string of id's might also work.

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

Re: Request for a feature

Post by alf » Fri Mar 17, 2017 5:55 pm

The problem with previous and next puzzle when random is on has been solved in the latest version:

version 1.0.51.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests