We present an algorithm that correctly updates the Forsyth-Edwards Notation (FEN) chessboard character string after any move is made without the need for an intermediary array representation of the board. In particular, this relates to software that have to do with chess, certain chess variants and possibly even similar board games with comparable position representation. Even when performance may be equal or inferior to using arrays, the algorithm still provides an accurate and viable alternative to accomplishing the same thing, or when there may be a need for additional or side processing in conjunction with arrays. Furthermore, the end result (i.e. an updated FEN string) is immediately ready for export to any other internal module or external program, unlike with an intermediary array which needs to be first converted into a FEN string for export purposes. The algorithm is especially useful when there are no existing array-based modules to represent a visual board as it can do without them entirely. We provide examples that demonstrate the correctness of the algorithm given a variety of positions involving castling, en passant and pawn promotion.
翻译:我们提出一种算法,在不需董事会中间数组代表而进行任何移动后正确更新Forsyth-Eward Satation (FEN) 棋盘字符串。 特别是, 这涉及到与象棋、某些象棋变种以及甚至可能相似的棋盘游戏相关的软件, 具有相似的位置表示。 即使在性能可能与数组相等或劣于使用数组时, 算法仍然提供了完成相同事情的准确和可行的替代方法, 或者可能需要与数组同时进行额外的或侧面的处理。 此外, 最终结果( 即更新的FEN字符串) 立即准备出口到任何其他内部模块或外部程序, 不同于为出口目的需要首先转换成FEN 字符串的中间数组。 当没有基于数组的模块代表视觉板时, 算法特别有用, 因为没有这些模块可以完全做到。 我们提供实例, 以证明算法的正确性, 是因为有各种各样的位置, 涉及投射、 传票和当铺垫。