Skip to content

Commit 0877d19

Browse files
committedAug 31, 2024
Initial commit
0 parents  commit 0877d19

12 files changed

+5892
-0
lines changed
 

‎.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

‎Headers/Estructuras.h

+173
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
#pragma once
2+
#include "Utilidades.h"
3+
4+
// STRUCTS
5+
struct Jugador {
6+
string nombre;
7+
int vidas;
8+
int puntos;
9+
int x, y; // posición del jugador
10+
int dx, dy;
11+
bool invisible;
12+
bool pregunta_respondida;
13+
14+
void dibujar() {
15+
if (invisible) {
16+
color_text(14);
17+
cursor(x, y);
18+
cout << " *";
19+
cursor(x, y + 1);
20+
cout << (char)205 << (char)186 << (char)205;
21+
cursor(x, y + 2);
22+
cout << "/ \\";
23+
color_text(1);
24+
}
25+
else {
26+
color_text(4);
27+
cursor(x, y);
28+
cout << " " << (char)220;
29+
cursor(x, y + 1);
30+
cout << (char)205 << (char)186 << (char)205;
31+
cursor(x, y + 2);
32+
cout << "/ \\";
33+
color_text(1);
34+
}
35+
}
36+
37+
void mover() {
38+
x += dx;
39+
y += dy;
40+
}
41+
42+
void borrar() {
43+
cursor(x, y);
44+
cout << " ";
45+
cursor(x, y + 1);
46+
cout << " ";
47+
cursor(x, y + 2);
48+
cout << " ";
49+
}
50+
};
51+
52+
struct Enemigo {
53+
int x, y; // posición del enemigo
54+
int dx, dy; // movimiento del enemigo
55+
56+
void dibujar() {
57+
color_text(1);
58+
cursor(x, y);
59+
cout << " -";
60+
cursor(x, y + 1);
61+
cout << "/÷\\";
62+
cursor(x, y + 2);
63+
cout << "<->";
64+
color_text(1);
65+
}
66+
67+
void mover() {
68+
x += dx;
69+
y += dy;
70+
}
71+
72+
void borrar() {
73+
cursor(x, y);
74+
cout << " ";
75+
cursor(x, y + 1);
76+
cout << " ";
77+
cursor(x, y + 2);
78+
cout << " ";
79+
}
80+
};
81+
82+
struct Tutor {
83+
int x, y; // posición del tutor
84+
bool activo;
85+
86+
void dibujar() {
87+
color_text(8);
88+
cursor(x, y);
89+
cout << " ?";
90+
cursor(x, y + 1);
91+
cout << "-" << (char)206 << "-";
92+
cursor(x, y + 2);
93+
cout << "|" << (char)202 << "|";
94+
color_text(1);
95+
}
96+
97+
void borrar() {
98+
cursor(x, y);
99+
cout << " ";
100+
cursor(x, y + 1);
101+
cout << " ";
102+
cursor(x, y + 2);
103+
cout << " ";
104+
}
105+
};
106+
107+
struct EstadoJuego {
108+
int dificultad;
109+
int segundos_cooldown;
110+
int segundos_pantalla;
111+
bool contador_activo;
112+
time_t tiempo_inicio;
113+
time_t tiempo_actual;
114+
115+
void dibujar(Jugador& jugador) {
116+
color_text(3);
117+
cursor(62, 5);
118+
cout << "VIDAS: " << jugador.vidas;
119+
cursor(62, 7);
120+
cout << "PTOS: " << jugador.puntos;
121+
cursor(62, 9);
122+
cout << "DIFICULTAD: ";
123+
cursor(62, 10);
124+
if (dificultad == 0)
125+
cout << "PRINCIPIANTE";
126+
else if (dificultad == 1)
127+
cout << "INTERMEDIO";
128+
else if (dificultad == 2)
129+
cout << "AVANZADO";
130+
else if (dificultad == 3)
131+
cout << "MAXIMO";
132+
cursor(62, 12);
133+
cout << "COOLDOWN: " << segundos_pantalla;
134+
cursor(62, 14);
135+
cout << "MISION: LLEGA";
136+
cursor(62, 15);
137+
cout << "A LA PUERTA";
138+
139+
color_text(1);
140+
}
141+
142+
void borrar() {
143+
cursor(70, 5);
144+
cout << " ";
145+
cursor(70, 7);
146+
cout << " ";
147+
cursor(64, 10);
148+
cout << " ";
149+
cursor(64, 12);
150+
cout << " ";
151+
}
152+
153+
void iniciarContador() {
154+
contador_activo = true;
155+
tiempo_inicio = time(nullptr);
156+
}
157+
158+
void actualizarContador() {
159+
if (contador_activo) {
160+
tiempo_actual = time(nullptr);
161+
int transcurrido = difftime(tiempo_actual, tiempo_inicio);
162+
int faltante = segundos_cooldown - transcurrido;
163+
if (transcurrido >= segundos_cooldown) {
164+
contador_activo = false; // Desactivar el contador
165+
segundos_cooldown = 30;
166+
segundos_pantalla = segundos_cooldown;
167+
}
168+
else {
169+
segundos_pantalla = faltante;
170+
}
171+
}
172+
}
173+
};

‎Headers/Graficos.h

