Module:Sports table/Chess/doc explained

This style for Lua-based is meant to build group and league tables for chess round-robin competitions with a crosstable. Unlike the WDL style, in this style wins and total points are calculated from match data that is provided. Therefore, if you want to use this style without a crosstable, you still need to provide all of the information that would appear in a crosstable, so you might want to explore other options, such as the WDL style. This documentation explains how to use this module with the Chess style in an article or template; check the table of contents for specific items.

Usage

Basic usage

In its simplest form only several parameters need to be used to build a table.

What you type
What it looks like
The main command is the {{#invoke:Sports table|main|style=Chess}} statement which calls the module with the Chess style and enables you to set everything up. Then you list the positions of the teams as,, etc for however many teams you need in the table. You can use full team names there without spaces as the team codes if you want, but using short codes (as in the example) can make it easier. For each team, you now define the parameters (with TTT replaced by the team code) which determine what name is shown in the table; you can use wiki markup and templates in here as well, as shown in the example. The points and wins will default to 0 if no match data is provided. See
  1. Points
to see how to provide this data. See
  1. Footer options
and
  1. Dating
to see how to change the source and update date.

Points

Points are calculated using match data.

What you type
What it looks like
The match data that is used to calculate points is given by where XXX and YYY are different team codes. This parameter takes a value of W+B, where W is the result as white and B is the result as black. The results use the character 1 for a win, ½ for a draw, and 0 for a loss. Note that incomplete information such as ½+ is allowed, and still calculates correctly. As a default, a win is worth 1 point, a draw 0.5 points and a loss 0 points, these values can be overwritten to what you need by, and, if such parameters are provided. Head-to-head values are not calculated automatically, and are given by the parameter . The parameter determines whether the calculated points and head-to-head values (if any are given) are displayed as fractions or decimals. Note that this parameter should only be set to yes if, and are a multiple of . Otherwise, an incorrect fraction will be displayed.

Crosstable

Because the match data already needs to be provided for use with this style, very little additional data is needed to create the crosstables.

What you type
What it looks like
The parameter determines whether the crosstable is shown, and defaults to no. In the crosstable, the values given by are shown. The headers for the columns are given by . If no value for is given, then one is created automatically from the team code, with appropriate wikilinks and {{flagathlete}} data included. It is recommended to set the value of using the {{Abbr}} template with a short abbreviation (possibly the player's initials) to appear in header of the columns of the crosstable.

Customizing the crosstable

There are a few parameters that can be used to customize crosstables.

What you type
What it looks like
What you type
What it looks like
As shown in this example, no parameter is needed to determine the number of games per match. This is calculated automatically from the largest number of plus signs in the match data.If the parameter is set to "yes", then the automatically generated short name is generated from the position in the table rather than the team code.In the previous example, when no parameter was given for a team whose contained a {{flagathlete}} template, a short column header was created containing the appropriate flag.However, when is set to "noflag", then no flag is displayed in the automatically created header.If instead is set to "nocountry", then no country code is displayed in the automatically created header as well as no flag.Column headers explicitly defined by are not affected by or .If the parameter is set to yes, then draws in the crosstable will be displayed as instead of using the unicode character ½.While the games in a match typically show the white background first, and the black background second, this behavior can be changed using the parameter.When no data is present, the background alternates between white and black for each successive game.If the parameter is set to no, then no cells in the crosstable will be colored black, even if there is data present.The parameter determines the color of the cells of the crosstable's main diagonal.Currently, may take on the values "gray", "grey", "lightgray", "lightgrey", or "silver", as well as "#xxx" or "#xxxxxx" where the x indicates a valid hexadecimal digit. If no value or an invalid value is given, then the entries on the main diagonal will display an Em dash in a cell with the table background color.

Customizing columns

Several columns can be customized in these tables.

Altering default columns

You may choose not to display some of the default columns.

What you type
What it looks like
The column for the number of games played can be hidden with the parameter.Whether or not that column is hidden, score can be displayed as score / games played by using the parameter. This parameter should be set to yes only when is set to yes, in order to avoid duplicated information.To hide the H2H and Wins columns, just set and, respectively, to no. Similar behavior may be obtained by using the parameter to only show the games played and score columns to the right of the player name. For more information on, or on the parameter used in this table, see
  1. Appearance
.The leftmost column, which specifies the position of each player, may be hidden using the parameter.The parameter may be used to give the player column a custom header, instead of the default value of Player seen in other examples on this page.

Wins, Draws, and Losses

For backwards compatibility with the WDL style, it is possible to choose whether to display the Wins, Draws, and Losses columns.

What you type
What it looks like
We saw the parameter in the previous example, but there are also and parameters, which similarly determine whether the Draws and Losses columns, respectively, will be shown. The default value of is yes, while the default values of and are no.As seen in previous tables, the H2H column usually appears before the Wins column. If you wish the H2H column to show up immediately after whichever of the Wins, Draws, and Losses columns are present, you may set the parameter to no.If the parameter is set to yes, then any wins, draws, or losses will only be displayed if head to head data has been defined for a given player.

Sonneborn–Berger score

In addition to other automatic calculations done by this module, there is also the possibility to calculate the Sonneborn–Berger score.

What you type
What it looks like
The parameter shows a column containing the Sonneborn–Berger score of each player calculated from their match results.The Sonneborn–Berger score is calculated by taking the number of points gained against a given opponent multiplied by the total number of points that opponent scored, and then summing this product over all of the players.If the parameter is set to yes, then the column containing the Sonneborn–Berger score of each player appears immediately before the win column. If is also set to yes, the column containing the Sonneborn–Berger score of each player comes after the HTH column.If the parameter is set to the default value of no, then this column comes after both the H2H column as well as whichever of the Wins, Draws, and Losses columns are present.The values in this column are always given as decimals regardless of .If the parameter is set to yes, then a calculated Sonneborn–Berger score will only be displayed if head to head data has been defined for a given player.Additionally, you may set the parameter to yes for any given player with team code XXX in order to prevent that particular player's Sonneborn–Berger score from being displayed.

Other additional columns

The data for this table comes from the 3rd Sinquefield Cup, which was a single round-robin event held in 2015.

What you type
What it looks like
If the parameter is set to yes, then a column is shown immediately after the player names with values defined by for each team code XXX.Similarly, if the parameter is set to some number N, then N columns are shown just before the crosstable, if one is present, with values defined by for each column N and each team code XXX.The header of any extra column may be set using for each N.The header of the rating column also includes some information that may be chosen by a parameter. The contents of the parameter will be displayed in small text below the word "Rating" in the header.Note that it is possible to include the {{refn}} template inside any of these custom headers. Because all other notes in this module use the "lower-alpha" group, it is recommended that any use of {{refn}} in a parameter in this module also use the "lower-alpha" group. If any notes are generated by the module, then a {{reflist|group=lower-alpha}} template will also be generated at the end of the module. However, if no notes are generated by the module, then you will have to call this yourself as shown at the end of the example. There is no detriment to calling this twice, so it is a good idea to include this template yourself whenever you call {{refn}} in a parameter.For more information on notes in this module, see
  1. Notes
.For information on using instead of see
  1. Matchrow
.For information on,, and used in this table, see
  1. Footer options
.

Special case for only two players

When there are only two players, the module enters a special case.The data for the following table comes from the 2014 World Chess Championship.

What you type
What it looks like
As can be seen from this example, the crosstable now displays a column header for each game in the match, instead of the normally displayed column header for each player. As such, there is no longer a main diagonal of NULL matches. Also, if were defined, its value would never be used.Instead, headers in the match table are determined by the parameter for each number N corresponding to a game. The default value for this parameter is the number specified by N.It is highly recommended to use in two player tables, so that each column can represent a distinct game, in the order that they are played.It is also recommended that the H2H, Wins, and played columns be hidden in a two player table, because this information is easily discerned from the points.For information on the and parameters used in this table, see
  1. Footer options
.

Matchrow

There are occasions in which it may be preferable to enter all match data corresponding to one row using one parameter.

What you type
What it looks like
Using the parameter, only one parameter is needed for the match data per row, rather than a number of parameters equal to the number of players per row. Note that data is comma separated, with each value between commas equal to the previously discussed data, with the addition of data for the main diagonal. This value for the main diagonal is a dummy value which is never used and only exists to line matches up so that parameter inputs are easier to read. The dummy value is needed even for the two player special case, when no main diagonal is displayed in the crosstable. For this reason, it is advised that not be used in competitions with only 2 players. Additionally, if you use, then all match data needs to be changed each time you change the rank of any player. With, no data needs to be changed when re-ordering players. For this reason, it is advised that only be used in already completed tournaments, where there is no possibility of changing the order of players.The parameter works similarly to in that the data is comma separated, except that each value between commas equal to the previously discussed data.

Tiebreak matches

In many tournaments, if there is a tiebreak between the top players, additional tiebreak games are played. This module is able to handle these tiebreak games.The data for the following table comes from the 2018 World Chess Championship.

What you type
What it looks like
The data for the following table comes from the Tata Steel Chess India Blitz tournament in 2018.
What you type
What it looks like
If is a number greater than 1, then a second crosstable will be displayed which may be used for tiebreak match data.The parameter determines how many players are involved in the tiebreak matches. Note that tiebreak matches only apply to the players at the top of the table.For tiebreak match data, the parameters,,, and are used in place of,,, and, respectively.The second crosstable is then displayed following the same rules as the first crosstable.Note that no information on wins or points is automatically calculated from tiebreak match data.For information on the,, and parameters used in these tables, see
  1. Footer options
.

Generic Customization

There are many customization options that are available regardless of which style is used in . These are presented below.

Note that match notes do not show up properly at this time when the number of games per match is not 1.