Diffstat (limited to 'noncore/games/backgammon/moveengine.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/backgammon/moveengine.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/games/backgammon/moveengine.cpp b/noncore/games/backgammon/moveengine.cpp index 7de7147..a4145cc 100644 --- a/noncore/games/backgammon/moveengine.cpp +++ b/noncore/games/backgammon/moveengine.cpp @@ -412,97 +412,97 @@ int MoveEngine::getPossibleMoves() } else if(fieldColor(nextfield)==otherplayer) { if(abs(population[nextfield].total)>1) //can not move to this field moves[field].weight[b]=0; else if(abs(population[nextfield].total)==1) //eliminate opponent : very nice moves[field].weight[b]=ai.eliminate; } else if(fieldColor(nextfield)==player) //nextfield already occupied by player { if(abs(population[field].total)==2) //expose own piece : not diserable moves[field].weight[b]=ai.expose; else if(abs(population[nextfield].total)>1) //own pices already there : safe moves[field].weight[b]=ai.safe; else if(abs(population[nextfield].total)==1) //protect own piece : most importatnt moves[field].weight[b]=ai.protect; } else if(population[nextfield].total==0) //nextfield empty { if(abs(population[field].total)==2) //expose own piece : not diserable moves[field].weight[b]=ai.expose; else moves[field].weight[b]=ai.empty; } else moves[field].weight[b]=0; //default. } else moves[field].weight[b]=0; //dice already used or field not used by player } } int total=0; for(int field=0;field<26;field++) { total+=moves[field].weight[0]+moves[field].weight[1]+moves[field].weight[2]+moves[field].weight[3]; } return total; } void MoveEngine::move(const int& from, int to, const int& dice) { - //qDebug("%d moves from %d to %d (%d) with dice %d",player,from,to,to-from,dice); + //odebug << "" << player << " moves from " << from << " to " << to << " (" << to-from << ") with dice " << dice << "" << oendl; if(player==1 && to==25) to=26; if(player==2 && to==0) to=27; //if space is occupied by enemy move pieces to startzone if(fieldColor(to)==otherplayer) { population[to].total=0; if(otherplayer==1) population[0].total++; else population[25].total--; } if(player==1) { population[from].total--; population[to].total++; } else //player=2 { population[from].total++; population[to].total--; } if(dice==1) emit done_dice1(); else if(dice==2) emit done_dice2(); else if(dice==3) emit done_dice3(); else emit done_dice4(); if(abs(population[26].total)==15) emit player_finished(1); if(abs(population[27].total)==15) emit player_finished(2); } void MoveEngine::checkstate() { //check if pieces are out pieces_out[1]=(population[0].total>0) ? true : false; pieces_out[2]=(population[25].total<0) ? true : false; |