0
class GameTree {
private:
    class Node {
    public:
        int32_t value;
        uint32_t depth;
        Node* father;
        set<Node*> children;
        uint8_t cntX, cntY;
        uint8_t board[15][15]{};

        Node() {
            father = nullptr;
            children.clear();
            value = INT32_MIN;
            depth = cntX = cntY = 0;
            memset(board, 0, sizeof(board));//初始化数组
        }

        Node(Node* node, uint8_t opeX, uint8_t opeY) {
            depth = node->depth + 1;
            value = is_max_node() ? INT32_MIN : INT32_MAX;
            father = node;
            children.clear();
            cntX = opeX;
            cntY = opeY;
            memcpy(board, node->board, sizeof(board));
            board[cntX][cntY] = (depth & 1u) ? 'B' : 'W';
        }

        bool is_max_node() {
            return (depth & 1u) ^ 1u;
        }

I want to know that what this line mean return (depth & 1u) ^ 1u; And what board[cntX][cntY] = (depth & 1u) ? 'B' : 'W'; is mean? I can't understand that & and ^ mean in these code; Is & mean and ,^ mean or? hope Someone can help me !

phuclv
  • 37,963
  • 15
  • 156
  • 475
CkCool
  • 1
  • 1

0 Answers0