virtual mainline

In studies, we sometimes have several main lines,for example one that leads to a win with a rook promotion and another that leads to a win with a bishop promotion. However, the PGN file standard forces one of these variations to be the "main" line, and the other to be a "variation". This may lead to inaccurate searches or to incorrect artistic evaluation.

The filter virtualmainline allows us to overcome this technical limitation of the PGN standard.

A position is in a virtual mainline if all of its ancestor branches were initiated by black. For example, consider the PGN file:

  1.e4 (1.d4 d5)
        c5 (1..e5
            2.Nf3 (2.f4 d6)

The 3 positions following each of the highlighted moves would match a virtualmainline filter. The position after the not-highlightd 2..d6 is not a virtualmainline because it is arrived at after a white initiated branch represented by the move 2.f4

More formally, there are three rules that determine the set of virtual mainline positions in a PGN file:

  1. The initial position is a virtual mainline position.
  2. If a position is a black-to-move virtual mainline position, then its children are all virtual mainline positions.
  3. If a position is a white-to-move virtual mainline position, then its primary child is a virtual mainline position
The set of virtual mainline positions is the set of positions classified as virtual mainline using only the above three rules.

The virtualmainline filter matches a position that is a virtual mainline position:


Note that this only makes sense if variations is set in the CQL header, which you must do explicitly. If variations is not set, then every position is a mainline position, and thus also a virtual mainline position as well.

You can also use the command line option -virtualmainline, which is an abbreviation for -cql virtualmainline. The -virtualmainline command line option also sets the variations flag.

Note that -virtualmainline differs from -variations or -mainline in that -virtualmainline does not apply recursively to move or to positions considered within filters that modify the current position (like find, line, echo).