Palview4 Manual  *   The Palview Pages  *   The Palview Developers Forum  *   Home  *   Palamede

The Palview Problem Page


Something completely new to Palview4 is its new problem page. With this page, a set of chess problems are presented in a table, much as they would be in a chess magazine or book. This type of page was created for composed chess problems, but it can also be used for very short tactical exercises. For more complicated tactical examples that may include variations, we have created another more suitable page called tactics.

The first thing that you must do to create a problem page is to set the problem htmltype INI option.

htmltype = problem

Below is an example of the new problem page. In the example, ony the top half of the table is shown.

Visitors to your page guess the solution to each problem by clicking on a piece to move and then clicking on a square to move it to. The Kibitz mode is enabled automatically for the problem page, so IE users will actually pick up the piece to move with their first click. This piece will then follow their cursor until they click again to drop the piece. By default, visitors have three guesses to find the solution move. After this the solution is simply revealed.

Once the solution move has been made, or the number of guesses have been exhausted, the complete solution is revealed below the board. Here is another image that shows the same problem page after the top two problems have been solved:

Once the complete solution has been revealed, visitors can then use either of the two buttons, Back or Forward , to navigate through the moves provided as the solution. Additionally, visitors can simply click the right mouse button to move Forward. Other Numeric Keypad keys can also be used to navigate through the problems provided that the INI option usekeystrokes has been enabled. Of course, these keys are only enabled once the solution has been revealed. The one exception to this is the Flip board key -- the '/' on the Numeric Keypad. This key can always be used to Flip the board to provide a different angle on the problem itself. You can select a board to Flip by first clicking on any of its empty squares.

Problem Intro Comment or Teaser


One important aspect of the problem page to note is the special use of any comment that appears in the PGN game before the first move (i.e. the solution move). Such a comment is called an Intro comment. You can use such a comment to provide an introduction to any of the problems. This comment will be visible to the user before the problem is solved as can be seen in the above examples. In our very first example, the Intro comment is:

Black has just played 28...Qa2xPa3, overlooking what former World Champion Jose Capablanca called a petite combination.

You can also see what this Intro comment looks like in the PGN example given below.

Problem Caption


Also notice in the above examples that both problems have the move number of the next move to be made written under the board in the caption area. This is automatically generated by the program, but you can set your own caption string by adding a Caption Tag to the appropriate game. For example, if you wanted to say something like:

White to play
 Mate in 3

You could add the following PGN Tag to the game:

[Caption "White to play<BR>Mate in 3"]

Note the use of the Html <BR> in the Caption text. This will be written directly into the Html file itself to provide a break.

Problem Page Properties and CSS


The problem page uses the stylesheet provided by the stylesheet INI option. There are no new CSS classes created for the problem page.

The number of actual boards you want across the page is set by the INI option overviewcols. We recommend only two boards across the page for pieces that are equal to, or larger, than 29 pixels. For smaller pieces you might want to try placing three boards across the page.

You can use the INI options headerfile and footerfile to get Palview to insert native Html Banner information directly into the top and bottom of the problem page. (See the above two INI options for more information.)

Also note that the location of the two new button images for the problem page, namely probf.gif for Forward, and probb.gif for Back, is provided using the conpanurl INI option. Usually, these two images are placed in the same folder as your chess piece images.

Technical Notes About Preparing a PGN File for the Problem Page

There are a couple of technical points that should be kept in mind when preparing a PGN file to be used with the new problem page. First and foremost is the fact that each game in the PGN file must be a game fragment with the first move being the actual solution move. In this case, each and every game in the PGN file will have a FEN tag, as you can see in the PGN game below that was used for the first problem in our example.

[Event "4NCL"]
[Site "Birmingham, ENG"]
[Date "2002.??.??"]
[Round "?"]
[White "Crouch, C"]
[Black "Eames, R"]
[Result "*"]
[SetUp "1"]
[FEN "1r4k1/Q4p1p/3p1pp1/p2P4/4P2P/qrR5/5PP1/5RK1 w - - 0 29"]
[WhiteCountry "ENG"]
[BlackCountry "ENG"]

{Black has just played 28...Qa2xPa3, overlooking what former
World Champion Jose Capablanca called a petite combination.}

29. Qxb8+! Rxb8 30. Rxa3 $18 *

Your chess software should be able to help you prepare such a PGN file. First, you'll want to copy the games you're going to use for the problem page into a new PGN file so that it can be edited. The next step is to remove all the previous moves before the solution move. In ChessBase 8, this can be done in two easy steps. First, right click on the solution move, then select 'Delete Previous Moves' from the list. Then use File -> Replace to resave the shortened game. ChessBase 8 will automatically write the required FEN Tag for the new game.

Another method that can be used is to click on the move before the solution move, then use your chess software to copy the current board position to the clipboard. Your software should provide you with a complete FEN of the position. The next step is to load your PGN file into a simple text editor, such as Notepad. After the last PGN Tag in the game -- tags look like [TagName "tagvalue"] -- write:

[FEN "

Then paste the FEN provided by your chess software. Finish this by typing a double quotation mark and a closed square bracket to complete the FEN Tag. You should now have something like:

[FEN "1r4k1/Q4p1p/3p1pp1/p2P4/4P2P/qrR5/5PP1/5RK1 w - - 0 29"]

You may also want to include the PGN Tag:

[SetUp "1"]

This is sometimes required by some chess software although the FEN Tag alone should be enough.

Finally, delete all the moves that come before the solution move. Don't forget to write the correct move number before the solution move if Black moves first.

There are two small JavaScript functions that both the problem and tactics page use to test the users Quiz move. These functions are annotated below so that webmasters writing for a different language may change the English statements that can be seen below. They may also want to experiment with the code to add a timer or scoring mechanism for the puzzles as well.

function Prob()
{
 if(gprob[cg]==0)return; // if solution already revealed do nothing
 gx[cg]+=4; // set game move index to next move (i.e. solution move)
 MvD(cg); // extract the info on the move
 gx[cg]-=4; // restore the move index
 if((s1==dgs)&&(s2==nq)) // do from - to squares match? (correct!)
  ShowProb(); // if they do, show the solution
 else{
  alert('Sorry -- that is not the correct answer!'); // wrong answer
  if(--gprob[cg]==0){ // reduce guess count by one -- if none left
    alert('Click for the correct answer'); // out of guesses
    ShowProb(); // just show the solution (no guesses left)
  }
  else{ // from - to don't match
   InitBoard(cg); // put back the starting problem position
   DrawBoard(cg); // redraw the board
  }
 }
}
function ShowProb()
{
 gprob[cg]=0; // set guess count to zero -- no need to guess anymore
 if(ie4) // for IE browser ...
  doc.all['qz'+cg].style.visibility='visible'; // reveal solution
 else // NS6 browser (maybe Opera7 too)
  doc.getElementById('qz'+cg).style.visibility='visible'; // reveal solution
 Forward(cg); // now play the solution move on the board
}