| 137 | } |
| 138 | |
| 139 | Strategy Strategy::getSubStrategy(vector<int> position) { |
| 140 | if (position.empty()) return *this; |
| 141 | int deg = degree(); |
| 142 | if (deg == 0) { |
| 143 | cout<<"Did not find substrategy"<<endl; |
| 144 | return Strategy::Dummy(); |
| 145 | } |
| 146 | for (int i=0;i<deg;i++) { |
| 147 | Strategy child=getChild(i); |
| 148 | bool ok=true; |
| 149 | if (child.values().size() == 0) { |
| 150 | ok = false; |
| 151 | } |
| 152 | for (int j=0;(j<child.values().size()) && ok;j++) { |
| 153 | if (child.value(j) != position[j]) ok=false; |
| 154 | } |
| 155 | if (ok) { |
| 156 | position.erase(position.begin(),position.begin() + (child.values().size())); |
| 157 | return child.getSubStrategy(position); |
| 158 | } |
| 159 | } |
| 160 | cout<<"Did not find substrategy"<<endl; |
| 161 | return Strategy::Dummy(); |
| 162 | } |
| 163 | |
| 164 | void Strategy::attach(Strategy child) { |
| 165 | if (child.isDummy()) { |