將製作ejcees(中國象棋打譜程式)

分享和讨论Javascript相关的话题
回复
头像
ejsoon
圈圈精英
圈圈精英
帖子: 4746
注册时间: 2022年 11月 18日 17:36
为圈友点赞: 173 次
被圈友点赞: 202 次
联系:

Re: 將製作ejcees(中國象棋打譜程式)

帖子 ejsoon »

自動播放時不能編輯評論。
https://ejsoon.vip/
弈趣極光:享受思維樂趣
头像
ejsoon
圈圈精英
圈圈精英
帖子: 4746
注册时间: 2022年 11月 18日 17:36
为圈友点赞: 173 次
被圈友点赞: 202 次
联系:

Re: 將製作ejcees(中國象棋打譜程式)

帖子 ejsoon »

改進:

當保存undo_stack時,也一並把tool-save的結果異步存到localstorage中。

當打開頁面時,首先讀取localstorage的數據。

只需給出要修改的地方,所有的代碼和注釋都要是英文。
附件
儲存與載入.7z
(104.25 KiB) 已下载 8 次
https://ejsoon.vip/
弈趣極光:享受思維樂趣
头像
ejsoon
圈圈精英
圈圈精英
帖子: 4746
注册时间: 2022年 11月 18日 17:36
为圈友点赞: 173 次
被圈友点赞: 202 次
联系:

Re: 將製作ejcees(中國象棋打譜程式)

帖子 ejsoon »

代码: 全选

在中國象棋引擎中,b2e2 b9c7 b0c2 a9b9 a0b0 c6c5 h0g2 b7b3 g3g4 g9e7 c2a1 b3b4 h2h4 b4h4 b0b9 c7b9 g2h4 h9f8這些坐標是何意義?
https://ejsoon.vip/
弈趣極光:享受思維樂趣
头像
ejsoon
圈圈精英
圈圈精英
帖子: 4746
注册时间: 2022年 11月 18日 17:36
为圈友点赞: 173 次
被圈友点赞: 202 次
联系:

Re: 將製作ejcees(中國象棋打譜程式)

帖子 ejsoon »

代码: 全选

將以下英文翻譯成繁體中文,代碼部分不用翻譯,標題部分保留英文並在後方用括號寫出繁體中文。

UCI & Commands

The Universal Chess Interface (UCI) is a standard text-based protocol used to communicate with a xiangqi engine and is the recommended way to do so for typical graphical user interfaces (GUI) or chess tools. Pikafish implements the majority of its options.

Developers can see the default values for the UCI options available in Pikafish by typing ./pikafish uci in a terminal, but most users should typically use a xiangqi GUI to interact with Pikafish.
Standard commands
quit

Quit the program as soon as possible.
uci

Tell the engine to use the UCI (universal chess interface).
This will be sent once, by a GUI, as a first command after the program boots to tell the engine to switch to UCI mode.
After receiving the uci command the engine will identify itself with the id command and send the option commands to tell the GUI which engine settings the engine supports.
After that, the engine will send uciok to acknowledge the UCI mode.
If no uciok is sent within a certain time period, the engine task will be killed by the GUI.
Example

setoption

Usage: setoption name <id> [value <x>]

This is sent to the engine when the user wants to change the internal parameters of the engine. For the button type no value is needed.
One string will be sent for each parameter and this will only be sent when the engine is waiting.

Examples:

> setoption name Threads value 6
> setoption name EvalFile value pikafish.nnue
> setoption name UCI_ShowWDL value true
> setoption name Clear Hash

