...Processing...
error
big error
Checkmate - Using chess shortcodes at TutnIQ - TutnIQ
Table of contents X

Checkmate - Using chess shortcodes at TutnIQ

Chessboards and chess pieces

  • This tutorial demonstrates the various chess shortcodes we can use to teach chess at TutnIQ.

  • The [chess] shortcode

    This section demonstrates how we can use the [chess] shortcode to create chess boards in our TutnIQ tutorials, FAQs and glossaries.

  • We can use the [chess] shortcode to create a chess board. There are a number of ways to describe the layout of the pieces.

    Starting position

    We can create a chessboard in the start position as follows:

    [chess]
     start
    [/chess]
    

    This will appear as:

    Positioning the pieces

    We can position chess pieces on the board using a comma separated list indicating the square reference and the piece occupying the square.

    Square references

    The numbered horizontal rows of the chessboard are called ranks, while the vertical columns, named with letters (a to h), are called files:

    Squares can be referred to by their coordinates. For example the white king is on square h1.

    The pieces

    Each chess piece is identified by a single uppercase letter:

    LetterDescription
    PPawn
    NkNight
    BBishop
    RRook (castle)
    QQueen
    KKing

    White pieces are indicated with the lowercase letter w. For example, the white king is wK.

    The Black pieces are indicated with the lowercase letter b. For example, the black queen is bQ.

    We separate the square reference from the letter, indicating the piece, with a colon (:).

    If we wanted to create a board with the white king on square c1 (c1:wK), a white rook on f5 (f5:wR) and the black king on e7 (e7:bK), we could use the [chess] shortcode as follows:

    [chess]
    c1:wK,f5:wR,e7:bK
    [/chess]
    

    Which will appear as:

    Forsyth–Edwards Notation (FEN)

    We can lay out a full board using a FEN record. For example the Ruy Lopez or Spanish Opening:

    [chess]
     r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R
    [/chess]
    

    Will appear as:

    Using FEN records to set up specific chess positions

    FEN records consist of six fields, with a space being used as a separator. We are only concerned with the first field, which deals with the placement of the pieces.

    Tips for using Forsyth–Edwards Notation to record piece placement:

    • Piece placement is described from white's point of view.

    • Each rank or row is described, starting from the black side of the board (rank 8) and ending with the white side of the board (rank 1). Each rank is separated with a forward slash (/). There must be eight ranks.

    • Within each rank, each square is described starting with file (column) "a". There must be 8 files per rank.

    • Each piece is identified by a single letter:

      • Pawn = "P";
      • kNight = "N";
      • Bishop = "B";
      • Rook (castle) = "R";
      • Queen = "Q"; and
      • King = "K").
    • White pieces are indicated using uppercase letters ("PNBRQK").

    • Black pieces are indicated using lowercase letters ("pnbrqk").

    • Runs of empty squares are indicated by a number representing the number of adjacent empty squares (1 - 8).

    Example: rank 8 of the previous board (Ruy Lopez) can be described in FEN as r1bqkbnr, which means black rook (a8), empty square, black bishop, black queen, black king, black bishop, black knight, black rook (h8).

    Multiple boards

    We can set up multiple boards at once. This:

    [chess]
    start
    r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R
    [/chess]
    

    Will appear as:

    The [chess] shortcode cannot include Markdown or other shortcodes. Invalid board layouts will result in no board being shown.

  • The chess piece [cp] shortcode

    In this section we will learn how to use the [cp] shortcode to insert chess pieces into our tutorials, FAQs and glossaries.

  • We can use the [cp] shortcode ('cp' = chess piece) to insert chess pieces into our tutorials, FAQs and glssaries.

    This:

    The white king [cp]wK[/cp]
    The white queen [cp]wQ[/cp] 
    The white bishop [cp]wB[/cp] 
    The white knight [cp]wN[/cp]
    The white rook [cp]wR[/cp]
    The white pawn [cp]wP[/cp]
    
    The black king [cp]bK[/cp]
    The black queen [cp]bQ[/cp] 
    The black bishop [cp]bB[/cp] 
    The black knight [cp]bN[/cp]
    The black rook [cp]bR[/cp]
    The black pawn [cp]bP[/cp]
    

    Will appear as:

    The white king
    The white queen
    The white bishop
    The white knight
    The white rook
    The white pawn

    The black king
    The black queen
    The black bishop
    The black knight
    The black rook
    The black pawn

    This shortcode cannot include other shortcodes or Markdown, and has no modifiable attributes.

    Acknowledgments

    We use the chessboard.js library to power the chess boards on TutnIQ. It would probably not have been feasible to develop this functionality from scratch.

    The tutorial logo (floating chessboard with magical rainbow) is a cropped version of the public domain image by David Mark.

ad placeholder

Sharing is caring!

About the author

Course stats

My progress

Find related courses