+289
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
#pragma once
2+
#include "Utilidades.h"
3+
#include "Matrices.h"
4+
5+
// ELEMENTOS GRAFICOS
6+
void imp_logo(int x, int y) {
7+
color(1);
8+
for (int i = 0; i < 26; i++) {
9+
for (int j = 0; j < 80; j++) {
10+
color(logo[i][j] /* Matrices.h */);
11+
cursor(x + j, y + i);
12+
cout << " ";
13+
}
14+
}
15+
color(1);
16+
}
17+
18+
void imp_bolas(int n, int x, int y) {
19+
color(1);
20+
int bol[6][6] = { {1, 1, n, n, 1, 1}, {1, n, n, n, n, 1}, {n, n, n, n, n, n},
21+
{n, n, n, n, n, n}, {1, n, n, n, n, 1}, {1, 1, n, n, 1, 1} };
22+
for (int i = 0; i < 6; i++) {
23+
for (int j = 0; j < 6; j++) {
24+
color(bol[i][j]);
25+
cursor(x + j, y + i);
26+
cout << " ";
27+
}
28+
}
29+
color(1);
30+
}
31+
32+
void imp_moneda_entero(int cantidad, int x, int y) {
33+
color(1);
34+
int n = 10;
35+
int bol[6][6] = { {1, 1, n, n, 1, 1}, {1, n, n, n, n, 1}, {n, n, n, n, n, n},
36+
{n, n, n, n, n, n}, {1, n, n, n, n, 1}, {1, 1, n, n, 1, 1} };
37+
for (int i = 0; i < 6; i++) {
38+
for (int j = 0; j < 6; j++) {
39+
color(bol[i][j]);
40+
cursor(x + j, y + i);
41+
cout << " ";
42+
}
43+
}
44+
cursor(x + 2, y + 2);
45+
cout << cantidad;
46+
color(1);
47+
}
48+
49+
void imp_moneda_decimal(int cantidad, int x, int y) {
50+
color(1);
51+
int n = 16;
52+
int bol[6][6] = { {1, 1, n, n, 1, 1}, {1, n, n, n, n, 1}, {n, n, n, n, n, n},
53+
{n, n, n, n, n, n}, {1, n, n, n, n, 1}, {1, 1, n, n, 1, 1} };
54+
for (int i = 0; i < 6; i++) {
55+
for (int j = 0; j < 6; j++) {
56+
color(bol[i][j]);
57+
cursor(x + i, y + j);
58+
cout << " ";
59+
}
60+
}
61+
62+
cursor(x + 2, y + 2);
63+
cout << cantidad;
64+
65+
color(1);
66+
}
67+
68+
void imp_caja(int n, int x, int y) {
69+
color(1);
70+
int caj[6][6] = { {n, 1, 1, 1, 1, n}, {n, n, n, n, n, n}, {n, 1, 1, 1, 1, n},
71+
{n, n, n, n, n, n}, {n, n, n, n, n, n}, {n, n, n, n, n, n} };
72+
for (int i = 0; i < 6; i++) {
73+
for (int j = 0; j < 6; j++) {
74+
color(caj[i][j]);
75+
cursor(x + j, y + i);
76+
cout << " ";
77+
}
78+
}
79+
color(1);
80+
}
81+
82+
void imp_game_over() {
83+
system("cls");
84+
Console::ForegroundColor = ConsoleColor::Cyan;
85+
cursor(0, 1);
86+
cout << R"(
87+
++------------------------------------------------++
88+
++------------------------------------------------++
89+
|| sSSSSs .S_SSSs .S_SsS_S. sSSs ||
90+
|| d%%%%SP .SS~SSSSS .SS~S*S~SS. d%%SP ||
91+
|| d%S' S%S SSSS S%S `Y' S%S d%S' ||
92+
|| S%S S%S S%S S%S S%S S%S ||
93+
|| S&S S%S SSSS%S S%S S%S S&S ||
94+
|| S&S S&S SSS%S S&S S&S S&S_Ss ||
95+
|| S&S S&S S&S S&S S&S S&S~SP ||
96+
|| S&S sSSs S&S S&S S&S S&S S&S ||
97+
|| S*b `S%% S*S S&S S*S S*S S*b ||
98+
|| S*S S% S*S S*S S*S S*S S*S. ||
99+
|| SS_sSSS S*S S*S S*S S*S SSSbs ||
100+
|| Y~YSSY SSS S*S SSS S*S YSSP ||
101+
|| SP SP ||
102+
|| Y Y ||
103+
|| ||
104+
|| sSSs_sSSs .S S. sSSs .S_sSSs ||
105+
|| d%%SP~YS%%b .SS SS. d%%SP .SS~YS%%b ||
106+
|| d%S' `S%b S%S S%S d%S' S%S `S%b ||
107+
|| S%S S%S S%S S%S S%S S%S S%S ||
108+
|| S&S S&S S&S S%S S&S S%S d*S ||
109+
|| S&S S&S S&S S&S S&S_Ss S&S .S*S ||
110+
|| S&S S&S S&S S&S S&S~SP S&S_sdSSS ||
111+
|| S&S S&S S&S S&S S&S S&S~YSY%b ||
112+
|| S*b d*S S*b S*S S*b S*S `S%b ||
113+
|| S*S. .S*S S*S. S*S S*S. S*S S%S ||
114+
|| SSSbs_sdSSS SSSbs_S*S SSSbs S*S S&S ||
115+
|| YSSP~YSSY YSSP~SSS YSSP S*S SSS ||
116+
|| SP ||
117+
|| Y ||
118+
|| ||
119+
++------------------------------------------------++
120+
++------------------------------------------------++
121+
)";
122+
_sleep(1500);
123+
}
124+
125+
void imp_you_win() {
126+
system("cls");
127+
Console::ForegroundColor = ConsoleColor::Cyan;
128+
cursor(0, 1);
129+
cout << R"(
130+
>>========================================<<
131+
|| ||
132+
|| ||
133+
|| ____ ___ ||
134+
|| `MM( )M' ||
135+
|| `MM. d' ||
136+
|| `MM. d' _____ ___ ___ ||
137+
|| `MM d' 6MMMMMb `MM MM ||
138+
|| `MM' 6M' `Mb MM MM ||
139+
|| MM MM MM MM MM ||
140+
|| MM MM MM MM MM ||
141+
|| MM MM MM MM MM ||
142+
|| MM YM. ,M9 YM. MM ||
143+
|| _MM_ YMMMMM9 YMMM9MM_ ||
144+
|| ||
145+
|| ||
146+
|| ||
147+
|| ||
148+
|| ||
149+
|| ____ ___ ||
150+
|| `Mb( db )d' 68b ||
151+
|| YM. ,PM. ,P Y89 ||
152+
|| `Mb d'Mb d' ___ ___ __ ||
153+
|| YM. ,P YM. ,P `MM `MM 6MMb ||
154+
|| `Mb d' `Mb d' MM MMM9 `Mb ||
155+
|| YM. ,P YM. ,P MM MM' MM ||
156+
|| `Mb d' `Mb d' MM MM MM ||
157+
|| YM,P YM,P MM MM MM ||
158+
|| `MM' `MM' MM MM MM ||
159+
|| YP YP _MM__MM_ _MM_ ||
160+
|| ||
161+
|| ||
162+
>>========================================<<
163+
)";
164+
_sleep(1500);
165+
}
166+
167+
void imp_mundo_actual(int mundo, int escenario) {
168+
if (mundo == 1) {
169+
if (escenario == 1) {
170+
cursor(0, 30);
171+
cout << R"(
172+
/============================================================\
173+
|| __ ___ __ ___ ___ ||
174+
|| / |/ /_ ______ ____/ /___ < / < / ||
175+
|| / /|_/ / / / / __ \/ __ / __ \ / / ______ / / ||
176+
|| / / / / /_/ / / / / /_/ / /_/ / / / /_____/ / / ||
177+
||/_/ /_/\__,_/_/ /_/\__,_/\____/ /_/ /_/ ||
178+
\============================================================/
179+
)";
180+
}
181+
else if (escenario == 2) {
182+
cursor(0, 30);
183+
cout << R"(
184+
/============================================================\
185+
|| __ ___ __ ___ ___ ||
186+
|| / |/ /_ ______ ____/ /___ < / |__ \||
187+
|| / /|_/ / / / / __ \/ __ / __ \ / / ______ __/ /||
188+
|| / / / / /_/ / / / / /_/ / /_/ / / / /_____/ / __/ ||
189+
||/_/ /_/\__,_/_/ /_/\__,_/\____/ /_/ /____/ ||
190+
\============================================================/
191+
)";
192+
}
193+
else if (escenario == 3) {
194+
cursor(0, 30);
195+
cout << R"(
196+
/==============================================================\
197+
|| __ ___ __ ___ _____ ||
198+
|| / |/ /_ ______ ____/ /___ < / |__ / ||
199+
|| / /|_/ / / / / __ \/ __ / __ \ / / ______ /_ < ||
200+
|| / / / / /_/ / / / / /_/ / /_/ / / / /_____/ ___/ / ||
201+
||/_/ /_/\__,_/_/ /_/\__,_/\____/ /_/ /____/ ||
202+
\==============================================================/
203+
)";
204+
}
205+
}
206+
else if (mundo == 2) {
207+
if (escenario == 1) {
208+
cursor(0, 30);
209+
cout << R"(
210+
/================================================================\
211+
|| __ ___ __ ___ ___||
212+
|| / |/ /_ ______ ____/ /___ |__ \ < /||
213+
|| / /|_/ / / / / __ \/ __ / __ \ __/ / ______ / / ||
214+
|| / / / / /_/ / / / / /_/ / /_/ / / __/ /_____/ / / ||
215+
||/_/ /_/\__,_/_/ /_/\__,_/\____/ /____/ /_/ ||
216+
\================================================================/
217+
)";
218+
}
219+
else if (escenario == 2) {
220+
cursor(0, 30);
221+
cout << R"(
222+
/==================================================================\
223+
|| __ ___ __ ___ ___ ||
224+
|| / |/ /_ ______ ____/ /___ |__ \ |__ \ ||
225+
|| / /|_/ / / / / __ \/ __ / __ \ __/ / ______ __/ / ||
226+
|| / / / / /_/ / / / / /_/ / /_/ / / __/ /_____/ / __/ ||
227+
||/_/ /_/\__,_/_/ /_/\__,_/\____/ /____/ /____/ ||
228+
\==================================================================/
229+
)";
230+
}
231+
else if (escenario == 3) {
232+
cursor(0, 30);
233+
cout << R"(
234+
/==================================================================\
235+
|| __ ___ __ ___ _____||
236+
|| / |/ /_ ______ ____/ /___ |__ \ |__ /||
237+
|| / /|_/ / / / / __ \/ __ / __ \ __/ / ______ /_ < ||
238+
|| / / / / /_/ / / / / /_/ / /_/ / / __/ /_____/ ___/ / ||
239+
||/_/ /_/\__,_/_/ /_/\__,_/\____/ /____/ /____/ ||
240+
\==================================================================/
241+
)";
242+
}
243+
}
244+
}
245+
246+
// ANIMACION PUERTA ABIERTA - CERRADA
247+
void anim_puerta_cerrada(int n, int x, int y) {
248+
color(1);
249+
int puerta[10][10] = {
250+
{5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, {5, n, n, n, n, n, n, n, n, 5},
251+
{5, n, n, n, n, n, n, n, n, 5}, {5, n, n, n, n, n, n, n, n, 5},
252+
{5, n, n, n, n, n, n, n, n, 5}, {5, n, n, n, n, n, n, n, 16, 5},
253+
{5, n, n, n, n, n, n, n, n, 5}, {5, n, n, n, n, n, n, n, n, 5},
254+
{5, n, n, n, n, n, n, n, n, 5}, {5, n, n, n, n, n, n, n, n, 5} };
255+
for (int i = 0; i < 10; i++) {
256+
for (int j = 0; j < 10; j++) {
257+
color(puerta[i][j]);
258+
cursor(x + j, y + i);
259+
cout << " ";
260+
}
261+
}
262+
color(1);
263+
}
264+
265+
void anim_puerta_abierta(int n, int x, int y) {
266+
color(1);
267+
int puerta[10][10] = {
268+
{5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, {5, n, 1, 1, 1, 1, 1, 1, 1, 5},
269+
{5, n, 1, 1, 1, 1, 1, 1, 1, 5}, {5, n, 1, 1, 1, 1, 1, 1, 1, 5},
270+
{5, n, 1, 1, 1, 1, 1, 1, 1, 5}, {5, n, 1, 1, 1, 1, 1, 1, 1, 5},
271+
{5, n, 1, 1, 1, 1, 1, 1, 1, 5}, {5, n, 1, 1, 1, 1, 1, 1, 1, 5},
272+
{5, n, 1, 1, 1, 1, 1, 1, 1, 5}, {5, n, 1, 1, 1, 1, 1, 1, 1, 5} };
273+
for (int i = 0; i < 10; i++) {
274+
for (int j = 0; j < 10; j++) {
275+
color(puerta[i][j]);
276+
cursor(x + j, y + i);
277+
cout << " ";
278+
}
279+
}
280+
color(1);
281+
}
282+
283+
void animacion_puerta(int color, int x, int y) {
284+
system("cls");
285+
anim_puerta_cerrada(color, x, y);
286+
_sleep(1000);
287+
anim_puerta_abierta(color, x, y);
288+
_sleep(1000);
289+
}

‎Headers/Juego.h

+1,425
Large diffs are not rendered by default.

‎Headers/Matrices.h

+231
Large diffs are not rendered by default.

‎Headers/Menu.h

+506
Large diffs are not rendered by default.

‎Headers/Preguntas.h

+353
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,353 @@
1+
#pragma once
2+
#include "Utilidades.h"
3+
#include "Graficos.h"
4+
5+
// PREGUNTAS
6+
int pregunta_m1_esc1() {
7+
int respuesta = 4;
8+
int color_bolas = 10;
9+
10+
system("cls");
11+
cursor(0, 0);
12+
cout << R"(
13+
_____ ___ _ _ ___ ___ ____ ___ ___ ___ ___ ___ _ ___
14+
|_ _| __| \| |/ __|/ _ \ |__ / | __/ __| __| __| _ \ /_\ / __|
15+
| | | _|| .` | (_ | (_) | |_ \ | _|\__ | _|| _|| // _ \\__ \
16+
|_| |___|_|\_|\___|\___/ |___/ |___|___|_| |___|_|_/_/ \_|___/
17+
)";
18+
imp_bolas(color_bolas, 3, 6);
19+
imp_bolas(color_bolas, 10, 6);
20+
imp_bolas(color_bolas, 17, 6);
21+
22+
_sleep(2500);
23+
cursor(3, 11);
24+
cout << R"(
25+
__ __ ___ __ __ __ ___ ___ __ __ _ __ _ _ __ _ __ __
26+
\ `v' / / _//__\| V | _,\ _ \/__\ / \| | / _] || | \| |/ \ /' _/
27+
`. .' | \_| \/ | \_/ | v_/ v / \/ | | /\ | || [/\ \/ | | ' | /\ |`._`.
28+
!_! \__/\__/|_| |_|_| |_|_\\__/ |_||_|___\__/\__/|_|\__|_||_||___/
29+
__ __ __ __ ___ __ ___ __ _____ ___ __ _ ___ ___ _ _ __ _
30+
| V |/ \ /' _/ | _,\/ \| _ \/ \ |_ _| __| \| | __| _ \ | || | \| |
31+
| \_/ | /\ |`._`. | v_/ /\ | v / /\ | | | | _|| | ' | _|| v / | \/ | | ' |
32+
|_| |_|_||_||___/ |_| |_||_|_|_\_||_| |_| |___|_|\__|___|_|_\ \__/|_|\__|
33+
_____ __ _____ __ _ __ ___ ___ ___ __ ___ ___ ___ __ __
34+
|_ _/__\_ _/ \| | | _\| __| |_ | | __/' _/| __| __| _ \/ \ /' _/
35+
| || \/ || || /\ | |_ | v | _| / / | _|`._`.| _|| _|| v / /\ |`._`.
36+
|_| \__/ |_||_||_|___| |__/|___| |_/ |___|___/|_| |___|_|_\_||_||___/
37+
)";
38+
imp_bolas(color_bolas, 3, 25);
39+
imp_bolas(color_bolas, 10, 25);
40+
imp_bolas(color_bolas, 17, 25);
41+
imp_bolas(color_bolas, 24, 25);
42+
imp_bolas(color_bolas, 31, 25);
43+
imp_bolas(color_bolas, 38, 25);
44+
imp_bolas(color_bolas, 45, 25);
45+
46+
_sleep(2500);
47+
cursor(3, 30);
48+
cout << R"(
49+
_ ___ _ _ _ _ _ _____ _ ___ ___ ___ __ __ ___ ___ ___ ___
50+
(_)/ __| | | |/_\ | \| |_ _/_\ / __| / __/ _ \| \/ | _ | _ | __|__ \
51+
/ /| (__| |_| / _ \| .` | | |/ _ \\__ \ | (_| (_) | |\/| | _| | _| /_/
52+
\___\___|\___/_/ \_|_|\_| |_/_/ \_|___/ \___\___/|_| |_|_| |_|_|___|(_)
53+
)";
54+
55+
return respuesta;
56+
}
57+
58+
int pregunta_m1_esc2() {
59+
int color_monedas = 16;
60+
int respuesta = 5;
61+
62+
system("cls");
63+
cursor(0, 0);
64+
cout << R"(
65+
_____ ____ _
66+
|_ _|__ _ _ __ _ ___ |__ | _ __ ___ _ _ ___ __| |__ _ ___
67+
| |/ -_) ' \/ _` / _ \ / / | ' \/ _ \ ' \/ -_) _` / _` (_-<
68+
|_|\___|_||_\__, \___/ /_/ |_|_|_\___/_||_\___\__,_\__,_/__/
69+
|___/
70+
)";
71+
_sleep(50);
72+
imp_bolas(color_monedas, 10, 7);
73+
_sleep(50);
74+
imp_bolas(color_monedas, 17, 7);
75+
_sleep(50);
76+
imp_bolas(color_monedas, 24, 7);
77+
_sleep(50);
78+
imp_bolas(color_monedas, 31, 7);
79+
_sleep(50);
80+
imp_bolas(color_monedas, 38, 7);
81+
_sleep(50);
82+
imp_bolas(color_monedas, 45, 7);
83+
_sleep(50);
84+
imp_bolas(color_monedas, 52, 7);
85+
86+
_sleep(2500);
87+
cursor(0, 12);
88+
cout << R"(
89+
___ _ __ _
90+
/ __|__ _ __| |_ /_/ __ _| |__ _ _ _ _ _ __ _ ___
91+
| (_ / _` (_-< _/ -_) / _` | / _` | || | ' \/ _` (_-<
92+
\___\__,_/__/\__\___| \__,_|_\__, |\_,_|_||_\__,_/__/
93+
|___/
94+
)";
95+
96+
_sleep(2500);
97+
cursor(0, 17);
98+
cout << R"(
99+
_ _ _ ___
100+
/_\ | |_ ___ _ _ __ _ __ _ _ _ ___ __| |__ _ _ _ |_ )
101+
/ _ \| ' \/ _ \ '_/ _` | / _` | || / -_) _` / _` | ' \ / /
102+
/_/ \_\_||_\___/_| \__,_| \__, |\_,_\___\__,_\__,_|_||_| /___|
103+
|_|
104+
)";
105+
106+
// DIBUJA MONEDAS
107+
_sleep(50);
108+
imp_bolas(color_monedas, 26, 23);
109+
_sleep(50);
110+
imp_bolas(color_monedas, 33, 23);
111+
112+
_sleep(2500);
113+
cursor(0, 28);
114+
cout << R"(
115+
_ ___ _ _ _____
116+
(_)/ __| _ __ _ _ _| |_ __ _ ___ __ _ __ _ __| |_ /_/__ \
117+
/ /| (_| || / _` | ' \ _/ _` (_-< / _` / _` (_-< _/ -_)/_/
118+
\___\___\_,_\__,_|_||_\__\__,_/__/ \__, \__,_/__/\__\___(_)
119+
|___/
120+
)";
121+
122+
return respuesta;
123+
}
124+
125+
int pregunta_m1_esc3() {
126+
int respuesta = 4;
127+
int color_cajas = 7;
128+
129+
system("cls");
130+
cursor(0, 0);
131+
cout << R"(
132+
_____ ___ _ _ ___ ___ ____ ___ _ _ _ ___ ___ ___ _ _
133+
|_ _| __| \| |/ __|/ _ \ |__ / / __| /_\ _ | |/_\ / __| / __/ _ \| \| |
134+
| | | _|| .` | (_ | (_) | |_ \ | (__ / _ \ || / _ \\__ \ | (_| (_) | .` |
135+
|_|_|___|_|\_|\___|\___/ |___/ _\___/_/_\_\__/_/_\_\___/__\___\___/|_|\_|
136+
|_ _/ __| | | |/_\ | | | \| | | | | \/ | __| _ \/ _ \ | \| __|
137+
| | (_ | |_| / _ \| |__ | .` | |_| | |\/| | _|| / (_) | | |) | _|
138+
|___\___|\___/_/ \_\____|_|_|\_|\___/|_| |_|___|_|_\\___/ |___/|___|
139+
| __/ __| __| __| _ \ /_\ / __|
140+
| _|\__ \ _|| _|| / / _ \\__ \
141+
|___|___/_| |___|_|_\/_/ \_\___/
142+
)";
143+
imp_caja(color_cajas, 30, 12);
144+
imp_caja(color_cajas, 37, 12);
145+
imp_caja(color_cajas, 44, 12);
146+
147+
_sleep(2500);
148+
cursor(3, 17);
149+
cout << R"(
150+
___ _ _ _____ ___ _____ _ _ ___ ___ _ _ _ ___
151+
| __| \| | |_ _/ _ \_ _/_\ | | / __|/ _ \| \| | / |_ )
152+
| _|| .` | | || (_) || |/ _ \| |__ \__ \ (_) | .` | | |/ /
153+
|___|_|\_| |_| \___/_|_/_/ \_\____| |___/\___/|_|\_| |_/___|
154+
| __/ __| __| __| _ \ /_\ / __|
155+
| _|\__ \ _|| _|| / / _ \\__ \
156+
|___|___/_| |___|_|_\/_/ \_\___/
157+
)";
158+
159+
_sleep(2500);
160+
cursor(3, 25);
161+
cout << R"(
162+
___ _ _ _ _ _ _____ _ ___ ___ ___ ___ ___ ___ _ ___
163+
/ __| | | |/_\ | \| |_ _/_\ / __| | __/ __| __| __| _ \ /_\ / __|
164+
| (__| |_| / _ \| .` | | |/ _ \\__ \ | _|\__ \ _|| _|| / / _ \\__ \
165+
_ \___|\___/_/_\_\_|\_| |_/_/_\_\___/ |___|___/_| |___|_|_\/_/ \_\___/___
166+
| || | /_\ \ / / | __| \| | / __| /_\ | \ /_\ / __| /_\ _ | |/_\|__ \
167+
| __ |/ _ \ V / | _|| .` | | (__ / _ \| |) / _ \ | (__ / _ \ || / _ \ /_/
168+
|_||_/_/ \_\_| |___|_|\_| \___/_/ \_\___/_/ \_\ \___/_/ \_\__/_/ \_(_)
169+
)";
170+
171+
return respuesta;
172+
}
173+
174+
int pregunta_m2_esc1() {
175+
system("cls");
176+
_sleep(500);
177+
cout << R"(
178+
_____ ___ _ _ ___ ___ ____ ___ ___ ___ ___ ___ _ ___
179+
|_ _| __| \| |/ __|/ _ \ |__ / | __/ __| __| __| _ \ /_\ / __|
180+
| | | _|| .` | (_ | (_) | |_ \ | _|\__ \ _|| _|| / / _ \\__ \
181+
|_| |___|_|\_|\___|\___/ |___/ |___|___/_| |___|_|_\/_/ \_\___/
182+
)";
183+
imp_bolas(14, 2, 6);
184+
imp_bolas(14, 9, 6);
185+
imp_bolas(14, 16, 6);
186+
187+
_sleep(1500);
188+
cursor(0, 10);
189+
cout << R"(
190+
_ ___ _ ___ ___ ___ ___ ___ ___
191+
| | | __| /_\ / __| _ \ __/ __|/ _ \ |_ )
192+
| |__| _| / _ \ (_ | / _| (_ | (_) | / /
193+
|____|___| /_/ \_\___|_|_\___\___|\___/ /___|
194+
)";
195+
196+
imp_bolas(14, 2, 16);
197+
imp_bolas(14, 9, 16);
198+
199+
_sleep(1500);
200+
cursor(0, 21);
201+
cout << R"(
202+
__ __ _ ___ ___ _ _ ___ _____ ___ _ _
203+
\ \ / / | | | __| / _ \| | | |_ _|_ _/ _ \ | | |
204+
\ V / | |__| _| | (_) | |_| || | | || (_) | |_ _|
205+
|_| |____|___| \__\_\\___/|___| |_| \___/ |_|
206+
)";
207+
208+
imp_bolas(14, 2, 27);
209+
imp_bolas(14, 9, 27);
210+
imp_bolas(14, 16, 27);
211+
imp_bolas(14, 23, 27);
212+
213+
_sleep(1500);
214+
cursor(0, 32);
215+
cout << R"(
216+
___ _ _ _ _ _ _____ _ ___ _____ ___ _ _ ___ ___ ___
217+
/ __| | | |/_\ | \| |_ _/_\ / __| |_ _| __| \| |/ __|/ _ \__ \
218+
| (__| |_| / _ \| .` | | |/ _ \\__ \ | | | _|| .` | (_ | (_) |/_/
219+
\___|\___/_/ \_\_|\_| |_/_/ \_\___/ |_| |___|_|\_|\___|\___/(_)
220+
)";
221+
222+
return 1;
223+
}
224+
225+
int pregunta_m2_esc2() {
226+
227+
cursor(0, 0);
228+
cout << R"(
229+
___ ___ _____ ___ _ _ ___ ___
230+
/ __|_ _| |_ _| __| \| |/ __|/ _ \
231+
\__ \| | | | | _|| .` | (_ | (_) |
232+
|___/___| |_| |___|_|\_|\___|\___/
233+
)";
234+
imp_moneda_entero(1, 45, 1);
235+
imp_moneda_decimal(20, 53, 1);
236+
237+
_sleep(1500);
238+
cursor(0, 7);
239+
cout << R"(
240+
_ ___ _ _ _ __ __ ___ _ _ _____ ___
241+
| | | __| /_\| | | | \/ | __| \| |_ _/ _ \
242+
| |__| _| / _ \ |_| | |\/| | _|| .` | | || (_) |
243+
|____|___| /_/ \_\___/|_| |_|___|_|\_| |_| \___/
244+
)";
245+
imp_moneda_entero(2, 57, 8);
246+
imp_moneda_decimal(30, 65, 8);
247+
248+
_sleep(1500);
249+
cursor(0, 15);
250+
cout << R"(
251+
__ __ _ ___ ___ _ _ ___ _____ ___
252+
\ \ / / | | | __| / _ \| | | |_ _|_ _/ _ \
253+
\ V / | |__| _| | (_) | |_| || | | || (_) |
254+
|_| |____|___| \__\_\\___/|___| |_| \___/
255+
)";
256+
257+
imp_moneda_decimal(10, 52, 16);
258+
259+
_sleep(1500);
260+
cursor(0, 21);
261+
cout << R"(
262+
___ _ _ _ _ _ _____ ___ ___ ___ ___ _ ___ ___
263+
/ __| | | |/_\ | \| |_ _/ _ \/ __| / __|/ _ \| | | __/ __|
264+
| (__| |_| / _ \| .` | | || (_) \__ \ \__ \ (_) | |__| _|\__ \
265+
\___|\___/_/ \_\_|\_|_|_|_\___/|___/ |___/\___/|____|___|___/
266+
|_ _| __| \| |/ __|/ _ \__ \
267+
| | | _|| .` | (_ | (_) |/_/
268+
|_| |___|_|\_|\___|\___/(_)
269+
270+
)";
271+
return 3;
272+
}
273+
274+
int pregunta_m2_esc3() {
275+
system("cls");
276+
cursor(0, 0);
277+
cout << R"(
278+
___ ___ _
279+
/ __|_ _| /_\
280+
\__ \| | / _ \
281+
|___/___| /_/ \_\
282+
)";
283+
284+
imp_moneda_entero(1, 26, 1);
285+
286+
_sleep(1500);
287+
cursor(0, 7);
288+
cout << R"(
289+
_ ___ _ _ _ __ __ ___ _ _ _____ ___ _ _
290+
| | | __| /_\| | | | \/ | __| \| |_ _/ _ \ | | /_\
291+
| |__| _| / _ \ |_| | |\/| | _|| .` | | || (_) | | |__ / _ \
292+
|____|___|_/_/_\_\___/|_| |_|___|_|\_| |_| \___/ |____/_/ \_\
293+
| \/ |_ _|_ _/_\ | \ | \| __|
294+
| |\/| || | | |/ _ \| |) | | |) | _|
295+
|_| |_|___| |_/_/ \_\___/ |___/|___|
296+
)";
297+
imp_moneda_decimal(20, 43, 13);
298+
299+
_sleep(1500);
300+
cursor(0, 20);
301+
cout << R"(
302+
__ __ _ ___ ___ _ _ ___ _____ ___
303+
\ \ / / | | | __| / _ \| | | |_ _|_ _/ _ \
304+
\ V / | |__| _| | (_) | |_| || | | || (_) |
305+
|_| |____|___| \__\_\\___/|___| |_| \___/
306+
)";
307+
imp_moneda_decimal(50, 54, 21);
308+
309+
_sleep(1500);
310+
cursor(0, 27);
311+
cout << R"(
312+
___ _ _ _ _ _ _____ ___ ___ ___ ___ _ ___ ___
313+
/ __| | | |/_\ | \| |_ _/ _ \/ __| / __|/ _ \| | | __/ __|
314+
| (__| |_| / _ \| .` | | || (_) \__ \ \__ \ (_) | |__| _|\__ \
315+
\___|\___/_/ \_\_|\_|_|_|_\___/|___/ |___/\___/|____|___|___/
316+
|_ _| __| \| |/ __|/ _ \__ \
317+
| | | _|| .` | (_ | (_) |/_/
318+
|_| |___|_|\_|\___|\___/(_)
319+
)";
320+
return 0;
321+
}
322+
323+
int pregunta(int mundo, int escenario) {
324+
int respuesta = 0;
325+
if (mundo == 1) {
326+
switch (escenario) {
327+
case 1:
328+
respuesta = pregunta_m1_esc1();
329+
break;
330+
case 2:
331+
respuesta = pregunta_m1_esc2();
332+
break;
333+
case 3:
334+
respuesta = pregunta_m1_esc3();
335+
break;
336+
}
337+
}
338+
else if (mundo == 2) {
339+
switch (escenario) {
340+
case 1:
341+
respuesta = pregunta_m2_esc1();
342+
break;
343+
case 2:
344+
respuesta = pregunta_m2_esc2();
345+
break;
346+
case 3:
347+
respuesta = pregunta_m2_esc3();
348+
break;
349+
}
350+
}
351+
352+
return respuesta;
353+
}

‎Headers/Ranking.h

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#pragma once
2+
#include "Utilidades.h"
3+
4+
// LOGICA PARA EL RANKING
5+
int calcular_puntaje_pregunta(int num_intento) {
6+
int pts = 0;
7+
if (num_intento == 1) {
8+
pts = 3;
9+
}
10+
else if (num_intento == 2) {
11+
pts = 2;
12+
}
13+
else if (num_intento == 3) {
14+
pts = 1;
15+
}
16+
17+
return pts;
18+
}
19+
20+
void ordenar(string** ranking, int numJugadores) {
21+
for (int i = 0; i < numJugadores - 1; ++i) {
22+
for (int j = 0; j < numJugadores - i - 1; ++j) {
23+
if (stoi(ranking[j][1]) < stoi(ranking[j + 1][1])) {
24+
// Intercambiar los jugadores
25+
string tempNombre = ranking[j][0];
26+
string tempPts = ranking[j][1];
27+
ranking[j][0] = ranking[j + 1][0];
28+
ranking[j][1] = ranking[j + 1][1];
29+
ranking[j + 1][0] = tempNombre;
30+
ranking[j + 1][1] = tempPts;
31+
}
32+
}
33+
}
34+
}
35+
36+
void agregar_ranking(int& numJugadores, string**& ranking, string nombre, int pts) {
37+
// Crear un nuevo array con tamaño incrementado
38+
string** nuevoRanking = new string * [numJugadores + 1];
39+
for (int i = 0; i < numJugadores + 1; ++i) {
40+
nuevoRanking[i] = new string[2];
41+
}
42+
43+
// Copiar el contenido del ranking actual al nuevo ranking
44+
for (int i = 0; i < numJugadores; ++i) {
45+
nuevoRanking[i][0] = ranking[i][0];
46+
nuevoRanking[i][1] = ranking[i][1];
47+
}
48+
49+
// Agregar el nuevo jugador al final
50+
nuevoRanking[numJugadores][0] = nombre;
51+
nuevoRanking[numJugadores][1] = to_string(pts);
52+
53+
// Liberar la memoria del ranking anterior
54+
for (int i = 0; i < numJugadores; ++i) {
55+
delete[] ranking[i];
56+
}
57+
delete[] ranking;
58+
59+
// Asignar el nuevo ranking y aumentar el número de jugadores
60+
ranking = nuevoRanking;
61+
numJugadores++;
62+
}
63+
64+
void puntaje_ranking(string** ranking, int numJugadores, int x, int y) {
65+
system("cls");
66+
int mostrar = numJugadores > 5 ? 5 : numJugadores;
67+
68+
ordenar(ranking, numJugadores);
69+
cursor(x, y);
70+
cout << R"(
71+
888888ba dP oo
72+
88 `8b 88
73+
a88aaaa8P' .d8888b. 88d888b. 88 .dP dP 88d888b. .d8888b.
74+
88 `8b. 88' `88 88' `88 88888" 88 88' `88 88' `88
75+
88 88 88. .88 88 88 88 `8b. 88 88 88 88. .88
76+
dP dP `88888P8 dP dP dP `YP dP dP dP `8888P88
77+
.88
78+
d8888P
79+
)";
80+
y += 11;
81+
for (int i = 0; i < mostrar; i++) {
82+
cursor(x + 10, y + i * 2);
83+
cout << i + 1 << ". " << ranking[i][0] << ": " << ranking[i][1] << " pts." << endl;
84+
}
85+
}

