void Tablero::moverElemento(int iInicio, int jInicio,int iFinal, int jFinal ) { if(enRango(iInicio,jInicio)&&enRango(iFinal,jFinal)) { tablero[iFinal][jFinal]=tablero[iInicio][jInicio]; tablero[iInicio][jInicio]=""; } }
string Tablero::obtenerElemento(int i, int j) { if(enRango(i,j)) return tablero[i][j]; else return ""; }
bool Tablero::estaVacia(int i,int j ) { if(enRango(i,j)) { if(tablero[i][j].compare("")==0) return true; else return false; } return false; }
int funcionLineal(int i, int j, vector<vector<int> > puntos, vector<vector<Pixel> >& imagen, color colorACalcular){ int cantPuntos = 0; int resultado = 0; for (int f = 0 ; f<puntos.size() ; f++ ){ vector<int> punto = puntos[f]; if (enRango(punto,imagen)){ if (colorACalcular == ROJO){ resultado += imagen[punto[0]][punto[1]].rojo; }else if (colorACalcular == VERDE){ resultado += imagen[punto[0]][punto[1]].verde; } else { resultado += imagen[punto[0]][punto[1]].azul; } cantPuntos++; } } return resultado/cantPuntos; }
T& diccMatriz<T>::Obtener(Nat c, Nat f) { assert(enRango(c,f)); return &((Matriz[c])[f]); }
T& diccMatriz<T>::Obtener(Posicion P) { assert(enRango(P)); return &((Matriz[P.Y()-1])[P.X()-1]); }
void Tablero::agregarElemento(string elemento, int i, int j) { if(enRango(i,j)) tablero[i][j]=elemento; }