コード例 #1
0
void MoHexPlayoutPolicy::InitializeForPlayout(const StoneBoard& brd)
{
    m_weights[0].Clear();
    m_weights[1].Clear();
    for (BitsetIterator it(brd.GetEmpty()); it; ++it)
    {
        m_weights[0][*it] = 
            m_globalPatterns.GammaFromKeysBoth(m_board.Keys(*it), BLACK);
        m_weights[1][*it] = 
            m_globalPatterns.GammaFromKeysBoth(m_board.Keys(*it), WHITE);
    }
    m_weights[0].Build();
    m_weights[1].Build();
}
コード例 #2
0
ファイル: YSgUtil.cpp プロジェクト: ryanbhayward/y
void YSgUtil::SetPositionInNode(SgNode* node, const StoneBoard& brd, 
                                  HexColor color)
{
    int height = brd.Height();
    SgVector<SgPoint> blist = YSgUtil::BitsetToSgVector(brd.GetBlack() 
                                       & brd.Const().GetCells(), height);
    SgVector<SgPoint> wlist = YSgUtil::BitsetToSgVector(brd.GetWhite()
                                       & brd.Const().GetCells(), height);
    SgVector<SgPoint> elist = YSgUtil::BitsetToSgVector(brd.GetEmpty()
                                       & brd.Const().GetCells(), height);
    SgPropPlayer* pprop = new SgPropPlayer(SG_PROP_PLAYER);
    SgPropAddStone* bprop = new SgPropAddStone(SG_PROP_ADD_BLACK);
    SgPropAddStone* wprop = new SgPropAddStone(SG_PROP_ADD_WHITE);
    SgPropAddStone* eprop = new SgPropAddStone(SG_PROP_ADD_EMPTY);
    pprop->SetValue(YSgUtil::HexColorToSgColor(color));    
    bprop->SetValue(blist);
    wprop->SetValue(wlist);
    eprop->SetValue(elist);
    node->Add(pprop);
    node->Add(bprop);
    node->Add(wprop);
    node->Add(eprop);
}
コード例 #3
0
void MoHexPlayoutPolicy::InitializeForPlayout(const StoneBoard& brd)
{
    BitsetUtil::BitsetToVector(brd.GetEmpty(), m_moves);
    ShuffleVector(m_moves, m_random);
}