Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <map>
- #include <set>
- enum {P,W,F,B};
- char str[] = "PWFB";
- //hun: char str[] = "MBEH";
- int main()
- {
- int max = 4*4*4 * 4*4*4*4 * 7*7;
- std::map<std::string, std::vector<std::string>> m;
- std::map<std::string, std::set<std::string>> fbs;
- for(int i = 0; i<max; i++)
- {
- int n = i;
- int small = n % 7;
- n /= 7;
- int big = n % 7;
- n /= 7;
- int t[7];
- int c[4] = {0, 0, 0, 0};
- int p = -1;
- bool bad = false;
- int f = 0;
- int b = 0;
- for(int j = 0; j<7; j++)
- {
- t[j] = n % 4;
- n/=4;
- c[t[j]]++;
- if(t[j] == F) f = j;
- if(t[j] == B) b = j;
- if(t[j] == W && p != P)
- {
- bad = true;
- break;
- }
- p = t[j];
- }
- if(bad) continue;
- if(c[P] != 3 || c[W] != 2 || c[F] != 1 || c[B] != 1) continue;
- if(t[0] == t[6]) continue;
- if(t[0] == F) continue;
- if(t[6] == F) continue;
- if(t[1] != t[5]) continue;
- if(small == big) continue;
- if(t[small] == P) continue;
- if(t[big] == P) continue;
- std::string s;
- for(int j: t) s.push_back(str[j]);
- //std::cout << s << "\n";
- std::string sb = std::to_string(small) + std::to_string(big);
- std::string fb = std::to_string(f) + std::to_string(b);
- /*for(int j = 0; j<7; j++)
- {
- if(j == small) std::cout << "s";
- else if (j == big ) std::cout << "b";
- else std::cout << " ";
- }*/
- m[sb].push_back(s);
- fbs[sb].insert(fb);
- //std::cout << "\n\n";
- }
- std::map<std::string, std::vector<std::string>> m2;
- for(auto& [sb, strings]: m)
- {
- int small = sb[0]-'0';
- if(fbs[sb].size() != 1) continue;
- for(auto& s: strings){
- if(s[small] != str[F]) continue;
- if(s[6] != str[B]) continue;
- m2[sb].push_back(s);
- }
- }
- for(auto& [sb, strings]: m2)
- {
- int small = sb[0]-'0';
- int big = sb[1]-'0';
- for(int j = 0; j<7; j++)
- {
- if(j == small) std::cout << "s";
- else if (j == big ) std::cout << "B";
- else std::cout << " ";
- }
- std::cout << "\n";
- for(auto& s: strings){
- std::cout << s << "\n";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement