Está en la página 1de 7

PASO 5 – CONSTRUCCIÓN INDIVIDUAL

SOFTWARE PARA INGENIERIA

GRUPO:

203036A_614

TUTOR:
JESUS OMAR VARGAS

ALUMNO:
YESID CASTAÑEDA LLANOS

CODIGO:
80725020

UNIVERSIDAD ABIERTA Y A DISTANCIA – UNAD


NOVIEMBRE 01 DEL 2018
Actividades a desarrollar

Individual

PARA CONTINUAR LA CONSTRUCCIÓN DE LA SOLUCIÓN DEL


PROBLEMA PLANTEADO EN EL CURSO

 Releer el problema a resolver


 Recopile información concreta que le permita construir la solución del
problema (teorías, conceptos, manuales, videos, ejercicios resueltos,
entre otros), resúmala y digítela en un procesador de texto con sus
respectivas referencias con normas APA
 Elaborar un algoritmo (diagrama de flujo o pseudocódigo) que
represente la solución del problema planteado en el curso

Problema
Una empresa de juegos didácticos virtuales, quieren implementar un juego de
rompecabezas numérico, junto con sus respectivas reglas de puntuación, para
ello es necesario diseñar un aplicativo que genere una matriz cuadrada de
orden m, de números aleatorios, donde se almacenen m-1 números enteros
consecutivos, dejando una casilla vacía; el aplicativo debe darle al usuario la
posibilidad de:
 Determinar el tamaño de la matriz (m=>3 y m<=5)
 Establecer el primer número de los m-1 posibles a almacenar, (los
demás serán consecutivos).
 El usuario debe poder determinar cómo mover la casilla vacía, indicando
si el movimiento lo hace hacia arriba ó abajo, derecha ó izquierda.
 Tener la opción de no continuar con el armado del rompecabezas.
 Decidir si el armado lo dese hacer horizontal o vertical.
 Leer las reglas de la puntuación con la que se valorará su desarrollo.

Una vez el usuario termine de ordenar el rompecabezas o haya decidido no


continuar con el armado, el aplicativo debe:
 Indicar la cantidad de movimientos realizados
 Puntuación obtenida
El aplicativo, en su funcionamiento debe cumplir con las siguientes
características:

 Permitir el movimiento de una celda a la vez.


 En los bordes de la matriz restringir los movimientos, es decir que de la
última columna no es posible desplazarse a la primera o viceversa, igual
con las filas, de la primera fila no es posible llegar a la última y viceversa.
 Mostar solo una matriz en pantalla, ir actualizándola a medida que se
van realizando los movimientos.
 Cuando logre ordenar el rompecabezas informarle al usuario que lo
terminó.
Ejemplo de movimientos realizados para armar el rompecabezas
horizontalmente. Suponiendo que el aplicativo genera la siguiente matriz, se
muestra cada uno de los cambios que se deben dar al interior de la matriz,
para mostrársela al usuario, entre cambio y cambio se debe borrar la matriz
anterior y sobrescribir en pantalla la nueva.

Valor inicial: 1
Tipo de armado: Horizontal
Matriz generada:
5 1 4
2 6 8
7 3

Movimientos
5 1 4 5 1 4 5 1 4 1 4
2 6 2 6 2 6 5 2 6
7 3 8 7 3 8 7 3 8 7 3 8
1. Arriba 2. Derecha 3. Derecha 4. Arriba
1 4 1 2 3 1 2 3
5 2 6 5 6 5 6
7 3 8 … 4 7 8 4 7 8
5. Derecha 30. Arriba 31. Izquierda
1 2 3 1 2 3 1 2 3 1 2 3
5 6 4 5 6 4 5 6 4 5 6
4 7 8 7 8 7 8 7 8
32. Izquierda 33. Abajo 34. Derecha 35. Derecha
1. Elaborar algoritmo (diagrama de flujo o pseudocódigo) de la solución al
problema planteado.
2. Diseñar la primera interfaz o panel frontal que tendrá la solución al
problema, explicar el objetivo de cada uno de los elementos que la
componen a nivel de usuario y programador.

INTERFAZ DEL USUARIO


SEUDOCODIGO

Ejemplo matrices a ingresar: 3x3 [4 5 6; 1 7 8; 0 3 2] [4 5 6; 1 7 0; 8 3 2]

