Computer Chess Club Archives




Subject: Re: CHE docs in English / Nimzo 3 version

Author: pavel

Date: 09:12:50 11/23/01

Go up one level in this thread

I think this is a very interesting approach to chess program development,
It gives users the power to improve the programs style  significantly, but
ofcourse the user has to be efficient enough or it might back fire.

It would very interetsing to see other programs take this approach, maybe some
freewares too.


>For people who are interested in the Nimzo CHE language (but are not satisfied
>with the german documentation), I have found english docs from Ch.Donninger &
>H.Weigel. See below.
>The original file was included with Nimzo 3, and dated July 1996. It is for
>"Che" - but not yet for CHE++, which is AFAIK an enhanced version which came
>with Nimzo 8. I don't have Nimzo 8, but here and in reviews I've read that CHE++
>docs are only available in german, so I thought this english Che docs may be
>somewhat helpful for people which want to try CHE++, too.
># File che.doc                                                    #
># Definition of the chess-advice language "Che".                  #
># Che was designed by Ch.Donninger und H.Weigel. Everyone is      #
># encouraged to implement Che in his own chess programm.          #
># Note: This definition uses the usuall Backus-Naur description for
># programming languages. This information is intended for experienced
># programmers only.
># General note: Che is a case sensitive, strongly typed language.
># Case sensitivity means: 'PATTERN' and 'pattern' are different
># words. Words printed in bold are keywords. The suffix '-list'
># means, that the syntactic unit can be repeated 0..infinite times.
># '|' and '[]' are meta characters. They are not part of the
># Che-Syntax, but are used to describe the syntax. '|' means 'or',
># Syntax parts between '[]' are optional.
>cheprogramm: che-statement-list
>che-statement:  patternstmt | advicestmt |  rulestmt | include-stmt | comment
>patternstmt: pattern name
>             { pattern-list }       # AND-pattern.
>             { pattern-list }       # OR-pattern.
>             ;                      # Final semicolon.
>pattern:   [!] pattern-function | [!] pattern-name
># pattern-function is a predefined Che-pattern function (see list
># below).
># pattern-name is the name of previously defined pattern.
># The optional '!' before a function or pattern-name is the
># logical NOT operator.
>Example: wpwns(d4)    True, if white pawn is standing on d4.
>         !wpwns(d4)   False, if white pawn is standing on d4.
>                      True, if white pawn is not standing on d4.
>advicestmt: advice name advice-list ;
>advice: advice-function | advice-name | { [!] pattern-name }
># advice-function is a predefined Che-advice function (see list
># below).
># advice-name  is the name of a previously defined advice.
># pattern-name is a previously defined pattern. If the pattern is
># not true, the following advices are not executed.
># Note: If one defines with the GUI a pattern within an advice,
>#       the pattern is always placed on the beginning of the
>#       advice statement. But with an editor one can place the
>#       pattern on an arbitrary position within the statement.
>advice wFrench.03
>  wFrench.01 wKsCstl { wCstld } wpwnmvs(d4c5) goodsqrs(wN d4);
>The advice wFrench.03 executes first the previously defined advices wFrench.01
>and wKsCstl. The pattern wCstld is tested. If the pattern is true (white has
>already castled) the advices capture with the pawn on d4xc5 and place the Knight
>on d4 are executed. If white has not castled, the last two advices are ignored.
>If one wants to handle two or more independent conditions within an advice, one
>can handle this  by defining each condition as a subadvice. E.g.
>advice IfCstld { wCstld }
>  wpwnmvs(d4c5) goodsqrs(wN d4);
>advice IfQueenKingAttack { wQueenthere }
>  wkattack(kside);
>advice wFrench.03
>   wFrench.01 wKsCstl IfCstld IfQueenKingAttack.
>In this example are the two conditions independent. White shall attack the black
>king, no matter if white has already castled or not.
>If the conditions are dependent (e.g. the king attack is only done when white
>has castled and the queens are not exchanged) one has to write the advice in the
>following way.
>advice wFrench.03 wKsCstl { wCstld } wpwnmvs(d4c5) goodsqrs(wN d4)
>  { Queenthere } wkattack(kside);
>pattern wBb5 { piecesqrs(wB b5) } { };
>advice badBc8d7 { !wBb5} weakmvs(bB c8d7);
>if the white bishop is not standing on b5, c8d7 is a weak black move.
>rulestmt: rule name { pattern-name-list } advice-name-list ;
># The adivices in the advice-name-list are processed, if all the
># patterns in the pattern name-list are TRUE.
>include-stmt: include file-name
># Like the C-'#include' statement. The rest of the input line is
># skipped and the next line is read from the beginning of the file
># 'file-name'. When the end of file 'file-name' is reached, input
># continues in the next line of the original file.
>comment: #
># Input is ignored till the end of the line.
>Pattern Functions:
>The result of a pattern-function is TRUE, if the pattern is on the chessboard,
>otherwise FALSE.
>The general format is:  function-name(arguments).
>Arguments are seperated by at least one blank.
>As pawns are the most important pieces for defining patterns, there are
>specialized pawn-definition functions. These functions are also more efficient,
>so one should always use these compact functions for pawn-structure definitions.
>wpwns(sqr-list)  white pawns are standing on the squares defined
>                 by square-list.
>Example: wpwns(e4 d4)  Result is TRUE, if a white pawn is standing
>                       on e4 and d4.
>Note: E4 would be a syntax error. Squares must be written in lower-case.
>bpwns(sqr-list) same for black pawns.
>wpwncols(col-list) white pawns are standing on the columns defined
>                   by collist.
>Example1: wpwncols(cline) at least one white pawn is standing on the
>Example2: wpwncols(bline dline eline) at least one white pawn is
>standing on the b-,d- and e-line.
>bpwncols(col-list) same for black pawns.
>opencols(col-list) no pawn is standing on the columns defined by
>                   collist.
>Example: opencols(cline)
>orwpwns(sqr-list) a white pawn is standing on at least one of the
>                  squares defined by sqrlist.
>Example: orwpwns(f2 f3 f4)  a white pawn is standing either on f2,f3 or f4.
>orbpwns(sqr-list) same for black pawns.
>pwnrams(sqr-list) white pawns are standing on the squares defined by
>                  sqrlist. Each white pawn is directly blocked by a
>                  black pawn.
>Example: pwnrams(d4) a white pawn is standing on d4, a black on d5.
>piecesqrs(piece sqr-list) A piece of type 'piece' is standing on of
>                         the squares defined by sqrlist. The
>                          squares are ORed.
>Example1: piecesqrs(wB b5)  a white bishop is standing on b5.
>Example2: piecesqrs(wN b1 c3) a white knight is standing on b1 or on c3.
>Note: piecesqrs(wP d4) can be written shorter as wpwns(d4)
>      piecesqrs(wP c4 d4) is the same as orwpwns(c4 d4)
>pieces are defined as:
>wP - white pawn      bP - black pawn
>wN - white knight    bN - black knight
>wB - white bishop    bB - black bishop
>wR - white rook      bR - black rook
>wQ - white queen.    bQ - black queen.
>wK - white king.     bK - black king.
>piececols(piece col-list) pieces of type 'piece' are standing on the
>                          columns defined by collist. The columns
>                          are ANDed.
>Example: piececols(wR dline) a white rook is standing on the d-line.
>         piececols(wR dline eline) a white rook is standing on the
>                                   d-line, the other on the e-line.
>piecerows(piece row-list) pieces of type 'piece' are standing on the
>                         rows defined by rowlist. The rows are
>                         ANDed.
>Example: piecerow(bR row2) a black rook is standing on the second row. Rows are
>named row1 ... row8.
>piecesonbrd(piece-list) all pieces in the piece-list are standing on
>                        the board. The pieces are ANDed.
>wkingside(board-side) the white king is on the side defined by
>                      board-side.
>Example: wkingside(kside) the white king is on the E-line ... H-line. board-side
>is either kside (king-side) or qside
>bkingside(board-side) same for black king.
>isendgame()  True, if an endgame is on the board. NIMZO is in the
>             endgame phase, if the total (white+black) piece
>             material is less equal 4 rooks plus 2 bishops. Pawns
>             are not counted.
>The general format is: function-name(arguments).
>With the advice functions one specifies the advices for NIMZO.
>wpwnmvs(move-list) the moves specified in the move-list are good
>                   moves for white pawns. A move is entered at run-
>                   time into the move-advice-list of NIMZO, if the
>                   piece is standing on the from-square. (But the
>                   move must not be legal).
>Example: wpwnmvs(a2a3 b2b4) a2-a3 and b2-b4 are good pawn moves.
>Note: The moves must be exactly written in this way.
>bpwnmvs(move-list) same for black pawns.
>goodmvs(piece move-list) the moves specified in the move-list are
>                         good moves for the piece.
>Example: goodmvs(wN b1d2 g1f3) b1-d3 and g1-f3 are good moves for the white
>		goodmvs(wK e1c1) white king shall castle to the queen-side.
>strongmvs(piece move-list) the moves specified in the move-list are
>                           strong moves for the piece. The only
>                           difference between strongmvs and goodmvs
>                           is the greater value of the move-bonus.
>weakmvs(piece move-list) the moves speciefied in the move-list are
>                         weak moves for the piece.
>Example: weakmvs(wN b1c3) the move b1c3 is a weak move for the white
>                          knight.
>		weakmvs(bK e8g8 e8c8) black king shall not castle.
>badmvs(piece move-list) Same as weakmvs, but greater malus.
>mvtosqrs(piece sqr-list) the piece shall move to the squares defined
>                         in sqr-list (From any square).
>mvnotsqrs(piece sqr-list) the piece shall NOT move to the squares
>                           defined in sqr-list (From any square).
>wctrlsqrs(sqr-list) white shall control/attack the squares defined
>                    by sqr-list.
>Example: wctrlsqrs(d4 e4 d5 e5)   Center control could be defined in
>                                  this way.
>bctrlsqrs(sqr-list) same for black pieces.
>wminattack()  White shall start a minority attack.
>bminattack()  Black shall start a minority attack.
>wqsattack()   White shall attack on the queenside (Push the pawns,
>              place the pieces on the queenside).
>bqsattack()   Black shall attack on the queenside.
>wkingattack(board-side) white shall start a king attack on the side
>                        specified by board-side. It is checked at
>                        run-time, if the black king is standing on
>                        the same side.	If not, the attack is not
>                        done.
>Example: wkingattack(qside) white shall start a king-attack on the queen-side.
>bkingattack(board-side)  black shall start a king attack.
>wexchgBs(sqr-color-list) white shall exchange the bishops which are
>                         standing on the squares with the colors
>                         defined by the sqr-color-list.
>Example: wexchgBs(lsqr)  white shall exchange the light-colored bishop.
>         wexchgBs(lsqr dsqr) white shall exchange the light and the
>			               dark colored bishop (both ones).
>bexchgBs(sqr-color-list) same for black bishop.
>wkeepBs(sqr-color-list) white shall not exchange the bishop.
>bkeepBs(sqr-color-list) black shall not exchange the bishop.
>Example: bkeepBs(dsqr)  E.g. do not exchange the black bishop on G7
>                        in the kings-indian.
>exchgpieces(piece-list) Exchange the pieces specified in the piece-
>                        list.
>Example: exchgpieces(wQ wR) White shall try to exchange the Queen and the Rook.
>keeppieces(piece-list) Keep/do not exchange the pieces specified in
>                       the piecelist.
>Example: keeppieces(bQ wN) Black shall keep the queen, white the knight.
>goodsqrs(piece sqr-list) the squares defined in sqr-list are good
>                         squares for the piece.
>Example: goodsqrs(wN d5 e5) Put white knight either on d5 or e5.
>badsqrs(piece sqr-list) the squares defined in sqr-list are bad
>                        squares for the piece.
>goodcols(piece col-list) the colums defined in col-list are good
>                         columns for the piece.
>Example: goodcols(wR eline) Place/control with the with rook(s) the
>                            e-line.
>gooddiags(piece move-list) the diagonals defined by move-list are
>                           good diagonals by the piece.
>Example: gooddiags(wB f1a6) Place the white Bishop on the diagonal
>                            f1a6.
>Note: f1b5 is would also valid, but in this case, the bishop gets
>      only a bonus for standing on the squares from f1 to b5. No
>      Bonus is given for square a6.
>      The 'move' f1a8 is syntactic correct (the Che-compiler would
>      not complain), but at run-time this diagonal specification is
>      ignored, because f1a8 are not lying on the same diagonal.
>goodrows(piece row-list) the rows defined in row-list are good rows
>                         for the piece.
>Example: goodrows(wR row3 row8). Row-3 and row-8 are good rows for
>                                 the white rook.

This page took 0.03 seconds to execute

Last modified: Thu, 07 Jul 11 08:48:38 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.