12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #include "olok.h"
- Olok::Olok()
- {
- clear();
- }
- void Olok::clear()
- {
-
- grid.clear();
-
- for(int j = 0; j<white1; j++)
- {
- RowColor empty;
- grid.push_back(empty);
- for (int i = 0; i<CHECKBOXES; i++)
- {
- grid[j].row.push_back(false);
- }
- }
-
- penaltyCount = 0;
- }
- int Olok::getXCount(int color)
- {
- return grid[color].xCount;
- }
- void Olok::addX(int color, int index)
- {
- grid[color].row[index] = true;
- grid[color].lastIndex = index;
- }
- int Olok::getLastIndex(int color)
- {
- return grid[color].lastIndex;
- }
- void Olok::addOlok(Olok o)
- {
-
- for(int j = 0;j <o.grid.size();j++)
- {
-
- for(int k = 0;k <o.grid[j].row.size();k++)
- {
-
- if(true ==o.grid[j].row[k])
- {
-
- grid[j].row[k] = true;
- }
- }
- }
-
- penaltyCount += o.penaltyCount;
- }
- std::string Olok::toString(void) {
- std::string output;
-
- for(int j = 0; j < grid.size(); j++)
- {
-
- for(int k = 0; k < grid[j].row.size();k++)
- {
-
- output.push_back(grid[j].row[k] ? 'T' : 'F');
- }
- }
-
- output.push_back(penaltyCount + '0');
- return output;
- }
|