Not logged inRybka Chess Community Forum
Up Topic Rybka Support & Discussion / Aquarium / i-Book Tutorial 2: A Sample Endgame Study
- - By Zruty (*****) [ru] Date 2009-03-05 13:29
=== PREFACE ===

Aquarium i-Book page contains Wiki-marked text together with hyperlinks and generation placeholders. The generation placeholders mostly describe what chess-related data to display and how they should be treated. 'Chess-related data' means diagrams and special links that change the position on the board and/or the notation contents.

There are two ways of presenting chess-related data in the page:
* Database-bound: the games are stored in the database (the 'parent' database for an i-Book). The generation placeholders describe which games to fetch from the database and which moves/diagrams to display.
* Not database-bound, or free: all the moves are inserted directly into the page text as PGN, no data is loaded from the database.

These two approaches may be combined in one i-Book, and even in one page. You may find each of them more convenient than the other one for different purposes.

Today's article will mostly concentrate on writing a single i-Book page where chess-related data is presented in a free way.
As our test subject we'll use a Wikipedia article on Saavedra position.

=== I-BOOK COMMANDS CHECKOUT ===

Any Aquarium hyperlink looks like as follows: ["<link actions>", <link text>]. Note that both "," and a space are compulsory.

<link text> is any text not containing the ] symbol. It is displayed blue and underlined and when it's clicked the action is performed.
<link actions> is either a complete HTTP link (starting with http://) or a sequence of commands separated by a ; symbol.

A command has the following syntax: command_name(argument1,argument2,...).
Here is a sample Aquarium hyperlink:
["open_page(4)", Click here]
When the reader clicks this link he is redirected to the i-Book page with PageID=4.

Any Aquarium generation placeholder has the following syntax: [<command list>]. Here <command list> is the same as <link actions> above: a sequence of command separated by semicolons.

You have already seen the open_page() command. The First Steps article also introduced a line() command. Today we'll learn some more.

=== PREPARING FOR WORK ===

First, I'm creating a new database called Saavedra.dsn, and generate an i-Book over it, called Saavedra.ahb. These topics are covered in the First Steps article.

Then, I rename the 'Root page' to 'Saavedra Position' and check 'Board and notation present' to display the board.
Now I'm ready to work.

=== EDITING THE PAGE ===

I converted the first paragraph of the article:

= Saavedra position =
[set_start_position(8/8/1KP5/3r4/8/8/8/k7 w - -)]
[set_line(1. c7 Rd6+ 2. Kb5 Rd5+ 3. Kb4 Rd4+ 4. Kb3 Rd3+ 5. Kc2! Rd4! 6. c8R! Ra4 7.Kb3,0)]
The Saavedra position is one of the best known ["http://en.wikipedia.org/wiki/Chess", chess] ["http://en.wikipedia.org/wiki/Endgame_studies", endgame studies]. It is named after the Spanish priest, Rev. Saavedra (1849-1922), who, while living in Glasgow in the late 19th century, spotted a win in a position previously thought to have been a draw.

The ["jump(0...)", position] as it is usually given today, with White to move and win, is shown in the diagram:
{d:0}

The solution is
[write_line(1.,2.)]
([push_line; line(2. Kc5 $2 Rd1)] and [set_line(3. c8=Q Rc1 $1);write_line(3...)])
[pop_line;write_line(2...,6.)] 
(threatening [push_line;set_line(6...Ka2 7.Ra8);write_line(7.);pop_line]; instead of [push_line;line(6.c8=Q $2 Rc4 $1 7.Qxc4);pop_line] is stalemate)
[write_line(6...,$)], and Black must either lose the rook or be mated by [set_line(7...Ra5 8.Rc1);write_line(8.)] (Emms 1999:10-11).

This is one of the most famous examples of underpromotion in chess, and a rare example of a player being famous for a single move.

Now let's take a look at the commands I've used.

1. Ordinary HTTP hyperlinks to Wikipedia.org.

2. set_start_position(EPD), set_line(PGN)
These commands operate on the so-called internal game. set_start_position() sets the starting position of the internal game, set_line() adds moves to it. So
[set_start_position(8/8/1KP5/3r4/8/8/8/k7 w - -)]
[set_line(1. c7 Rd6+ 2. Kb5 Rd5+ 3. Kb4 Rd4+ 4. Kb3 Rd3+ 5. Kc2! Rd4! 6. c8R! Ra4 7.Kb3,0)]
loaded the main line of the study into the internal game. The second parameter 0 means that the line is main, and it should be written in bold.

3. write_line(From, To). This commands inserts the move links into the page text. The moves from <From> to <To> are inserted. If the second parameter is $, the line is written till the last move. If the second parameter is missing, only one move is written.

Actually, the sequence of [set_line(1.e4 ...);write_line(1., $)] can be replaced with a single [line()] command. But set_line + write_line are more powerful:
* you can write set_line() once in the start of the article and then write different overlapping parts of the line in any order.
* this article often skips the Black move. So I had to use constructions like [set_line(3. c8=Q Rc1 $1);write_line(3...)] to make this work.

Note that when you click the move 3...Rc1 the move 3.c8=Q is also inserted in the notation. This is always the case: whenever you click a move link generated by set_line, all previous moves are also inserted into the notation.

4. push_line, pop_line
These commands are used to store current line in the stack. I often did this trick:
push_line
do_something_with_current_line
pop_line

5. jump(MoveNumber)
This command is different from all other ones. It can only be put into hyperlinks, and it is not a generation command, but an action that is performed when the reader clicks the corresponding hyperlink. The action itself is 'jump to the position after MoveNumber, adding the moves as necessary'.
Such commands are called run-time commands, opposite to compile-time commands like set_line() and write_line() that are put into generation placeholders.

Another run-time command we already know is open_page().

=== THE REST OF THE ARTICLE ===

Here's the rest of the Saavedra position article:

= History =
The study has a long history. It has its origins in a game played between Fenton and Potter in 1875. From[set_start_position(7R/8/1P1K4/Pr6/6k1/7p/8/8 w - -);set_line(1.Rxh3 Kxh3 2.Kc6 Rxa5 3.b7 Ra6,0)] ["jump(0...)", this position], the game continued [write_line(1., $] and the players agreed a draw.

However, as Johann Zukertort pointed out in the City of London Chess Magazine, 1875, White could have won with
[set_line(4.Kc5 Ra5+ 5. Kc4 Ra4+ 6. Kc3 Ra3+ 7. Kb2,0);write_line(4.)]
(not [push_line;line(4.Kb5 Ra1)] when White cannot promote the pawn because of [set_line(5.b8=Q Rb1);write_line(5...);pop_line])
[write_line(4...,6.)] (or [push_line;line(6. Kb3 Ra1 7. Kb2);pop_line]) , and White will promote the pawn when queen versus rook is a theoretical win (this winning method had earlier been demonstrated in a study by Josef Kling and Bernhard Horwitz published in ''The Chess Player'', September 1853).

[set_start_position(8/2P5/1K5k/3r4/8/8/8/8 b - -);set_line(1...Rd6 2. Kb5 Rd5+ 3. Kb4 Rd4+ 4. Kb3 Rd3+ 5. Kc2,0)]
Upon Potter's death in March 1895, G.E. Barbier published a position in his ''Glasgow Weekly Citizen'' chess column of April 27, 1895, which he claimed to have occurred in Fenton-Potter. In fact, he had misremembered the game, and the ["jump(0...)", position] he published had never arisen.

It was published as a study with Black to play and White to win; the technique is just that demonstrated by Zukertort and by Kling and Horwitz before him: [write_line(1., $)]

[set_start_position(8/2P5/1K6/3r4/8/8/8/k7 b - -)]
When Barbier published this solution on May 4, he claimed that by moving the black king from h6 to a1 the ["jump(0...)", position] could be transformed into a Black to move and draw study. On May 11 he gave the solution [set_line(1...Rd6+ 2. Kb5 Rd5+ 3. Kb4 Rd4+ 4. Kb3 Rd3+ 5. Kc2 Rd4! 6. c8Q Rc4+ 7. Qxc4,0);write_line(1,$)] stalemate. However, as Saavedra pointed out, [line(5... c8=R)] instead wins, a solution published by Barbier on May 18.

The modern form of the position was obtained by Emanuel Lasker (in The Brooklyn Daily Eagle, June 1, 1902, p. 53) by moving the c7 pawn back to c6 and changing the stipulation to the standard "White to play and win".

[set_start_position(8/8/1KP5/3r4/8/8/8/k7 w - -)]
[set_line(1. c7 Rd6+ 2. Kb5 Rd5+ 3. Kb4 Rd4+ 4. Kb3 Rd3+ 5. Kc2! Rd4! 6. c8R! Ra4 7.Kb3,0)]
= Alternate line =
As computer-generated endgame tablebases confirm, Black can offer longer resistance by [line(3... Kb2,0)], for which White has only one winning reply, [line(4. c8=Q,0)], promoting to a queen instead of the underpromotion to a rook. Then White can force checkmate on the twenty-sixth move.

However, per the anthropocentric conventions of endgame studies, moves that result in positions known to human masters to be theoretically lost are considered sidelines.


Parent - - By retep1 (***) [de] Date 2009-03-05 17:22
It would be nice to have this little example (editable) as a zip-file like Victor Zakharov  does here:
http://rybkaforum.net/cgi-bin/rybkaforum/topic_show.pl?tid=10020
Annother Question:
The Jeroen I-book is password protected, isn't it. And If, why? I think only the customers would use it.
And so they can expand this I-book easily as an opnening I-book userlike.
For example - for me: Caro-Kann.
Parent - - By buffos (Silver) [gr] Date 2009-03-05 18:21 Edited 2009-03-05 18:23
For example if you write a book and sell it, you would not like your work to be copy pasted, and used to produce another i-book.
You sell the reader the right to read the book, not modify it because you would like as a write to update it yourself and sell the updated version yourself. (as it happens with a lot of real books by the way)
Parent - By retep1 (***) [de] Date 2009-03-05 18:28
understand
Parent - - By buffos (Silver) [gr] Date 2009-03-05 18:24

> It would be nice to have this little example (editable) as a zip-file like Victor Zakharov  does here:


Actually this is very very easy.. I ll do it for you , but its actually a copy and paste work.
Parent - By retep1 (***) [de] Date 2009-03-05 18:30
I think its good if we as customers have some style sheets for opening, ending etc.
Parent - - By buffos (Silver) [gr] Date 2009-03-05 18:29
Here it is (the Saavedra example i mean)

Unzip in ABases folder
Attachment: saavedra.zip (17k)
Parent - By retep1 (***) [de] Date 2009-03-05 18:31
thx!
Parent - - By riprap (**) [gb] Date 2009-03-05 19:42
I have used this example to make my readers on http://www,chessdevon.co.uk aware of the the prodigous strides that Aquarium is making in this particular development.  It would appear that there is still some way to go but I feel confident that the team will crack all the problems.
Parent - By riprap (**) [gb] Date 2009-03-05 19:44
Please read the URL as http://www.chessdevon.co.uk   I finger slip I regret.
Parent - - By Vempele (Silver) [fi] Date 2009-03-05 19:47

> http://www,chessdevon.co.uk


You still have time to edit your post and delete the other one.
Parent - - By The Final King (*) [rs] Date 2009-03-06 09:36
8/8/1KP5/3r4/8/8/8/k7 w - - 0 0

after 4 h rybka 3 don't find steps to mate.
Parent - - By Zruty (*****) [ru] Date 2009-03-06 09:53
My Rybka found mate in 25 in 10 seconds :)
Of course, I was using tablebases :)
Parent - - By cma6 (****) Date 2009-03-07 02:35
It appears that i-books are for book authors. But do the have any practical use for R3 users who just analyze games?
Parent - By buffos (Silver) [gr] Date 2009-03-07 09:14
If you just analyze games. No.
If you are commenting games for presentation yes.
Parent - - By Zruty (*****) [ru] Date 2009-03-07 10:11
Not only for book authors, but for book readers as well, aren't they?
Parent - - By cma6 (****) Date 2009-03-07 17:18
In that case, is there a sample i-book we can download on ChessOK and open? And how to open it? The tutorials in the forum seem to be for i-book authors.
Parent - By Vempele (Silver) [fi] Date 2009-03-07 17:20

> In that case, is there a sample i-book we can download on ChessOK and open?


Yes.
Up Topic Rybka Support & Discussion / Aquarium / i-Book Tutorial 2: A Sample Endgame Study

Powered by mwForum 2.27.4 © 1999-2012 Markus Wichitill