SHARE
TWEET

Count winlines

JakimPL Oct 21st, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top