本文整理汇总了C++中AI::SetPiece方法的典型用法代码示例。如果您正苦于以下问题:C++ AI::SetPiece方法的具体用法?C++ AI::SetPiece怎么用?C++ AI::SetPiece使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AI
的用法示例。
在下文中一共展示了AI::SetPiece方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void update()override{
blackCount = board.PieceCount(Piece::black);
whiteCount = board.PieceCount(Piece::white);
if (selectMode){
if (this->black){
if (Input::KeyRight.clicked){
this->black = false;
}
}
else{
if (Input::KeyLeft.clicked){
this->black = true;
}
}
if (Input::KeyZ.clicked){
selectMode = false;
myturn = black;
ai.SetPiece(!black ? Piece::black : Piece::white);
}
}
else{
if (Input::KeyX.clicked){
changeScene(L"Pause", 1000);
}
if (passCount > 1 || waycount > 59){
val1 += (200 - val1) / 5;
if (abs(200 - val1) < 10){
val3 += (300 - val3) / 10;
}
if (Input::KeyZ.clicked){
changeScene(L"Title",1000);
}
}
else{
if (myturn){
if (pass){
val1 += (200 - val1) / 5;
if (abs(200 - val1) < 10){
if (val2 < 302){
val2 += (-300 - val2) / 10;
if (val2 < -290){
pass = !board.IsAllSetAble(black ? Piece::white : Piece::black);
val2 = 900.;
passCount++;
myturn = false;
}
}
else{
val2 += (300 - val2) / 10;
}
}
}
else{
passCount = 0;
val1 += (0 - val1) / 10;
if (Input::KeyUp.clicked){
if (selectPos.y == 0)
selectPos.y = 7;
else
selectPos.y--;
}
if (Input::KeyLeft.clicked){
if (selectPos.x == 0)
selectPos.x = 7;
else
selectPos.x--;
}
if (Input::KeyRight.clicked) {
if (selectPos.x == 7)
selectPos.x = 0;
else
selectPos.x++;
}
if (Input::KeyDown.clicked) {
if (selectPos.y == 7)
selectPos.y = 0;
else
selectPos.y++;
}
if (Input::KeyZ.clicked){
if (board.IsSetAble(selectPos, black ? Piece::black : Piece::white, true)){
board.SetPiece(selectPos, black ? Piece::black : Piece::white);
pass = !board.IsAllSetAble(black ? Piece::white : Piece::black);
waycount++;
myturn = false;
}
}
}
}
else{
if (pass){
val1 += (200 - val1) / 5;
if (abs(200 - val1) < 10){
if (val2 < 302){
val2 += (-300 - val2) / 10;
//.........这里部分代码省略.........