ia/modele.cpp
int score(int score_avant, Plateau avant, int ideplacement){
	Plateau apres;
	apres = deplacement(avant, ideplacement, false);
	int nscore=score_avant;
	vector<vector<int>> avant_freq= {{2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072},
	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
	vector<vector<int>> apres_freq= avant_freq;
	for(int column=0; column<17; column++){
		avant_freq[1][column]=count_plateau(avant, avant_freq[0][column]);
		apres_freq[1][column]=count_plateau(apres, apres_freq[0][column]);
	}
	for(int column=0; column<17; column++){
		if(apres_freq[1][column]>avant_freq[1][column]){
			nscore += avant_freq[0][column]*(apres_freq[1][column]-avant_freq[1][column]);
		}
		if(apres_freq[1][column]<avant_freq[1][column] && apres_freq[1][column + 1]==avant_freq[1][column + 1]){
			nscore = nscore + avant_freq[0][column]*(avant_freq[1][column]-apres_freq[1][column]);
		}
	}
	return nscore;
}
//well tested by @pablo-chullila
well tested by @pablo-chullila
well tested by @pablo - chullila
int score(int score_avant, Plateau avant, int ideplacement){
	Plateau apres;
	apres = deplacement(avant, ideplacement, false);
	int nscore=score_avant;
	vector<vector<int>> avant_freq= {{2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072},
	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
	vector<vector<int>> apres_freq= avant_freq;
	for(int column=0; column<17; column++){
		avant_freq[1][column]=count_plateau(avant, avant_freq[0][column]);
		apres_freq[1][column]=count_plateau(apres, apres_freq[0][column]);
	}
	for(int column=0; column<17; column++){
		if(apres_freq[1][column]>avant_freq[1][column]){
			nscore += avant_freq[0][column]*(apres_freq[1][column]-avant_freq[1][column]);
		}
		if(apres_freq[1][column]<avant_freq[1][column] && apres_freq[1][column + 1]==avant_freq[1][column + 1]){
			nscore = nscore + avant_freq[0][column]*(avant_freq[1][column]-apres_freq[1][column]);
		}
	}
	return nscore;
}
int score ( int score_avant , Plateau avant , int ideplacement ) { Plateau apres ; apres = deplacement ( avant , ideplacement , false ) ; int nscore = score_avant ; vector < vector < int > > avant_freq = { { 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024 , 2048 , 4096 , 8192 , 16384 , 32768 , 65536 , 131072 } , { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } } ; vector < vector < int > > apres_freq = avant_freq ; for ( int column = 0 ; column < 17 ; column ++ ) { avant_freq [ 1 ] [ column ] = count_plateau ( avant , avant_freq [ 0 ] [ column ] ) ; apres_freq [ 1 ] [ column ] = count_plateau ( apres , apres_freq [ 0 ] [ column ] ) ; } for ( int column = 0 ; column < 17 ; column ++ ) { if ( apres_freq [ 1 ] [ column ] > avant_freq [ 1 ] [ column ] ) { nscore += avant_freq [ 0 ] [ column ] * ( apres_freq [ 1 ] [ column ] - avant_freq [ 1 ] [ column ] ) ; } if ( apres_freq [ 1 ] [ column ] < avant_freq [ 1 ] [ column ] && apres_freq [ 1 ] [ column + 1 ] == avant_freq [ 1 ] [ column + 1 ] ) { nscore = nscore + avant_freq [ 0 ] [ column ] * ( avant_freq [ 1 ] [ column ] - apres_freq [ 1 ] [ column ] ) ; } } return nscore ; }
well tested by @pablo-chullila
well tested by @pablo - chullila