本文整理汇总了C++中node_t类的典型用法代码示例。如果您正苦于以下问题:C++ node_t类的具体用法?C++ node_t怎么用?C++ node_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了node_t类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: mirror
//---:---<*>---:---<*>---:---<*>---:---<*>---:---<*>---:---<*>---:
void mirror(tree_t &T,node_t n) {
list< tree<int> > L;
node_t c = n.lchild();
if (c==T.end()) return;
while (c!=T.end()) {
printf("passing to list subtree rooted at %d\n",*c);
L.insert(L.begin(),tree_t());
tree_t &Q = *L.begin();
T.splice(Q.begin(),c);
#if 0
cout << "T: \n";
T.lisp_print();
cout << "\nQ: \n";
Q.lisp_print();
cout << endl;
#endif
mirror(Q);
c = n.lchild();
}
c = n.lchild();
while (!L.empty()) {
tree_t &Q = *L.begin();
printf("passing to tree subtree rooted at %d\n",*Q.begin());
c = T.splice(c,Q.begin());
c++;
L.erase(L.begin());
}
}
开发者ID:Malows,项目名称:aedcode,代码行数:30,代码来源:trytree3.cpp
示例2: split_down
//---:---<*>---:---<*>---:---<*>---:---<*>---:---<*>
void split_down(tree<int> &T,node_t p,int n,int g) {
// Si el valor en la raiz esta OK, entonces no hace falta
// hacer nada.
if (*p <= n) return;
// Llama a `distrib()' para ver como es la distribucion
// del valor en el nodo `*p'
vector<int> v; distrib(*p,g,v);
// Va iterando, creando los nuevos nodos
node_t c = p.lchild();
for (unsigned int j=0; j<v.size(); j++) {
c = T.insert(c,v[j]);
// Aplica recursivamente la funcion
split_down(T,c++,n,g);
}
}
开发者ID:Malows,项目名称:aedcode,代码行数:16,代码来源:splitdaoo.cpp
示例3: if
bool
tablebase_t::operator()(const node_t& node, const std::uint_fast8_t height, score_t& score) const
{
std::uint32_t rgiCounters[10];
unsigned int rgsqWhite[C_PIECES * 5 + 1];
unsigned int rgsqBlack[C_PIECES * 5 + 1];
// initialize counters and piece arrays so the probe code
// can compute the modified Godel number.
init(rgiCounters, rgsqWhite, 0, node.board_pawns_white());
init(rgiCounters, rgsqWhite, 1, node.board_knights_white());
init(rgiCounters, rgsqWhite, 2, node.board_bishops_white());
init(rgiCounters, rgsqWhite, 3, node.board_rooks_white());
init(rgiCounters, rgsqWhite, 4, node.board_queens_white());
init(rgiCounters + 5, rgsqBlack, 0, node.board_pawns_black());
init(rgiCounters + 5, rgsqBlack, 1, node.board_knights_black());
init(rgiCounters + 5, rgsqBlack, 2, node.board_bishops_black());
init(rgiCounters + 5, rgsqBlack, 3, node.board_rooks_black());
init(rgiCounters + 5, rgsqBlack, 4, node.board_queens_black());
std::lock_guard<std::mutex> lock(const_cast<std::mutex&>(_mutex));
// tablebase registered ?
int iTb = IDescFindFromCounters((int*)rgiCounters);
if (!iTb)
return false;
// set up tablebase parameters
std::uint32_t invert;
int side;
unsigned int* psqW;
unsigned int* psqB;
rgsqWhite[C_PIECES * 5] = node.square_king_white();
rgsqBlack[C_PIECES * 5] = node.square_king_black();
if (iTb > 0)
{
side = node.color() == black;
invert = false;
psqW = rgsqWhite;
psqB = rgsqBlack;
}
else
{
side = node.color() == white;
invert = true;
psqW = rgsqBlack;
psqB = rgsqWhite;
iTb = -iTb;
}
// tablebase registered ?
if (!FRegisteredFun(iTb, side))
return false;
// get tbValue
const unsigned int sqEnP = node.square_en_passant() ? node.square_en_passant() : 127;
const std::uint64_t index = PfnIndCalcFun(iTb, side) ((unsigned int *)psqW, (unsigned int *)psqB, sqEnP, invert);
const score_t tbValue = L_TbtProbeTable(iTb, side, index);
if (tbValue == L_bev_broken)
return false;
// convert tbValue to score
if (tbValue > 0)
score = /*Score::max*/ +30000 + 2 * (-L_bev_mi1 + tbValue - 1) - (score_t)height + 1;
else if (tbValue < 0)
score = /*Score::min*/ -30000 + 2 * (+L_bev_mi1 + tbValue) + (score_t)height;
else
score = 0;//Score::remis;
return true;
}
开发者ID:octopus-prime,项目名称:octopus-c,代码行数:72,代码来源:tablebase.cpp
示例4: next
node_t* next(char c){
if (g(c) != NULL) return g(c);
child[c] = failure->next(c);
return child[c];
}
开发者ID:viniciusmalloc,项目名称:lib-monkeys,代码行数:5,代码来源:aho.cpp
示例5: cost_f
bool operator> (const node_t& n2) const
{
return cost_f() < n2.cost_f();
}
开发者ID:Sudoka,项目名称:master-project,代码行数:4,代码来源:main.cpp
示例6: operator
auto operator()(const node_t& a, const node_t& b)
{
return _matrix(a.id(), b.id());
}
开发者ID:Manu343726,项目名称:practica2mar,代码行数:4,代码来源:graph.hpp
示例7: examining_node
void examining_node(node_t u, Graph & g){
cout << " examining node " << u->id() << "\n";
}
开发者ID:js850,项目名称:kmc_rates,代码行数:3,代码来源:test.cpp
示例8: discover_node
void discover_node(node_t u, Graph & g){
cout << "discovered node " << u->id() << "\n";
}
开发者ID:js850,项目名称:kmc_rates,代码行数:3,代码来源:test.cpp
示例9: enumerate
// foreach functor example
static void enumerate(const std::string& key, const node_t& node,
store_t store) {
const data_t& data = node.data();
std::cout << "'" << key << "' -> '" << data.str(store) << "'" << std::endl;
}
开发者ID:x0id,项目名称:utxx,代码行数:6,代码来源:actrie_mmap_demo.cpp
示例10: update
void update() {
size = 1;
subtree_value = value;
if (left != NULL) {
subtree_value = join_values(subtree_value, left->get_subtree_value());
size += left->size;
}
if (right != NULL) {
subtree_value = join_values(subtree_value, right->get_subtree_value());
size += right->size;
}
}
开发者ID:Alextrovert,项目名称:Algorithm-Anthology,代码行数:12,代码来源:3.6.6+Link-Cut+Tree.cpp
示例11: query
T query(int a, int b) {
if (!is_connected(a, b)) {
throw std::runtime_error("Cannot query nodes that are not connected.");
}
get_uv(a, b);
expose(u);
u->rev = !u->rev;
expose(v);
return v->get_subtree_value();
}
开发者ID:Alextrovert,项目名称:Algorithm-Anthology,代码行数:10,代码来源:3.6.6+Link-Cut+Tree.cpp
示例12: set_state
void set_state(std::size_t x) { return node_m->set_state(x); }
开发者ID:Syntaf,项目名称:GG,代码行数:1,代码来源:closed_hash.hpp
示例13: state
std::size_t state() const { return node_m->state(); }
开发者ID:Syntaf,项目名称:GG,代码行数:1,代码来源:closed_hash.hpp
示例14: decrement
void decrement() { node_m = node_m->prior(); }
开发者ID:Syntaf,项目名称:GG,代码行数:1,代码来源:closed_hash.hpp
示例15: increment
void increment() { node_m = node_m->next(); }
开发者ID:Syntaf,项目名称:GG,代码行数:1,代码来源:closed_hash.hpp
示例16: walk
void walk( int d = 0 ){
if(l) l->walk(d+1);
REP( i, d ) cout << "\t";
cout << key << endl;
if(r) r->walk(d+1);
}
开发者ID:paulocezar,项目名称:problem-solving,代码行数:6,代码来源:QMAX3VN.cpp
注:本文中的node_t类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论