Rival lives at Red Hot Pawn
         

Rival Chess Help

Overview

Rival overview

Rival is a freeware chess program that also plays chess variants. Visit http://www.redhotpawn.com/rival for more information and for a more structured help file.

Rival was written by Chris Moreton. The graphics for the original version and most of graphics in the current version were created by Russell Newman.

Playing a game

Timing methods

There are five timing methods in Rival, Fixed Ply, Time per move, Championship, Base/Increment, and Infinite.

Fixed Ply

When using the fixed ply option, Rival will look a fixed number of moves ahead from the current position to decide on its move. Each ply represents one half-move. That is, using Ply 8 will cause Rival to look four moves ahead for each side before deciding on its move.

Time Per Move

When using the this method, Rival will use the specified time to decide upon its move.

Championship

This timing method specifies how many moves each side is allowed to make in a given time. When a side has made the required number of moves, another allocation of the specified time will be added to their clock.

Base/Increment

Sometimes called Fischer time, this method specifies the initial time for each side and also specifies the number of seconds to be added to the clock after each move.

Infinite

This method will cause Rival to search until it is stopped by the user or until it has seen 25 whole moves ahead (50 ply).

Selecting the opponent

There are three menu options that can be used to select whether the computer or yourself is in control of particular piece colour.

Switch sides

This will switch control of the pieces. The behavior of this option for each of the four cases in which it can be invoked is described below.

If you are in control of the side who is to move next and Rival is in control of the other side, selecting Switch Sides will reverse the control of the pieces so that Rival will to control the side currently on the move.

If Rival is in control of the side currently on the move and you are in control of the other side, selecting Switch Sides will stop Rival's current search for a move and assign it to control the side that is not currently moving.

If you are in control of both the white and the black pieces, selecting Switch Sides will assign control to Rival of the side currently on the move.

If Rival is in control of both the white and the black pieces, selecting Switch Sides will have no effect.

Computer plays white

This option can be toggled by selecting it. When it is switched on (when it has a check next to it in the menu), Rival assumes control of the white pieces.

Computer plays black

This option can be toggled by selecting it. When it is switched on (when it has a check next to it in the menu), Rival assumes control of the black pieces.

Making moves

To make a move left-click the piece you wish to move and then left or right click on the square to which you wish to move it. For castling moves, make the king move; the rook will move automatically.

When playing the self-take variant, if you wish to take one of your own pieces, select the destination square with the right mouse button.

If the Show All Messages option from the Options menu is selected, an illegal move will be met with message explaining the reason that the move is not legal.

Interupting the computer player

There are two ways to stop the computer while it is searching for a move. You may select the Play Best option from the Action menu (or press Return) to force the computer to play the best move it has found so far, or you may select Stop Search from the Action menu (or press Escape) to terminate the search without making a move.

Rules of chess and variant games

Rules of Chess

Moves of the pieces

This is a an overview of the moves of the pieces in regular chess. The squares as described here are represented by a combination of a letter and a number. The letter is in the range a to h and represent s the files of the board. The number is in the range 1 to 8 and represents the ranks or the board.

King moves

The king may move one square in any direction so long as the move does not leave the moving side in check and the destination square not occupied by a friendly piece. For example, from e4, the king may move to e5, e3, d4, f4, d5, f5, d3 and f3.

Queen moves

The queen may slide any number of squares in any direction but may not jump pieces. The destination square must be empty or occupied by an opposing piece. The move must not leave the moving side in check.

Rook moves

The rook may slide any number of squares either horizontally or vertically but may not jump pieces. The destination square must be empty or occupied by an opposing piece. The move must not leave the moving side in check.

Knight moves

The knight makes L-shaped moves formed of a combination of a two square move and a one square move. For example a knight on f3 may move to e5, g5, h4, h2, g1, e1, d2 and d4. The knight may jump pieces but the destination square must be empty or occupied by an opposing piece. The move must not leave the moving side in check.

Bishop moves

The bishop may slide any number of squares in a diagonal direction but may not jump pieces. The destination square must be empty or occupied by an opposing piece. The move must not leave the moving side in check.

Pawn moves

The pawn may move one square forward so long as the destination square is empty. The pawn may move two squares on its first move so long as both of the two squares in front of the originating square are empty. The pawn can only capture an opposing piece that is one square diagonally in front of the pawn. That is, a white pawn on e4 may capture an opposing piece on d5 or f5. A black pawn on e4 may capture an opposing piece on d3 or f3. The move must not leave the moving side in check. One exception to these rules is en passant, described below.

Check