‎Headers/Tutores.h

+2,694
Large diffs are not rendered by default.

‎Headers/Utilidades.h

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#pragma once
2+
#include "iostream"
3+
#include "string"
4+
#include "conio.h"
5+
6+
using namespace std;
7+
using namespace System;
8+
9+
void iniciar() {
10+
Console::SetWindowSize(80, 40);
11+
srand(time(nullptr));
12+
}
13+
14+
void cursor(int x, int y) {
15+
Console::CursorVisible = false;
16+
Console::SetCursorPosition(x, y);
17+
}
18+
19+
int aleatorio(int min, int max) { return rand() % (max - min + 1) + min; }
20+
21+
void color(int n) {
22+
switch (n) {
23+
case 1:
24+
Console::BackgroundColor = ConsoleColor::Black;
25+
break;
26+
case 2:
27+
Console::BackgroundColor = ConsoleColor::Blue;
28+
break;
29+
case 3:
30+
Console::BackgroundColor = ConsoleColor::Cyan;
31+
break;
32+
case 4:
33+
Console::BackgroundColor = ConsoleColor::DarkBlue;
34+
break;
35+
case 5:
36+
Console::BackgroundColor = ConsoleColor::DarkCyan;
37+
break;
38+
case 6:
39+
Console::BackgroundColor = ConsoleColor::DarkGray;
40+
break;
41+
case 7:
42+
Console::BackgroundColor = ConsoleColor::DarkGreen;
43+
break;
44+
case 8:
45+
Console::BackgroundColor = ConsoleColor::DarkMagenta;
46+
break;
47+
case 9:
48+
Console::BackgroundColor = ConsoleColor::DarkRed;
49+
break;
50+
case 10:
51+
Console::BackgroundColor = ConsoleColor::DarkYellow;
52+
break;
53+
case 11:
54+
Console::BackgroundColor = ConsoleColor::Gray;
55+
break;
56+
case 12:
57+
Console::BackgroundColor = ConsoleColor::Green;
58+
break;
59+
case 13:
60+
Console::BackgroundColor = ConsoleColor::Magenta;
61+
break;
62+
case 14:
63+
Console::BackgroundColor = ConsoleColor::Red;
64+
break;
65+
case 15:
66+
Console::BackgroundColor = ConsoleColor::White;
67+
break;
68+
case 16:
69+
Console::BackgroundColor = ConsoleColor::Yellow;
70+
break;
71+
}
72+
}
73+
74+
void color_text(int n) {
75+
switch (n) {
76+
case 1:
77+
Console::ForegroundColor = ConsoleColor::Black;
78+
break;
79+
case 2:
80+
Console::ForegroundColor = ConsoleColor::Blue;
81+
break;
82+
case 3:
83+
Console::ForegroundColor = ConsoleColor::Cyan;
84+
break;
85+
case 4:
86+
Console::ForegroundColor = ConsoleColor::DarkBlue;
87+
break;
88+
case 5:
89+
Console::ForegroundColor = ConsoleColor::DarkCyan;
90+
break;
91+
case 6:
92+
Console::ForegroundColor = ConsoleColor::DarkGray;
93+
break;
94+
case 7:
95+
Console::ForegroundColor = ConsoleColor::DarkGreen;
96+
break;
97+
case 8:
98+
Console::ForegroundColor = ConsoleColor::DarkMagenta;
99+
break;
100+
case 9:
101+
Console::ForegroundColor = ConsoleColor::DarkRed;
102+
break;
103+
case 10:
104+
Console::ForegroundColor = ConsoleColor::DarkYellow;
105+
break;
106+
case 11:
107+
Console::ForegroundColor = ConsoleColor::Gray;
108+
break;
109+
case 12:
110+
Console::ForegroundColor = ConsoleColor::Green;
111+
break;
112+
case 13:
113+
Console::ForegroundColor = ConsoleColor::Magenta;
114+
break;
115+
case 14:
116+
Console::ForegroundColor = ConsoleColor::Red;
117+
break;
118+
case 15:
119+
Console::ForegroundColor = ConsoleColor::White;
120+
break;
121+
case 16:
122+
Console::ForegroundColor = ConsoleColor::Yellow;
123+
break;
124+
}
125+
}

‎Main/MathXSpy.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "Menu.h"
2+
3+
int main() {
4+
menu();
5+
6+
return 0;
7+
}

‎README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# MathXSpy-TF1
2+
Game created for the final project of the first cycle of my career with the aim of teaching mathematics for all ages.

0 commit comments

Comments
 (0)
Please sign in to comment.