Esempio n. 1
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */
  createAttribute(attrib_id,"id");
  createAttribute(attrib_name,"name");

  /** children**/
  buildChildren(Types());

  /** other **/
  Bool_array* bool_array =0;
  Float_array* float_array =0;
  IDREF_array* idref_array =0;
  Int_array* int_array =0;
  Name_array* name_array =0;
  SIDREF_array* sidref_array =0;
  Token_array* token_array =0;

  if(queryElement(bool_array)){type = BOOL_ARRAY;}
  if(queryElement(float_array)){type = FLOAT_ARRAY;}
  if(queryElement(idref_array)){type = IDREF_ARRAY;}
  if(queryElement(int_array)){type = INT_ARRAY;}
  if(queryElement(name_array)){type = NAME_ARRAY;}
  if(queryElement(sidref_array)){type = SIDREF_ARRAY;}
  if(queryElement(token_array)){type = TOKEN_ARRAY;}

}
Esempio n. 2
0
THIS::THIS(XmlElement* h):Element(h) {

    /* children */
    buildChildren(Types());

    /* attributes */

}
Esempio n. 3
0
void VDirectoryTree::handleItemExpanded(QTreeWidgetItem *p_item)
{
    if (p_item) {
        buildChildren(p_item);

        VDirectory *dir = getVDirectory(p_item);
        dir->setExpanded(true);
    }
}
Esempio n. 4
0
THIS::THIS(XmlElement* h):Element(h) {

    /* attributes */
    createAttribute(attrib_id,"id");
    createAttribute(attrib_name,"name");

    /** children**/
    buildChildren(Types());

}
Esempio n. 5
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */

  createAttribute(attrib_count,"count");

  /** children**/
  buildChildren(Types());

}
Esempio n. 6
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */
  createAttribute(attrib_enable,"enable");
  createAttribute(attrib_sid,"sid");
  createAttribute(attrib_name,"name");

  /* children */
  buildChildren(Types());
}
Esempio n. 7
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */
  createAttribute(attrib_name ,"name");
  createAttribute(attrib_count,"count");
  createAttribute(attrib_material,"material");

  /* children */
  buildChildren(Types());

}
Esempio n. 8
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */
  createAttribute(attrib_link,"link");

  /* children */
  buildChildren(Types());

  /* data */

}
Esempio n. 9
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */
  createAttribute(attrib_ref,"ref");
  createAttribute(attrib_pass,"pass");

  /* children */
  buildChildren(Types());

  /* data */

}
Esempio n. 10
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */
  createAttribute(attrib_texture,"texture");
  createAttribute(attrib_texcoord,"texcoord");

  /* children */
  buildChildren(Types());

  /* data */

}
Esempio n. 11
0
THIS::THIS(XmlElement* h):Element(h) {

    /* attributes */
    createAttribute(attrib_id,"id");
    createAttribute(attrib_platform,"platform");

    /* children */
    buildChildren(Types());

    /* data */

}
Esempio n. 12
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */
  createAttribute(attrib_source,"source");
  createAttribute(attrib_operand,"operand",Enum::SRC_ALPHA);
  createAttribute(attrib_sampler,"sampler");

  /* children */
  buildChildren(Types());

  /* data */

}
Esempio n. 13
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */

  /* children */
  buildChildren(Types());

  /* data */
  if(handle){
    data = handle->getText();
  }

}
Esempio n. 14
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */

  /* children */
  buildChildren(Types());

  /* data */
  XmlElement* element = handle;
  if(element){
    Utils::fromString(data,element->getText());
  }

}
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */
  createAttribute(attrib_sid,"sid");
  createAttribute(attrib_name,"name");
  createAttribute(attrib_constraint,"constraint");


  /* children */
  buildChildren(Types());

  /* data */

}
Esempio n. 16
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */
  createAttribute(attrib_index,"index");
  createAttribute(attrib_slice,"slice");
  createAttribute(attrib_mip,"mip");
  createAttribute(attrib_face,"face");

  /* children */
  buildChildren(Types());

  /* data */

}
Esempio n. 17
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */
  if(handle){
    std::string str;
    str = handle->getText();
    if(str == "true"){
      attrib_closed = true;
    }
    else{
      attrib_closed = false;
    }
  }

  /* children */
  buildChildren(Types());

}
Esempio n. 18
0
void OmokAI::normalSearch()
{
    Position w = _game->getPreviousWhite();
    auto iter = _root->children.find(w);
    if (iter == _root->children.cend()) {
        _root->state->set(Piece::createWhite(w));
        _root->children.clear();
    } else {
        _root = iter->second;
    }

    double alpha = -std::numeric_limits<double>::infinity();
    double beta = std::numeric_limits<double>::infinity();

    std::shared_ptr<OmokNode> maxOmokNode;
    Position maxMove(-1, -1);

    if (!_root->state->isWin()) {
        if (_root->children.size() == 0) {
            buildChildren(_root, 0);
        }
        for (auto &node : _root->children) {
            double a = alphabeta(node.second, alpha, beta, 1);
            if (a > alpha) {
                alpha = a;
                maxOmokNode = node.second;
                maxMove = node.first;
            }
            if (beta <= alpha) { // beta cut-off
                break;
            }
        }

        assert(_game->isBlackTurn());
        _game->put(maxMove);
        assert(maxOmokNode);
        _root = maxOmokNode;
    }
    
}
Esempio n. 19
0
double OmokAI::alphabeta(std::shared_ptr<OmokNode> node, double alpha, double beta, size_t depth)
{
    size_t size = _game->getBoardSize();
    if (depth == _depth || node->state->isWin()) {
        return node->state->getScore();
        /*if (depth % 2 == 1) {
            return node->state->getBlackScore();
        }
        else {
            return -node->state->getWhiteScore();
        }*/
        
    } else {
        if (node->children.size() == 0) {
            buildChildren(node, depth);
        }
        if (depth % 2 == 0) { //maximizing
            for (auto &node : node->children) {
                double a = alphabeta(node.second, alpha, beta, depth + 1);
                alpha = a > alpha? a : alpha;
                if (beta <= alpha) { // beta cut-off
                    break;
                }
            }
            return alpha;
        } else { // minimizing
            for (auto &node : node->children) {
                double b = alphabeta(node.second, alpha, beta, depth + 1);
                beta = b < beta ? b : beta;
                if (beta <= alpha) { // beta cut-off
                    break;
                }
            }
            return beta;
        }
    }
}
Esempio n. 20
0
THIS::THIS(XmlElement* h):Element(h){

  /* attributes */

  /* children */
  buildChildren(Types());

  /* data */
  XmlElement* element = handle;
  if(element){
    std::string str = element->getText();
    /*remove spaces*/
    while(str.find(" ") != std::string::npos)
    {
      str.replace(str.find(" "), 1, "");
    }
    /*default*/
    data = Enum::LINEAR;
    if(str == "NEAREST"){
      data = Enum::NEAREST;
    }
  }

}
Esempio n. 21
0
void ZDLInterface::sendSignals(){
	rebuild();
	emit buildParent(this);
	emit buildChildren(this);
}
Esempio n. 22
0
void ZDLInterface::writeConfig(){
	rebuild();
	emit buildChildren(this);
}