A side is in check if its king is under attack by an opposing piece. A piece is not permitted to make a move if that move leaves its own king in check. If no moves are possible, the end of the game is reached.

En passant

Immediately after any pawn makes a two square move (in its first move of the game), it is subject to an en passant capture but only on the opponent's next move. The en passant rule allows an opposing pawn to capture the pawn that just moved as if it had moved only one square forward. For example, if a white pawn moves from d2 to d4, an opposing pawn on c4 or e4 may move to the d3 square and remove the white pawn from d4.

Castling

A King-side castling move may be made if neither the king nor the king-side rook has yet moved in the game and both squares between the king and the king-side rook are unoccupied.

A Queen-side castling move may be made if neither the king nor the queen-side rook has yet moved in the game and all three squares between the king and the queen-side rook are unoccupied.

A white king-side castling move results in the white king on the g1 square and the king-side rook on the f1 square.

A black king-side castling move results in the white king on the g8 square and the king-side rook on the f8 square.

A white queen-side castling move results in the white king on the c1 square and the king-side rook on the d1 square.

A black queen-side castling move results in the white king on the c8 square and the king-side rook on the d8 square.

Also, the side to move may not be in check either before or after the castling move and the king must not pass through check in order to make the move. For example, a white-king side castle may not be made if any black piece is attacking the e1, f1 or g1 squares.

The end of the game

A game may end in one of the following ways

Checkmate

Checkmate occurs when the side to move is in check and there are no legal moves. In this case, the side on the move has lost the game.

Stalemate

Stalemate occurs when there are no legal moves but the side to move is not in check. This results in a draw.

Agreed draw

The players may agree a draw at any time. In Rival, if you are playing a game against the computer, you may select the Offer Draw option from the action menu at which point Rival will decide whether or not to accept the offer. If moves are taken back and further moves are then made, the draw agreement is no longer valid.

Resignation

A play may resign on their move. You may resign a game by selecting the Resign option from the Action menu. This has the effect of stopping the clocks and causing the result to be written to the if the gamed is saved in PGN format. If moves are taken back and further moves are then made, the resignation is no longer valid.

Overview of variant games

Rival currently plays three variant games

  • Kinglet
  • Shatranj
  • Selftake

Rules of Kinglet

Kinglet differs from chess in the following ways

  • The person who has no pawns left on the board is the loser.
  • There are no rules regarding check or checkmate.
  • Pawns always promote to kings.

Rules of Shatranj

Shatranj differs from chess in the following ways
  • The elephant (bishop) moves exactly two squares diagonally and may jump other pieces.
  • The general(queen) moves one square diagonally.
  • Pawns may not move two squares on their first move.
  • There is no castling move.
  • Pawns always promote to generals

You may like to try the following shatranj mate in 6. See the overview of variant games for information on getting further test positions.

1r4k1/8/5PP1/8/K1n3NR/7B/1r6/7R w - - 0 1

Rules of SelfTake

Self-Take differs from chess only in that a player may take their own pieces. All other rules apply and castling is as normal (no pieces may be taken on castling). If you wish to take on of your own pieces, you should select the moving piece with the left mouse button and select its destination with the right mouse button.

Display options

Options overview

All user definable options in Rival are stored in the newrival.opt file. This is a text file consisting of a number of key value pairs which may be modified within the GUI by selecting Save Options from the Options menu or may be editted manually. If this file is not present, the default options will be used.

Style options

The Display menu allows the selection of a number of different style and colour options for the board, pieces, background, analysis and move boxes. Most display options can be selected by right-clicking on the area of the display that you wish to change.

Computer thinking options

When the computer is searching for a move you may wish to view its analysis. This is shown in the box directly above the move list box. The analysis shows the path of moves that Rival believes are best from the current position.

Reading the analysis

The first move in this list is the move that Rival would make if it needed to make a move at that moment. The remaining moves (reading from left to right and then down) alternate between the players.

Analysis score

The score shown in the analysis box shows how goodl Rival believes its position is. A positive score shows that Rival believes it is winning while a negative score shows that Rival believes that it is losing. The score is measured in pawns with the pieces valued approximately as follows
  • Knight = 3 Pawns
  • Bishop = 3 Pawns
  • Rook = 5 Pawns
  • Queen = 9 Pawns
If the score is say, 4.21, this may mean that Rival believes that its next move leads to a position in which it is, or will be, a pawn and a knight up in material with a slight positional edge also.

Nodes

The nodes part of the analysis box shows the number of positions that Rival has examined in the current search.

Computer play options

Opening library

