>>> 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">
Request for a feature
Re: Request for a feature
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.
Re: Request for a feature
The problem with previous and next puzzle when random is on has been solved in the latest version:
version 1.0.51.
version 1.0.51.
Who is online
Users browsing this forum: No registered users and 6 guests