List of options:

    Debug Log File type string default
    Write all communication to and from the engine into a text file.

    NumaPolicy type string default auto Bind threads to ensure execution on a specific NUMA node. Improves performance on systems with multiple CPUs or CPUs with multiple NUMA domains. The following values can be used:
        system - gathers NUMA node information from the system (including affinities preset by the user or the GUI), for each thread binds it to a single NUMA node
        none - assumes there is 1 NUMA node, never binds threads
        auto - this is the default value, automatically selects system or none depending on the number of set threads and available NUMA nodes. Will only select system when the number of threads reaches a system-dependent threshold.
        hardware - gathers NUMA node information for the underlying hardware (disregards and overrides affinities preset by the user or the GUI), for each thread binds it to a single NUMA node
        [[custom]] - specify precisely the available CPUs per numa domain. ':' separates numa nodes; ',' separates cpu indices; supports "first-last" range syntax for cpu indices, for example 0-15,32-47:16-31,48-63

    Threads type spin default 1 min 1 max 1024
    The number of CPU threads used for searching a position. For best performance, set this equal to the number of CPU cores available.

    Hash type spin default 16 min 1 max 33554432
    The size of the hash table in MB. It is recommended to set Hash after setting Threads.

    Clear Hash type button
    Clear the hash table.

    Ponder type check default false
    Let Pikafish ponder its next move while the opponent is thinking.

    MultiPV type spin default 1 min 1 max 500
    Output the N best lines (principal variations, PVs) when searching. Leave at 1 for the best performance.

    Move Overhead type spin default 10 min 0 max 5000
    Assume a time delay of x ms due to network and GUI overheads. This is useful to avoid losses on time in those cases.

    nodestime type spin default 0 min 0 max 10000
    Tells the engine to use nodes searched instead of wall time to account for elapsed time. Useful for engine testing. When this option is set, the engine is only limited by the total amount of nodes searched per game; this limit is calculated once per game. The initial time control values in milliseconds (time time and increment per move inc) are used as input values to calculate the total number of nodes per game (totalnodes). The increment per move inc is used as if it was just one move per game. The formula is totalnodes = (time + inc * 1) * nodestime. Suppose you specified nodestime = 600, and the time control per game is 300 seconds plus 3 seconds increment per move ("300+3s"), or 300000 milliseconds plus 3000 milliseconds increment per move. In that case, the maximum total number of nodes searched per game by the engine is totalnodes = (300000 + 3000 * 1) * 1000 = 181800000 (one hundred eighty-one million, eight hundred thousand) nodes, regardless of how much wall time it will actually take.

    UCI_ShowWDL type check default false
    If enabled, show approximate WDL statistics as part of the engine output. These WDL numbers model expected game outcomes for a given evaluation and game ply for engine self-play at fishtest LTC conditions (60+0.6s per game).

    EvalFile type string default pikafish.nnue
    The name of the file of the NNUE evaluation parameters. Depending on the GUI the filename might have to include the full path to the folder/directory that contains the file. Other locations, such as the directory that contains the binary and the working directory, are also searched.

position

Usage: position [fen <fenstring> | startpos ]  moves <move1> .... <movei>

Set up the position described in fenstring.

Note

If this position is from a different game than the last position sent to the engine, the GUI should have sent a ucinewgame in between.

Examples:

> position startpos
> position fen rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR w - - 0 1
> position fen rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR w - - 0 1 moves h2e2 h9g7 h0g2 g6g5

ucinewgame

This is sent to the engine when the next search (started with position and go) will be from a different game. This can be a new game the engine should play or a new game it should analyze but also the next position from a test suite with positions only.
If the GUI hasn't sent a ucinewgame before the first position command, the engine won't expect any further ucinewgame commands as the GUI is probably not supporting the ucinewgame command.
So the engine will not rely on this command even though all new GUIs should support it.
As the engine's reaction to ucinewgame can take some time the GUI should always send isready after ucinewgame to wait for the engine to finish its operation. The engine will respond with readyok.

This clears the hash and any information which was collected during the previous search.
Example

isready

This is used to synchronize the engine with the GUI.
When the GUI has sent a command or multiple commands that can take some time to complete, this command can be used to wait for the engine to be ready again or to ping the engine to find out if it is still alive.
e.g. this should be sent after setting the path to the tablebases as this can take some time.
This command is also required once, before the engine is asked to do any searching, to wait for the engine to finish initializing.
This command will always be answered with readyok and can be sent also when the engine is calculating in which case the engine will also immediately answer with readyok without stopping the search.

Example:

> isready
readyok

go

Start calculating on the current position set up with the position command.
There are a number of parameters that can follow this command and all will be sent in the same string.
If no parameter is sent, then go depth 245 will be executed.
Example: go infinite

Example: go depth

Example: go mate

Example: MultiPV

Example: UCI_ShowWDL

Parameters:

    searchmoves <move1> .... <movei>
    Restrict search to these moves only.
    Example: After position startpos and go infinite searchmoves h2e2 h0g2 the engine will only search the two moves h2e2 and h0g2 in the initial position.

    ponder
    Start searching in pondering mode. It won't exit the search in ponder mode, even if it's mate!
    This means that the last move sent in in the position string is the ponder move.
    The engine can do what it wants to do, but after a ponderhit command it will execute the suggested move to ponder on.
    This means that the ponder move sent by the GUI can be interpreted as a recommendation about which move to ponder.
    However, if the engine decides to ponder on a different move, it won't display any mainlines as they are likely to be misinterpreted by the GUI because the GUI expects the engine to ponder on the suggested move.

    wtime <x>
    White has x ms left on the clock.

    btime <x>
    Black has x ms left on the clock.

    winc <x>
    White increment per move in ms if x > 0.

    binc <x>
    Black increment per move in ms if x > 0.

    movestogo <x>
    There are x moves to the next time control
    Note: this will only be sent if x > 0, if you don't get this and get the wtime and btime it's sudden death.

    depth <x>
    Search x plies only.

    nodes <x>
    Search x nodes only.

    mate <x>
    Search for a mate in x moves.

    movetime <x>
    Search exactly x ms.

    infinite
    Search until the stop command. Stockfish won't exit the search without being told so in this mode!

    perft <x>
    A debugging function to walk the move generation tree of strictly legal moves to count all the leaf nodes of a certain depth.

