#include <cstdio>
#include <string>
#include "colo.hpp"
#include "bitmap_image.hpp"
using namespace std;
string shapc[10][10][20];
int nsh;
string recint(string elem) {
string resu = "num";
if(elem.empty()) {resu = "emp";}
if(elem == "graL") {resu = "col";}
if(elem == "gra") {resu = "col";}
if(elem == "graD") {resu = "col";}
if(elem == "redL") {resu = "col";}
if(elem == "red") {resu = "col";}
if(elem == "redD") {resu = "col";}
if(elem == "yelL") {resu = "col";}
if(elem == "yel") {resu = "col";}
if(elem == "yelD") {resu = "col";}
if(elem == "fucL") {resu = "col";}
if(elem == "fuc") {resu = "col";}
if(elem == "fucD") {resu = "col";}
if(elem == "greL") {resu = "col";}
if(elem == "gre") {resu = "col";}
if(elem == "greD") {resu = "col";}
if(elem == "turL") {resu = "col";}
if(elem == "tur") {resu = "col";}
if(elem == "turD") {resu = "col";}
if(elem == "bluL") {resu = "col";}
if(elem == "blu") {resu = "col";}
if(elem == "bluD") {resu = "col";}
return resu;
}
void putsha(int rsh1, string col1, string beg1, string end1, int rsh2, string col2, string beg2, string end2) {
int is, isr, isrc, don1, don2; string equ1[5], equ2[5];
shapc[0][3][0] = "red";
shapc[0][3][1] = "8";
shapc[0][3][2] = "9";
shapc[0][2][0] = "red";
shapc[0][2][1] = "0";
shapc[0][2][2] = "1";
for (is = 0; is < 9; is++) {
for (isrc = 0; isrc < 19; isrc++) {
if (shapc[is][rsh1][isrc] == col1 && shapc[is][rsh1][isrc + 1] == beg1 && shapc[is][rsh1][isrc + 2] == end1 && equ1[0].empty()) {
equ1[0] = to_string(is);
equ1[1] = to_string(rsh1);
equ1[2] = col1;
equ1[3] = beg1;
equ1[4] = end1;
}
if (shapc[is][rsh2][isrc] == col2 && shapc[is][rsh2][isrc + 1] == beg2 && shapc[is][rsh2][isrc + 2] == end2 && equ2[0].empty()) {
equ2[0] = to_string(is);
equ2[1] = to_string(rsh2);
equ2[2] = col2;
equ2[3] = beg2;
equ2[4] = end2;
}
if (!equ1[0].empty() && !equ2[0].empty()) {break;}
}
if (!equ1[0].empty() && !equ2[0].empty()) {break;}
}
if (equ1[0].empty() && equ2[0].empty()) {
nsh++;
shapc[nsh][rsh1][0] = col1;
shapc[nsh][rsh1][1] = beg1;
shapc[nsh][rsh1][2] = end1;
shapc[nsh][rsh2][3] = col2;
shapc[nsh][rsh2][4] = beg2;
shapc[nsh][rsh2][5] = end2;
}
if (!equ1[0].empty() && equ2[0].empty()) {
for (is = 0; is < 19; is++) {
if (shapc[equ1[0]][equ2[1]][is].empty()) {
shapc[equ1[0]][equ2[1]][is] = col2;
shapc[equ1[0]][equ2[1]][is + 1] = beg2
shapc[equ1[0]][equ2[1]][is + 2] = end2;
}
}
}
if (equ1[0].empty() && !equ2[0].empty()) {
}
/*cout << "1" << equ1[0] << equ1[1] << equ1[2] << equ1[3] << equ1[4] << endl;
cout << "2" << equ2[0] << equ2[1] << equ2[2] << equ2[3] << equ2[4] << endl;*/
}
string shap() {
int r, c, i, iscr, poslc, indsha = 0; rgb_t colour; string pix[10][10], shapl[10][30];
bitmap_image image("input.bmp");
for (r = 0; r <= 9; r++) {
poslc = 0;
for (c = 0; c <= 9; c++) {
image.get_pixel(c, r, colour);
pix[r][c] = colo((int)colour.red, (int)colour.green, (int)colour.blue);
//cout << pix[r][c] << " ";
if (c == 0) {poslc = c;
shapl[r][poslc] = pix[r][c];
shapl[r][poslc + 1] = to_string(c);
shapl[r][poslc + 2] = to_string(c);}
if (pix[r][c] == shapl[r][poslc]) {shapl[r][poslc + 2] = to_string(c);}
else {poslc = poslc + 3;
shapl[r][poslc] = pix[r][c];
shapl[r][poslc + 1] = to_string(c);
shapl[r][poslc + 2] = to_string(c);}
}
//cout << endl;
}
cout << endl;
for (r = 0; r <= 9; r++) {for (c = 0; c <= 29; c++) {cout << shapl[r][c] << " ";} cout << endl;}
for (r = 0; r <= 9; r++) {
for (c = 0; c <= 29; c++) {
if (recint(shapl[r][c]) == "col") {
for (i = 0; i <= 29; i++) {
if (recint(shapl[r + 1][i]) == "col") {
if (shapl[r][c] == shapl[r + 1][i]) {
if (shapl[r + 1][i + 1] <= shapl[r][c + 1] && shapl[r + 1][i + 2] <= shapl[r][c + 2]) {
}
if (shapl[r + 1][i + 1] >= shapl[r][c + 1] && shapl[r + 1][i + 2] >= shapl[r][c + 2]) {
}
if (shapl[r + 1][i + 1] <= shapl[r][c + 1] && shapl[r + 1][i + 2] >= shapl[r][c + 2]) {
}
if (shapl[r + 1][i + 1] >= shapl[r][c + 1] && shapl[r + 1][i + 2] <= shapl[r][c + 2]) {
}
}
else {
}
}
}
}
}
}
putsha(2, "red", "0", "1", 3, "red", "8", "9");
for (r = 0; r <= 9; r++) {
for (c = 0; c <= 9; c++) {
for (iscr = 0; iscr <= 19; iscr++) {
cout << shapc[r][c][iscr];
}
cout << endl;
}
cout << endl;
}
return "0";
}
In file included from reco.cpp:2:
shap.hpp: In function ‘void putsha(int, std::string, std::string, std::string, int, std::string, std::string, std::string)’:
shap.hpp:80:192: error: no match for ‘operator[]’ (operand types are ‘std::string [10][10][20]’ {aka ‘std::__cxx11::basic_string<char> [10][10][20]’} and ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’})
80 | if (shapc[equ1[0]][equ2[1]][is].empty()) {
| ^
shap.hpp:81:230: error: no match for ‘operator[]’ (operand types are ‘std::string [10][10][20]’ {aka ‘std::__cxx11::basic_string<char> [10][10][20]’} and ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’})
81 | shapc[equ1[0]][equ2[1]][is] = col2;
| ^
shap.hpp:82:230: error: no match for ‘operator[]’ (operand types are ‘std::string [10][10][20]’ {aka ‘std::__cxx11::basic_string<char> [10][10][20]’} and ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’})
82 | shapc[equ1[0]][equ2[1]][is + 1] = beg2
|