⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pv.cpp

📁 超强国际象棋引擎
💻 CPP
字号:
// pv.cpp

// includes

#include <cstring>
#include "move.h"

// functions

// pv_is_ok()

bool pv_is_ok(const mv_t pv [])
    {
    int pos;
    int move;

    if(pv == NULL)
        return false;

    for ( pos = 0; true; pos++ )
        {
        if(pos >= 256)
            return false;
        move = pv[pos];

        if(move == 0)
            return true;

        if(!move_is_ok(move))
            return false;
        }

    return true;
    }

// pv_copy()

void pv_copy(mv_t dst [], const mv_t src [])
    {
    while((*dst++ = *src++) != 0)
    ;
    }

// pv_cat()

void pv_cat(mv_t dst [], const mv_t src [], int move)
    {

    *dst++ = move;

    while((*dst++ = *src++) != 0)
    ;
    }

// pv_to_string()

bool pv_to_string(const mv_t pv [], char string [], int size)
    {
    int pos;
    int move;

    // init

    if(size < 512)
        return false;

    pos = 0;

    // loop

    while((move = *pv++) != 0)
        {
        if(pos != 0)
            string[pos++] = ' ';

        move_to_string(move, &string[pos], size - pos);
        pos += strlen(&string[pos]);
        }

    string[pos] = '\0';

    return true;
    }

// end of pv.cpp

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -