|
#include "stdafx.h"
#include "CSolPuntos.h"
void CSolPuntos::Inicializar()
{
vptos.clear();
for (int i=1; i<=60; i++)
vptos.push_back(0);
}
void CSolPuntos::MarcarPto(int fila, int columna, int valor)
{
vptos[GetArrIndex(fila, columna)] = valor;
}
int CSolPuntos::GetValor(int fila, int columna)
{
int res = vptos[GetArrIndex(fila, columna)];
return res;
}
int CSolPuntos::GetArrIndex(int fila, int columna)
{
int res = (fila - 1) * 6 + columna - 1;
return res;
}
void CSolPuntos::Rotar180(CSolPuntos& psol)
{
int valor;
for (int i=1; i<=10; i++)
{
for (int j = 1; j<=6; j++)
{
valor = vptos[GetArrIndex(i, j)];
int col = 7 - j;
int row = 11 - i;
psol.MarcarPto(row, col, valor);
}
}
}
void CSolPuntos::Invertir(CSolPuntos& psol)
{
int valor;
for (int i=1; i<=10; i++)
{
for (int j = 1; j<=6; j++)
{
valor = vptos[GetArrIndex(i, j)];
int col = 7 - j;
psol.MarcarPto(i, col, valor);
}
}
}
BOOL CSolPuntos::EsIgual(CSolPuntos& psol)
{
int valor1, valor2;
for (int i=0; i<=59; i++)
{
valor1 = vptos[i];
valor2 = psol.vptos[i];
if (valor1 != valor2)
return FALSE;
}
return TRUE;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
System developer from Argentina.
Programmed in VB 5,6,.NET, C#, Java, PL-SQL, Transac-SQL, C, C++ and even some "calculator" language.
Love to build small, useful applications.
Usually building big and complicated apps based on solid, reliable components.
Hobbies: reading, photography, chess, paddle, running.