- Timestamp:
- Feb 1, 2015, 2:55:44 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/minigame4DHS14/src/modules/mini4dgame/Mini4DgameAI.cc
r10225 r10230 74 74 Vector4 Mini4DgameAI::makeMove(float timeout) 75 75 { 76 77 76 this->copyBoard(); 77 std::list<Vector4> possibleMoves = this->getPossibleMoves(); 78 78 79 79 //TODO: alphabeta ueber possibleMoves 80 80 81 82 83 81 //when timeout 82 Vector4 move = possibleMoves.front(); 83 return move; 84 84 } 85 85 86 86 void Mini4DgameAI::copyBoard() 87 87 { 88 89 90 91 92 93 94 95 96 88 for(int i=0;i<4;i++){ 89 for(int j=0;j<4;j++){ 90 for(int k=0;k<4;k++){ 91 for(int l=0;l<4;l++){ 92 this->board_[i][j][k][l]=this->center_->board[i][j][k][l]; 93 } 94 } 95 } 96 } 97 97 } 98 98 99 99 std::list<Vector4> Mini4DgameAI::getPossibleMoves() 100 100 { 101 102 103 104 105 106 107 108 109 110 111 112 101 std::list<Vector4> possibleMoves = new std::list<Vector4>; 102 for(int i=0;i<4;i++){ 103 for(int j=0;j<4;j++){ 104 for(int k=0;k<4;k++){ 105 for(int l=0;l<4;l++){ 106 if (this->board_[i][j][k][l]==mini4DgamePlayerColor::none) 107 possibleMoves.push_back(Vector4(i,j,k,l)); 108 } 109 } 110 } 111 } 112 return possibleMoves; 113 113 } 114 114
Note: See TracChangeset
for help on using the changeset viewer.