stop

Stop calculating as soon as possible
Example

ponderhit

The user has played the expected move.
This will be sent if the engine was told to ponder on the same move the user has played.
The engine will continue searching but switch from pondering to normal search.
Example

Non-standard commands
bench

This runs a standard search benchmark on a pre-selected assortment of positions. It prints the total combined nodes searched, as well as time taken. This command serves two primary purposes:

    it can be used as a basic nodes-per-second speed benchmark

    the total number of nodes searched can be used as a "signature" or "fingerprint" of the exact search algorithm version in the binary

The main utility of the nodecount signature is to ensure that, when testing possible new patches on Fishtest, the author and workers are working on the exact same code. It also can be used to verify which version or release you have locally. Each functional commit in the Pikafish commit history includes a standardized nodecount signature. (For example, the nodecount signature of Pikafish 2023-03-05 is 1146720.)

There are several parameters which can be used to tweak exactly what sort of benchmark is run:

Usage: bench [ttSize] [threads] [limit] [fenFile] [limitType]

The standardized nodecount signature of a version is obtained using all default parameters.

Note: All parameters are optional.
Parameter     Type     Default     Values     Meaning
ttSize     number     16         Hash value
threads     number     1         Number of threads
limit     number     13         The limit of limitType
fenFile     string     default     default, current or [file path]     The positions used for the bench
limitType     string     depth     depth, perft, nodes, movetime or eval.     The type of limit
Example

Note

    String parameters are case-sensitive. In case of invalid values of string parameters, the error is not given, and the behavior is undefined (the program does not fall back to a default value).
    The [file path] may contain one or more positions, each on a separate line.

d

Display the current position, with ASCII art and FEN.
Example

eval

Display the static evaluation of the current position.
Example

compiler

Give information about the compiler and environment used for building a binary.
export_net [filename]

Exports the currently loaded network to a file. If the currently loaded network is the embedded network and the filename is not specified then the network is saved to the file matching the name of the embedded network, as defined in evaluate.h. If the currently loaded network is not the embedded network (some net set through the UCI setoption) then the filename parameter is required and the network is saved into that file.
flip

Flips the side to move.
https://ejsoon.vip/
弈趣極光:享受思維樂趣
头像
ejsoon
圈圈精英
圈圈精英
帖子: 4746
注册时间: 2022年 11月 18日 17:36
为圈友点赞: 173 次
被圈友点赞: 202 次
联系:

Re: 將製作ejcees(中國象棋打譜程式)

帖子 ejsoon »

附件
ejcees20260318local99932.7z
(35.61 KiB) 已下载 6 次
https://ejsoon.vip/
弈趣極光:享受思維樂趣
头像
ejsoon
圈圈精英
圈圈精英
帖子: 4746
注册时间: 2022年 11月 18日 17:36
为圈友点赞: 173 次
被圈友点赞: 202 次
联系:

Re: 將製作ejcees(中國象棋打譜程式)

帖子 ejsoon »

當有範圍選取時,新建和保存都應該跟導出動畫一樣,有三種情況。
https://ejsoon.vip/
弈趣極光:享受思維樂趣
头像
ejsoon
圈圈精英
圈圈精英
帖子: 4746
注册时间: 2022年 11月 18日 17:36
为圈友点赞: 173 次
被圈友点赞: 202 次
联系:

Re: 將製作ejcees(中國象棋打譜程式)

帖子 ejsoon »

附件
ejcees20260318localredo99933.7z
(35.55 KiB) 已下载 3 次
https://ejsoon.vip/
弈趣極光:享受思維樂趣
头像
ejsoon
圈圈精英
圈圈精英
帖子: 4746
注册时间: 2022年 11月 18日 17:36
为圈友点赞: 173 次
被圈友点赞: 202 次
联系:

Re: 將製作ejcees(中國象棋打譜程式)

帖子 ejsoon »

把翻轉也記到undo - redo和localstorage裡面去。
https://ejsoon.vip/
弈趣極光:享受思維樂趣
回复

在线用户

正浏览此版面之用户: 没有注册用户 和 1 访客