Improvements

Improved AI choice
This commit is contained in:
Valentino Orlandi 2022-10-19 23:24:06 +02:00
parent e532248de3
commit 7088137d52
Signed by: elB4RTO
GPG key ID: 1719E976DB2D4E71

View file

@ -302,7 +302,9 @@ void CrissCross::AI_updateWeights()
}
}
// set the new weight for the empty tiles
const unsigned int new_weight = (win_streak>lose_streak) ? win_streak+1 : lose_streak+1;
const unsigned int new_weight = (win_streak>=lose_streak)
? (win_streak==2) ? win_streak+2 : win_streak+1
: lose_streak+1;
for ( const auto& index : empty_tiles ) {
if ( new_weight > this->board_weights[ index ] ) {
this->board_weights[ index ] = new_weight;