Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<vector>
- #include<algorithm>
- struct Square{
- int color; //value 1 to 10
- };
- struct State{
- vector<Square> list;
- int color_weight[] = {4,3,5,2,4,1,6,4,5,9}; //These values keep changing.
- operator<(Square& a, Square& b);
- void sortTheList();
- };
- bool State::operator<(Square& a, Square& b){
- if (color_weight[a.color]< color_weight[b.color]){
- return true;
- }
- return false;
- }
- void Square::sortTheList(){
- sort(list.begin(),list.end());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement