Advertisement
JakimPL

Count winlines

Oct 21st, 2019
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1.     std::vector<std::vector<int>> winRelation;
  2.     for (std::size_t line = 0; line < mWinlines.size(); ++line)
  3.     {
  4.         std::cout << line + 1 << ": ";
  5.         std::vector<int> winRelationLine;
  6.         for (std::size_t winLine = 0; winLine < mWinlines.size(); ++winLine)
  7.         {
  8.             bool success = true;
  9.             bool connected = true;
  10.             for(int i = 0; i < 3; i++)
  11.             {
  12.                 if (mWinlines[winLine][i] != mWinlines[line][i])
  13.                 {
  14.                     if (connected)
  15.                     {
  16.                         connected = false;
  17.                     }
  18.                     else
  19.                     {
  20.                         success = false;
  21.                         break;
  22.                     }
  23.                 }
  24.             }
  25.             if (success)
  26.             {
  27.                 winRelationLine.push_back(winLine);
  28.                 if (winLine != line)
  29.                     std::cout << winLine + 1 << ", ";
  30.             }                
  31.         }
  32.         winRelation.push_back(winRelationLine);
  33.         std::cout << " TOTAL: " << winRelation[line].size() << "\n";
  34.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement