Topic on Project:Support desk

Simulating chess by using MediaWiki's delete and move features

4
GTrang (talkcontribs)

Has anyone thought of simulating chess moves by using MediaWiki's delete and move features? The idea is to upload 26 images to depict chess pieces and empty squares. Then, one would create 32 templates showing the initial positions of the pieces (e.g. "Template:A1" would show a picture of a white rook), with a parameter for the square color, perhaps {{{squarecolor}}}. Finally, one would create a "Chess" page transcluding piece position templates 64 times, with the "#ifexist" parser function used to show empty squares in lieu of redlinked templates.

Then, one can start simulating chess moves by moving piece position templates, making sure to always uncheck "Leave a redirect behind" on Special:MovePage. When the target page already exists, it would be asked to be deleted, and deletion would then correspond to capturing a piece. The only exception is with the en passant pawn capture, where the move and the deletion may be done in either order. This is also the only time one needs to manually delete a piece position template. Finally, the only time one needs to edit a piece position template is when promoting a pawn. In this case, the edit and the move may be done in either order.

DannyS712 (talkcontribs)

interesting idea

GTrang (talkcontribs)

To really see the updated chessboard, one must remember to purge or null edit the "Chess" page for every template move.

GTrang (talkcontribs)

Checking whether two of the requirements for castling (king and rook have never been moved, and the squares in between are empty) are met can be done in the following ways (in MediaWiki 1.32 or later; page creations are not logged in previous MediaWiki versions):

  • General
    • Check the histories of the king and rook templates to see whether they contain just the initial creation with no moves.
    • Check to see whether the king and rook templates have edits that are shown as both page creations (rev_parent_id = 0) and "current" (rev_id = page_latest) in the user contributions page.
    • Check the logs for the king and rook templates to see whether they contain just a page creation log entry with no deletion or move log entries.
  • White castling kingside
    • Check the logs for "Template:E1" and "Template:H1" to see whether they contain just a page creation log entry with no deletion or move log entries.
    • Check to see whether "Template:F1" and "Template:G1" are redlinks.
  • White castling queenside
    • Check the logs for "Template:A1" and "Template:E1" to see whether they contain just a page creation log entry with no deletion or move log entries.
    • Check to see whether "Template:B1", "Template:C1", and "Template:D1" are redlinks.
  • Black castling kingside
    • Check the logs for "Template:E8" and "Template:H8" to see whether they contain just a page creation log entry with no deletion or move log entries.
    • Check to see whether "Template:F8" and "Template:G8" are redlinks.
  • Black castling queenside
    • Check the logs for "Template:A8" and "Template:E8" to see whether they contain just a page creation log entry with no deletion or move log entries.
    • Check to see whether "Template:B8", "Template:C8", and "Template:D8" are redlinks.

In any case, if one wants to castle, then one must move the king first, and then the rook.

Reply to "Simulating chess by using MediaWiki's delete and move features"