Exemplo n.º 1
0
CChessGame::CChessGame()
{
    engine = new CNegaScout_TT_HH();
    evaluator = new CEveluation();
	moveGenerator = new CMoveGenerator();
    engine->SetMoveGenerator(moveGenerator);
    engine->SetEveluator(evaluator);
    engine->SetSearchDepth(4);
    initChessBoard();
}
Exemplo n.º 2
0
void WuZiChessBoard::clearAll()
{
    m_mutex.lock();

    initChessBoard();
    update();

    m_mutex.unlock();

    emit chessUnfinished();
}
Exemplo n.º 3
0
WuZiChessBoard::WuZiChessBoard(QWidget *parent)
{
    m_chessSideLen = 630;
    m_rows = ROWS;
    m_winner = 0;
    m_bFinished = false;
    m_stopRandom = true;
    m_pRandomThread = NULL;
    m_turn = -1;   //ºÚ×ÓÏÈ×ß

    m_penWidth = m_chessSideLen/(20*m_rows);
    m_rowWidth = m_chessSideLen/(m_rows+1);
    m_delta = 0.5*(m_chessSideLen-m_rowWidth*m_rows);
    m_radius = m_chessSideLen/(1.5*m_rows);

    for(int i=0; i<(ROWS+1); i++)
        for(int j=0; j<(ROWS+1); j++)
        {
            m_chessPieces[i][j] = 0;
        }

    m_label = new QLabel;
    m_pixmap = QPixmap(m_chessSideLen, m_chessSideLen);
    m_label->setPixmap(m_pixmap);

    initChessBoard();

    QHBoxLayout *hLayout = new QHBoxLayout;
    hLayout->addWidget(m_label);
    setLayout(hLayout);

    setFixedSize(m_chessSideLen*1.03, m_chessSideLen*1.03);

    // setStyleSheet("background: rgb(200, 150, 100)");
    // setStyleSheet("background: yellow");
    

    
}
Exemplo n.º 4
0
void CChessGame::reStart()
{
    initChessBoard();
}
Exemplo n.º 5
0
/*デバック用に作成した関数*/
int testMain(){
    int i, j;//counter
    
    N = 8;
    globalCounter = 0;
    workingMemory_t* workingMemory = allocWorkingMemory();
    initWorkingMemory(workingMemory);
    chessBoard_t* chessBoard = allocChessBoard();
    initChessBoard(chessBoard);
    srand(time(NULL));
    /*ひながた
    char test0[8][8] =
        {{0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0, 0, 0}};
    */

    char test1[8][8] =
        {{0, 0, 0, 0, 0, 0, 0, 1},
         {0, 0, 0, 0, 1, 0, 0, 0},
         {0, 0, 1, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0, 1, 0},
         {0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 1, 0, 0, 0}};

    for(i = 0; i < N; i++){
        for(j = 0; j < N; j++){
            chessBoard->state[i][j] = test1[i][j];
        }
    }

    printChessBoard(chessBoard);

    
    setWorkingMemoryWithChessBoard(workingMemory, chessBoard);
/*    for(i = 0; i < N; i++)
        printf("workingMemory->line[i].state = %d\n", workingMemory->line[i].state);

    for(j = 0; j < N; j++)
        printf("workjngMemory->column[j].state = %d\n", workingMemory->column[j].state);
*/
    printChessBoardForDebug(workingMemory, chessBoard);
    printf("*0*\n");

    printf("3:%d\n", checkLine(workingMemory, chessBoard, 3));
    printChessBoardForDebug(workingMemory, chessBoard);

    printf("*1*\n");

    printf("6:%d\n", checkLine(workingMemory, chessBoard, 6));
    printChessBoardForDebug(workingMemory, chessBoard);

    printf("*2*\n");

    printf("5:%d\n", checkLine(workingMemory, chessBoard, 5));
    printChessBoardForDebug(workingMemory, chessBoard);

    printf("*3*\n");

    printf("%d\n", 567 % 1);

    runTMS();
    printf("Finished Running TMS in %d cycle\n", globalCounter);
    
    return 0;
}