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

## The Palview Tactics Page Something completely new to Palview4 is its new tactics page. With this page, a set of tactical exercises are presented to the visitor, one exercise per game table. The first thing that you must do to create a tactics page is to set the tactics htmltype INI option.
    htmltype = tactics
Below is an example of the new tactics page. In the example, ony the first exercise table is shown. Visitors to your page guess the solution to each exercise 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 tactics 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 infobox that contains the information about the game such as player's names, country flags, event, date, etc. Here is another image that shows the same tactics page after the exercise has been solved: Notice in the above example that there is a good deal more room below the infobox for a solution that may require a number of variations and commentary to explain certain alternative moves. This is why the tactics page is preferable for tactical exercises. Composed chess problems may be better suited to the new problem page. Once the complete solution has been revealed, visitors can then use the buttons of the controlpanel below the board. 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 button or 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. ### Tactics Intro Comment or Teaser One important aspect of the tactics 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 tactical exercises. This comment will be visible to the user before the exercise is solved as can be seen in the above examples. In our 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. ### Tactics Page Properties and CSS The tactics page uses the stylesheet provided by the stylesheet INI option. There are no new CSS classes created for the tactics 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 tactics page. (See the above two INI options for more information.) ### Technical Notes About Preparing a PGN File for the Tactics 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 tactics 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 tactics 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
    }