clc;
pzstat = input('digitar matriz 3 x 3 (use 0 para espacio) ..........: ');
pzrstat = [1 2 3;4 5 6;7 8 0];
intv000 = size(pzstat);
if not(all(intv000 == [3 3]))
msgbox(La entrada no está en el formato correcto .............. El formato
debe ser una matriz de 3 x 3. El espacio en blanco debe reemplazarse por 0.);
else
pzinl = [];
pzhis = [];
pzrhis = [];
intv00g = 0;
[intv0h1,intv0h2] = gskcostastar(pzstat,pzrstat);
intv00h = intv0h1 + intv0h2;
intv00f = intv00h + intv00g;
pzinl = gskpzjoin(pzinl,pzstat,intv00f,intv00g,intv00h);
pzhis = gskpzjoin(pzhis,pzstat,intv00f,intv00g,intv00h);
pzhis(:,13)=0;
pzhis(1,14)=0;
pzhis(1,15)=1;
intv001 = 1;
intv0ct = 0;
intv0nd = 1;
intv1nd = 1;
while intv001 == 1;
intv0ct = intv0ct + 1;
[pzout, intv00f, intv00g, intv00h] = gskpzget(pzinl,1);
[intv002, intv003] = find(pzout==0);
pzinl = [];
if intv00h ~= 0
% % % % % % left
if intv003 > 1
pzout1 = pzout;
pzout1(intv002,intv003) = pzout(intv002,intv003 - 1);
pzout1(intv002,intv003 - 1) = 0;
[intv0h1,intv0h2] = gskcostastar(pzout1,pzrstat);
intv00h = intv0h1 + intv0h2;
intv0g1 = intv00g + 1;
intv00f = intv0g1 + intv00h;
[pzinl] = gskpzjoin(pzinl,pzout1,intv00f,intv0g1,intv00h);
end
% % % % % % top
if intv002 > 1
pzout1 = pzout;
pzout1(intv002,intv003) = pzout(intv002-1,intv003);
pzout1(intv002-1,intv003) = 0;
[intv0h1,intv0h2] = gskcostastar(pzout1,pzrstat);
intv00h = intv0h1 + intv0h2;
intv0g1 = intv00g + 1;
intv00f = intv0g1 + intv00h;
[pzinl] = gskpzjoin(pzinl,pzout1,intv00f,intv0g1,intv00h);
end
% % % % % % right
if intv003 < 3
pzout1 = pzout;
pzout1(intv002,intv003) = pzout(intv002,intv003 + 1);
pzout1(intv002,intv003 + 1) = 0;
[intv0h1,intv0h2] = gskcostastar(pzout1,pzrstat);
intv00h = intv0h1 + intv0h2;
intv0g1 = intv00g + 1;
intv00f = intv0g1 + intv00h;
[pzinl] = gskpzjoin(pzinl,pzout1,intv00f,intv0g1,intv00h);
end
% % % % % % down
if intv002 < 3
pzout1 = pzout;
pzout1(intv002,intv003) = pzout(intv002 + 1,intv003);
pzout1(intv002 + 1,intv003) = 0;
[intv0h1,intv0h2] = gskcostastar(pzout1,pzrstat);
intv00h = intv0h1 + intv0h2;
intv0g1 = intv00g + 1;
intv00f = intv0g1 + intv00h;
[pzinl] = gskpzjoin(pzinl,pzout1,intv00f,intv0g1,intv00h);
end
% % % % % % compare with history
[intv003, intv004] = size(pzinl);
for intv004 = 1 : intv003
intv005 = gsksearch(pzhis,pzinl(intv004,:));
if ~isempty(intv005)
% pzhis(intv005,13) = 1;
else
[intv007 , intv008] = size(pzhis);
intv008 = pzinl(intv004,1:12);
intv008(13) = 0;
intv008(14) = intv0nd;
intv1nd = intv1nd + 1;
intv008(15) = intv1nd;
pzhis(intv007+1,:)=intv008;
end
end
% % % % % % selecting new node
intv005 = find(pzhis(:,13) == 1);
intv006 = length(intv005);
pzrhis = pzhis;
for intv007 = 1:intv006
pzrhis(intv005(intv007)-(intv007-1),:)=[];
end
intv003 = min(pzrhis,[],1);
[pzout, intv00f, intv00g, intv00h] = gskpzget(intv003,1);
[intv002, intv003] = find((pzrhis(:,10)==intv00f) & (pzrhis(:,13)
== 0));
% intv002 = intv002(1,1);
[pzout, intv00f, intv00g, intv00h] =
gskpzget(pzrhis,intv002(1,1));
intv0nd = pzrhis(intv002(1,1),15);
pzinl = [];
[pzinl] = gskpzjoin(pzinl,pzout,intv00f,intv00g,intv00h);
intv005 = gsksearch(pzhis,pzinl);
pzhis(intv005,13) = 1;
intv001 = 1;
else
intv001 = 2;
end
end
% % Display of steps
[intv000, intv001] = size(pzhis);
intv002 = 1;
pzshow = [];
intvcnt = 0;
while intv002 ==1
intvcnt = intvcnt + 1;
pzshow(intvcnt) = intv000;
intv000 = pzhis(intv000,14);
if intv000 == 0
intv002 = 2;
else
intv002 = 1;
end
end
for intv000 = 1 : intvcnt
[pzout, intv00f, intv00g, intv00h] = gskpzget(pzhis,pzshow(intvcnt-
intv000+1));
intv000
pzout
end
end

También podría gustarte