Changes

Jump to: navigation, search

Files

2,684 bytes added, 16:54, 9 May 2018
Created page with "'''Home * Chess * Files''' ''For disambiguation see also [https://en.wikipedia.org/wiki/Computer_file Computer file] '' '''Files''' are the eight vertical..."
'''[[Main Page|Home]] * [[Chess]] * Files'''

''For disambiguation see also [https://en.wikipedia.org/wiki/Computer_file Computer file] ''

'''Files''' are the eight vertical lines or columns of a [[Chessboard]], labeled from 'A' to 'H', or 'a' to 'h'. Each file contains eight vertically arranged [[Squares]] of alternating white and black, or light and dark [[Color]].

=File Names=
In a descriptive notation, files are also nominated by the [[Pieces]] from their [[Initial Position|initial position]] (similar to [[Pawn|Pawns]]), like Rook-Files (a- and h-File, see diagram), Knight-Files (b- and g-File), Bishop-Files (c- and f-File), and Queen-File (d-File) and King-File (e-File), also called Center Files.

<fentt border="a1" style="font-size:24pt">(+)......(+)/(+)......(+)/(+)......(+)/(+)......(+)/(+)......(+)/(+)......(+)/(+)......(+)/(+)......(+)</fentt>

=Square Mapping Notes=
Whether the square difference of neighbored squares on a [[Ranks|rank]] or file is either 1 or 8, depends on the square mapping. We further rely on [[Square Mapping Considerations#LittleEndianRankFileMapping|little-endian rank-file mapping]], which keeps consecutive [[Squares|squares]] of a rank as neighbored elements in Memory (or register).

=Square Difference=
Within a 0..63 square index range and the mentioned [[Square Mapping Considerations#LittleEndianRankFileMapping|square mapping]] (a1 = 0), the difference of two neighbored squares on a File is '''eight'''.

=Enumeration=
As mentioned, on a [[Chessboard]] the eight files are labeled from 'A' to 'H'. To make them zero based indices as appropriate for [[C]] like programming languages, we enumerate files from 0 to 7. [[Little-endian]] file-mapping (as used here) assigns the A-File to index zero. Three bits are required to enumerate from 0 to 7.

A [[Little-endian|little-endian]] file-mapping enumeration in [[Cpp|C++]] might look like this:
<pre>
enum enumFile {
efAFile = 0,
efBFile = 1,
efCFile = 2,
efDFile = 3,
efEFile = 4,
efFFile = 5,
efGFile = 6,
efHFile = 7,
};
</pre>
=File from Square=
Rank-File mapping of squares keeps the file as the three lower bits of a Square index.
<pre>
file = square & 7; // modulo 8
</pre>
<span id="FileDistance"></span>
=File-Distance=
The file-distance is the [[Avoiding Branches#Abs|absolute]] difference between two files (their 0-7 indices). The maximum file-distance is 7.
<pre>
fileDistance = abs (file1 - file2);
fileDistance = abs (file2 - file1);
</pre>
=See also=
* [[Half-open file]]
* [[Open file]]
* [[Pawns and Files (Bitboards)]]
* [[Ranks]]
* [[Diagonals]]
* [[Anti-Diagonals]]
* [[Squares]]
* [[Intersection Squares]]

'''[[Chess|Up one Level]]'''

Navigation menu