If the opening library is enabled from the Computer Play Options item on the Options menu, Rival will attempt to find a move by using its opening book when it is its turn to move. If it finds a move, it will use it, otherwise it will enter into a regular search.

Opening book options

The opening book is a text file containing a list of positions (in FEN notation) along with the number of white wins, black wins and draws achieved from each position in the past (either from Rival's experience if opening book learning is enabled, or from the games from which the opening book was created). The following options can be used to modify Rival's use of the library.

Opening percent white/black

These options tell Rival to only play moves from the book that lead to positions in which the side making the move to get to that position has achieved the specified percentages of wins in previous games, subject to the minimum results modifier as described below.

Minimum results before applying percentages

This tells Rival the number of games that need to have been played from a position in the opening library before applying the percentages described above. If a position has not been used in the specified number of games, it will qualify for use until is has been used a large enough number of times.

Ponder next move

When this option is selected, Rival will think when it is not its turn to move. It attempts to guess which move will be made by the opponent and then conducts a search for a reply.

Advanced Search Options

Rival allows the modification of a number of search options. This functionality is targetted mainly at authors or potential authors of chess programs. They allow the central search algorithm used by Rival and the majority of other chess programs to be modified in order to test combinations of search enhancements.

Null Move

Toggles the use of the null move.

Null Move reduce depth

This specifies the number of ply fewer than a normal search that will be searched following a null move.

Null Move pieces

Specifies the number of pieces (not including pawns) that remain on the board for the side on the move for the null move to not be applied. That is, if this value is set to 2 then the null move will only be used in positions where the side to move has more than 2 pieces on the board.

Minimal Window

Toggles the use of the minimal window search when searching all moves other than the first move at each position.

Pawn Push Extensions

Toggles the use of pawn push extensions. A search extension is made for pawn moves to the 6th or 7th rank.

Recapture Extensions

Toggles the use of recapture extensions. A search extension is made when a capture causes the material balance to be the same as that of the root position.

Check Extensions

Toggles the use of check extensions. A search extensions is made a position is encountered where the mover is in check.

Single Reply Extensions (currently disabled)

A search extension is made when there is only one possible move from a position.

Max Extensions

This specifies the maximum number of extensions that may be applied in a single variation.

Node Count Hash Resolution (currently disabled)

This specifies that Rival will use the node count of a search when determining which position should remain when resolving hash table clashes.

Two level Hash (currently disabled)

The two-level hash table allows two positions rather than one to be stored at each hash index. If both positions are used when a new position qualifies for inclusion in the table, a decision is made based on perceived usefulness as to which position to replace.

Killers (currently disabled)

Toggles the use of the killer heuristic.

Aspiration Window

Specifies the window in hundreths of a pawn based around the value of the previous iteration that Rival will use to search the next iteration. A window of 100 and a previous iteration value of 75 will cause a window of (25,125) to be used for the next iteration.

Hash table size

Specifies the size in Kilobytes of the hash table. A hash entry is currently 13 bytes so a hash table of 1024K can hold (1024*1024)/13=80659 positions.

Read Hash reduce (currently disabled)

Specifies the ply before a leaf not at which Rival will no longer read from the transposition table.

Write Hash reduce (currently disabled)

Specifies the ply before a leaf not at which Rival will no longer write to the transposition table.

Contempt

Specifies the value that Rival assigns to drawn positions.

Saving and loading

Saving and loading games

Games may be save either in the Rival format or in PGN format.

Rival format

Selecting Save Game from the File menu will allow the game to be saved in the Rival format that is relevant to the variant that is being played.

PGN format

Selecting Save Game as PGN from the File menu will allow the game to be saved in PGN (Portable Game Notation) format. A dialog box will appears prior to the file selection dialog box that prompts for the following

  • Append. Select this checkbox if you wish the game to be appended to an existing PGN file. If the file does not exist, it will be created.
  • Event. This allows the title of the PGN game to be specified.
When playing variant games, the variant is written as a header tag in the PGN file.

Games that do not start from the original position may be saved in either Rival or PGN format. A FEN header tag will be included in the PGN file.

Saving and loading positions

Positions may be saved as in FEN format. Select Save Position as FEN from the File menu to specify the name of the file in which the position is to be saved. A further way to get the FEN for a position is to select Setup Board from the Special menu. The FEN can then be copied to the clipboard (using Ctrl+C).

Rival and Winboard

Adding Rival as a Winboard engine

The following is an example of how the Rival engine can be added to the winboard.ini file.

In the firstChessProgramNames section /firstChessProgramNames="\"newrival -winboard 10000 -info\" /fd=\"c:\\Program Files\\RivalChess\" GNUChess Other Engines... "

In the secondChessProgramNames section /secondChessProgramNames="\"newrival -winboard 10000 -info\" /sd=\"c:\\Program Files\\RivalChess\" GNUChess Other Engines... "

Rival on the Internet

The following is an example of how to run Rival on an ICS, such as the Internet Chess Club. This assumes that newrival.exe and any additional files such as newrival.opt and newrival.opn are in the same directory as winboard.

winboard -zp -ics -icshost chessclub.com -autoflag -fcp "newrival -winboard" -icshelper timestamp

Using the above command you can log into the ICC and type "seek 2 5", for example. Use the ICC command "+alias gameend seek 2 5" to allow the program to play unattended.

Analysing a Winboard log

The Analyse Winboard Log option from the Special menu allows Rival to read the winboard.debug file that Winboard writes if Winboard's -debug option is used. This is one way of obtaining the results of the matches played between two Winboard engines. For example, the following command may be used to initiate a multi-game match between two engines.

winboard.exe -debug /matchGames 200 /tc 1 /inc 0 /savePositionFile c:\_source\multimatch.txt

Rival will analyse this file to determine the results of any completed games that it finds. It will report the number of white wins and black wins and draws and will report the mates, resigns and flag-falls for the first and second engines.

Other Winboard information

The following Winboard commands are supported when recieved by Rival:
  • new
  • white
  • black
  • go
  • level
  • time
  • otim
  • move
  • draw
  • quit
  • edit
  • post
  • nopost
  • easy
  • hard
Rival sends out the following commands to Winboard:
  • move MOVE
  • offer draw
  • 1-0 {White Mates}
  • 0-1 {Black Mates}
  • 1/2-1/2 {Stalemate}
  • 1/2-1/2 {Draw by Repetition}
  • 1/2-1/2 {Draw by Fifty Moves}
  • Illegal move (reason): move

Logs

Verbose

When this option is switched on, a file named verbose.txt will be created. The file will be updated with various information on tasks being performed by Rival. These are generally of use when debugging the application and have no real structure or format. The file can be recreated by switching the option off and then on again.

Timings

When this option is switched on, two files will be created. The files can be recreated by switching the option off and then on again.

nodes.txt
This holds the number of nodes per second for each search in the current session. This is useful when playing Rival against another engine using Winboard to ensure that Rival is playing at a reasonable speed.

timings.txt
This will hold information about Rival's previous search. An example is shown below. The Case lines are used for adding timing information to various parts of the program when debugging.

Searched 305799 nodes in 8.311000 Seconds
Nodes/Seconds = 36794
Average time spent at each node = 0.0272ms
Hash Successes = 15439/58819
Score 10
Depth 7
Average Number of Moves Generated 29.6
Average Number of QuickMoves Generated 1.2
MakeMove ACT 1016ms/380176=0.0027ms
GetMoveList ACT 1361ms/57696=0.0236ms
GetQuickMoveList ACT 590ms/74040=0.0080ms
GetHashMove ACT 281ms/58819=0.0048ms
StoreHashMove ACT 220ms/50010=0.0044ms
Evaluate ACT 1586ms/119120=0.0133ms
Case 1 ACT 0ms/1=0.0000ms pn=0.0000ms
Case 2 ACT 0ms/1=0.0000ms pn=0.0000ms
Case 3 ACT 0ms/1=0.0000ms pn=0.0000ms
Case 4 ACT 0ms/1=0.0000ms pn=0.0000ms
MakeMove Calls/Node 1.24, Time 0.0033ms
GetMoveList Calls/Node 0.19, Time 0.0045ms
GetQuickMoveList Calls/Node 0.24, Time 0.0019ms
GetHashMove Calls/Node 0.19, Time 0.0009ms
StoreHashMove Calls/Node 0.16, Time 0.0007ms
Evaluate Calls/Node 0.39, Time 0.0052ms

Principal Variation

This holds the each principal variation of each Rival search in the current session in a file called pv.txt. The file may be recreated by switching the option off and the on again.

********* Starting search *********
rnbqkbnr/pppppppp/8/8/8/7P/PPPPPPP1/RNBQKBNR b QKqk - 0 1
**********************************
Sec:0.07 Dpt:1 Val:0.00 Nds:4 PV: h6
Sec:0.07 Dpt:1 Val:0.02 Nds:7 PV: g6
Sec:0.07 Dpt:1 Val:0.03 Nds:9 PV: g5
Sec:0.07 Dpt:1 Val:0.10 Nds:13 PV: e6
Sec:0.07 Dpt:1 Val:0.17 Nds:15 PV: e5
Sec:0.07 Dpt:1 Val:0.19 Nds:26 PV: Nf6
Sec:0.08 Dpt:2 Val:0.01 Nds:32 PV: Nf6 Nf3
Sec:0.08 Dpt:3 Val:0.19 Nds:193 PV: Nf6 Nf3 Nc6
Sec:0.10 Dpt:4 Val:0.01 Nds:1180 PV: Nf6 Nf3 Nc6 Nc3
Sec:0.26 Dpt:5 Val:0.17 Nds:4100 PV: Nf6 Nf3 Nc6 Nc3 e5
Sec:0.65 Dpt:6 Val:0.02 Nds:23737 PV: Nf6 Nf3 Nc6 d4 d5 Nc3
Sec:1.65 Dpt:6 Val:0.01 Nds:65238 PV: e5 Nc3 Nf6 Nf3 Nc6 e4
Sec:7.17 Dpt:7 Val:0.10 Nds:273323 PV: e5 d4 exd4 Qxd4 Nc6 Qe4+ Be7 Nf3

Additional features

Editing a position

There are two ways to set up a position in Rival.

Visual Setup

This option allows the board to be setup by clicking the right mouse button on the board. The popup menu provides options to place a chosen piece on the clicked square. The popup menu also provides options to clear a square, clear the board and to exit setup or abort setup.

Enter FEN Position

This option allows the board to be setup by entering (or pasting) a FEN position. When the setup dialog box is opened, the FEN that is displayed initially is the current board position.

Create opening library

Rival allows to creation of its opening library from a number of PGN files. When selecting the Create Opening Book option on the Special menu, a dialog box is displayed that provides the following options.

Maximum ply

Specifies the maximum number of half moves from the starting position that will be considered when generating the opening library.

Maximum number of positions

Specifies the maximum number of unique positions that will be considered when generating the opening library. The number of positions that is written to the final book may be fewer than this depending on the filtering imposed by some of the options described below.

Minimum results per position

Specifies the minimum number of games with results in which a position must have been reached in order for it to be included in the opening library.

Win percentage White/Black

This specifies the percentage of wins that the side who makes the move that leads to a position must have achieved from that position in order for the position to be included in the opening library.

Include unknown results

If this option is checked, positions may be included in the opening library when none of the games in which the position occured had a known result. If it is not checked, only positions where at least one result was known are included.

Count games before generating

Determines whether the number of games in the selected PGN files is displayed before generating the library. This is for information purposes only.

Quit on error

Specifies whether the creation process will halt when it encounters an error in the PGN file or whether to log the error to the create.log file and continue.

When the creation process has finished, the following statistics will be displayed

Files Used

The number of PGN files examined.

Positions meeting minimum inclusion criteria

This is the number of positions written to the opening book.

Unique positions

The number of unique positions encounterd.

Positions examined

The total number of positions examined including duplicates.

Games used

The number of games examined.

Games containing unverified moves

The number of games in which an unverified move was encountered.

Running test suites

There are two formats that Rival uses to run test suites. This is a recent addition and therefore may be subject to unanticipated problems which will, of course, be corrected as soon as they are discovered. All the example suites provided with Rival work fine on my machine. In both cases, a file appended with .suite is written which details the results for each position and also provides a summary. A summary.suite file will also be written.

EPD format

When using an EPD file of test positions, Rival requests the maximum depth and time to apply to all the positions in the file. It will also ask whether you wish to exit each position as soon as the correct move has been found (only tested at the end of each search iteration).

RSU format

Rival's own format was created before I became aware of the EPD standard and allows the specification of a minimum score as well as the correct move. The depth, time and score may be applied individually to each position in the file. When a particular parameter is not specified for a position, Rival assumes the previous value for the parameter. Semi-colons may be used at the start of a line to make the whole line a comment.

Example RSU content


; Position 1
; This one will be fully solved only at >20 plies
Depth 30 Time 600 Move Kb1 Score 300
FEN: 8/k7/3p4/p2P1p2/P2P1P2/8/8/K7/ w - -

; Position 2
; Set the depth to 8 until further notice
Depth 8 Move Nd3 Score 040 Time 1000s
FEN: 8/8/2p5/1p1p4/1P1P4/p1P1k3/1nK5/2N5/ b - -

; Position 3
Move Rxb2 Score 040
FEN: 8/pR4pk/1b6/2p5/N1p5/8/PP1r2PP/6K1/ b - -