-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2048.scm
87 lines (67 loc) · 2.74 KB
/
2048.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
(load "modos.scm")
(define (main)
(clear)
(newline)
(display "=====================================================================================")(newline)
(display "::: Bienvenido al Juego 2048 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::")(newline)
(display "=====================================================================================")(newline)
(display " ")(newline)
(display " Integrantes: ")(newline)
(display " - Kevin Lorenzo ")(newline)
(display " ")(newline)
(display "=====================================================================================")(newline)
(newline)
(define base 0)
(define filas 0)
(define columnas 0)
(do ((ciclo 0 (+ ciclo 0)))
((and (exact-integer? base) (>= base 2) (<= base 9)) ())
(display "Por favor, elija la base con la que se jugará ( Número entre 2 y 9 ): ")
(set! base (string->number (read-line)))
)
(display "\nDimensiones del Tablero:")(newline)(newline)
(do ((ciclo 0 (+ ciclo 0)))
((and (exact-integer? filas) (>= filas 2)) ())
(display " - Filas ( Mayor o Igual a 2 ): ")
(set! filas (string->number (read-line)))
)
(do ((ciclo 0 (+ ciclo 0)))
((and (exact-integer? columnas) (>= columnas 2)) ())
(display " - Columnas ( Mayor o Igual a 2 ): ")
(set! columnas (string->number (read-line)))
)
(newline)
(display "----------------------------------------")(newline)
(display "::: Menú Principal :::::::::::::::::::::")(newline)
(display "----------------------------------------")(newline)
(display ": 1).- Modo Jugador :")(newline)
(display ": 2).- Modo Máquina :")(newline)
(display ": 3).- Salir :")(newline)
(display "----------------------------------------")(newline)
(newline)
(define matriz (crearMatriz filas columnas))
(define (menuPrincipal)
(display "Elija una opción del Menú Principal: ")
(define opcion (string->number (read-line)))
(cond
((and (number? opcion) (= opcion 1))
(generarValoresIniciales base matriz)
(mostrarJuego MODO_JUGADOR base matriz 0 "")
)
((and (number? opcion) (= opcion 2))
(generarValoresIniciales base matriz)
(mostrarJuego MODO_MAQUINA base matriz 0 "")
)
((and (number? opcion) (= opcion 3))
(display "\nSaliendo...")
(display "\nGracias por jugar nuestro juego.\n")
)
(else
(display "¡OPCIÓN NO VÁLIDA! ")
(menuPrincipal)
)
)
)(menuPrincipal)
(newline)
(newline)
)(main)