本文整理汇总了C++中AI::Run方法的典型用法代码示例。如果您正苦于以下问题:C++ AI::Run方法的具体用法?C++ AI::Run怎么用?C++ AI::Run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AI
的用法示例。
在下文中一共展示了AI::Run方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
//.........这里部分代码省略.........
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;
if (val2 < -290){
pass = !board.IsAllSetAble(black ? Piece::black : Piece::white);
val2 = 900.;
passCount++;
myturn = true;
}
}
else{
val2 += (300 - val2) / 10;
}
}
}
else{
passCount = 0;
val1 += (0 - val1) / 10;
if (wait < 1){
Vec2 setPos = ai.Run(board, dif);
board.IsSetAble(setPos, black ? Piece::white : Piece::black, true);
board.SetPiece(setPos, black ? Piece::white : Piece::black);
pass = !board.IsAllSetAble(!black ? Piece::white : Piece::black);
waycount++;
wait = 10;
myturn = true;
}
else{
wait--;
}
}
}
}
}
}