Triste

Juego de Tetris en modo texto de 40 x 25.
				-- PROGRAMADO POR:
--
-- Maxi: [email protected]
--
--
-- PAGINAS CONSUTADAS:
--
-- Tetris: The Story (Vadim Gerasimov):
-- http://vadim.www.media.mit.edu/Tetris.htm
--
-- Pete's Euphoria Zone:
-- http://www.eberlein.org/euphoria

without type_check
without warning

include image.e
include get.e
include sort.e


-- FICHAS.

constant
cfx = 3, -- Centro de la ficha: (3,2)
cfy = 2,
af = 4, -- Ancho y alto de las fichas.
hf = 4,
numero_fichas = 7

constant forma = { -- Formas de las fichas segun su orientacion.
{ -- ficha_i
{
{0,0,0,0},
{1,1,1,1},
{0,0,0,0},
{0,0,0,0}
},
{
{0,0,1,0},
{0,0,1,0},
{0,0,1,0},
{0,0,1,0}
},
{
{0,0,0,0},
{1,1,1,1},
{0,0,0,0},
{0,0,0,0}
},
{
{0,0,1,0},
{0,0,1,0},
{0,0,1,0},
{0,0,1,0}
}
},
{ -- ficha_j
{
{0,0,0,0},
{0,1,1,1},
{0,0,0,1},
{0,0,0,0}
},
{
{0,0,1,1},
{0,0,1,0},
{0,0,1,0},
{0,0,0,0}
},
{
{0,1,0,0},
{0,1,1,1},
{0,0,0,0},
{0,0,0,0}
},
{
{0,0,1,0},
{0,0,1,0},
{0,1,1,0},
{0,0,0,0}
}
},
{ -- ficha_l
{
{0,0,0,0},
{0,1,1,1},
{0,1,0,0},
{0,0,0,0}
},
{
{0,0,1,0},
{0,0,1,0},
{0,0,1,1},
{0,0,0,0}
},
{
{0,0,0,1},
{0,1,1,1},
{0,0,0,0},
{0,0,0,0}
},
{
{0,1,1,0},
{0,0,1,0},
{0,0,1,0},
{0,0,0,0}
}
},
{ -- ficha_o
{
{0,0,0,0},
{0,1,1,0},
{0,1,1,0},
{0,0,0,0}
},
{
{0,0,0,0},
{0,1,1,0},
{0,1,1,0},
{0,0,0,0}
},
{
{0,0,0,0},
{0,1,1,0},
{0,1,1,0},
{0,0,0,0}
},
{
{0,0,0,0},
{0,1,1,0},
{0,1,1,0},
{0,0,0,0}
}
},
{ -- ficha_s
{
{0,0,0,0},
{0,0,1,1},
{0,1,1,0},
{0,0,0,0}
},
{
{0,0,1,0},
{0,0,1,1},
{0,0,0,1},
{0,0,0,0}
},
{
{0,0,0,0},
{0,0,1,1},
{0,1,1,0},
{0,0,0,0}
},
{
{0,0,1,0},
{0,0,1,1},
{0,0,0,1},
{0,0,0,0}
}
},
{ -- ficha_t
{
{0,0,0,0},
{0,1,1,1},
{0,0,1,0},
{0,0,0,0}
},
{
{0,0,1,0},
{0,0,1,1},
{0,0,1,0},
{0,0,0,0}
},
{
{0,0,1,0},
{0,1,1,1},
{0,0,0,0},
{0,0,0,0}
},
{
{0,0,1,0},
{0,1,1,0},
{0,0,1,0},
{0,0,0,0}
}
},
{ -- ficha_z
{
{0,0,0,0},
{0,1,1,0},
{0,0,1,1},
{0,0,0,0}
},
{
{0,0,1,0},
{0,1,1,0},
{0,1,0,0},
{0,0,0,0}
},
{
{0,0,0,0},
{0,1,1,0},
{0,0,1,1},
{0,0,0,0}
},
{
{0,0,1,0},
{0,1,1,0},
{0,1,0,0},
{0,0,0,0}
}
}
}


-- TABLERO.

constant
otx = 2, -- Origen del Tablero.
oty = 2,
ht = 20, -- Alto y ancho del tablero.
at = 10

constant tablero_vacio = {
{1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1}
}

constant linea = repeat(1,at) -- Una linea completa.

constant
oi = 1, -- Orientacion inicial de las figuras en el tablero.
pix = 5, -- Posicion inicial de las figuras en el tablero (0,5).
piy = 0

-- SONIDO.

procedure sonido_apoyo() -- Sonido para cuando se apoya un ficha.
atom t
sound(200)
t = time()
while time() - t < .05 do
end while
sound(0)
end procedure

procedure sonido_linea(integer l) -- Sonido para cuando se produce una linea.
atom t
sound(200+l*100)
t = time()
while time() - t < .05 do
end while
sound(0)
end procedure

procedure sonido_fin() -- Sonido para cuando se termina el juego.
atom t
sound(250)
t = time()
while time() - t < .1 do
end while
sound(0)
end procedure


-- PANTALLA.

constant retraso_vertical = allocate(20) -- Movimientos suaves, sin parpadoes.
poke(retraso_vertical, {
#50, -- PUSH EAX
#52, -- PUSH EDX
#BA,#DA,3,0,0,-- MOV EDX, 0x03DA
#EC, -- 1: IN AL, DX
#A8,#08, -- TEST AL, 0x08
#75,#FB, -- JNZ 1:
#EC, -- 2: IN AL, DX
#A8,#08, -- TEST AL, 0x08
#74,#FB, -- JZ 2:
#5A, -- POP EDX
#58, -- POP EAX
#C3 } ) -- RET

constant
otpx = 16, -- Origen del tablero en pantalla.
otpy = 4,
color = {RED,WHITE,MAGENTA,BLUE,GREEN,BROWN,CYAN}, -- Colores fichas.
color_fondo = BLACK

constant
color_borde = BRIGHT_BLUE,
fondo_borde = BLACK

procedure pintar_tablero(sequence tab)
-- Pintar el Tablero tab.
text_color(color_borde) -- Pintar el borde.
bk_color(fondo_borde)
for i = 1 to ht+1 do
position(otpy+i-1,otpx-1)
puts(1,repeat('±',at+2))
end for
text_color(WHITE)
bk_color(BLACK)
for j = oty-1 to ht+oty-1 do -- Pintar el tablero.
for i = otx to at+otx-1 do
if tab[j][i] and j >= oty then
put_screen_char(j+otpy-oty,i+otpx-otx,{'Û',color[rand(numero_fichas)]})
else
put_screen_char(j+otpy-oty,i+otpx-otx,{'Û',color_fondo})
end if
end for
end for
end procedure

procedure borrar(integer fic,integer ori,integer x,integer y)
-- Borrar una ficha.
for j = 1 to hf do
for i = 1 to af do
if forma[fic][ori][j][i] then
put_screen_char(y+j+otpy-cfy,x+i+otpx-cfx,{'Û',color_fondo})
end if
end for
end for
end procedure

procedure pintar(integer fic,integer ori,integer x,integer y)
-- Pintar una ficha.
for j = 1 to hf do
for i = 1 to af do
if forma[fic][ori][j][i] then
put_screen_char(y+j+otpy-cfy,x+i+otpx-cfx,{'Û',color[fic]})
end if
end for
end for
end procedure

procedure bajar_lineas(integer l)
-- Borrar una linea.
display_text_image({otpy,otpx},save_text_image({otpy-1,otpx},{l+otpy-2,otpx+at-1}))
end procedure

constant
xpro = 19, -- Coordenadas en pantalla para la vista previa (esq. sup. izq.).
ypro = 0

procedure pintar_proxima(integer fic, integer prever)
-- Vista Previa.
if prever then
pintar(fic,1,xpro-otpx-1+cfx,ypro-otpy+cfy-1)
else
borrar(fic,1,xpro-otpx+cfx-1,ypro-otpy+cfy-1)
end if
end procedure

procedure mensaje_proxima()
position(ypro+1,xpro-11)
puts(1,"PROXIMA:")
end procedure

constant
xn = 1, -- Cooerdenadas de pantalla para el Nivel.
yn = 4,
color_nivel = BRIGHT_WHITE, -- Color en que se muestra el Nivel.
fondo_nivel = BLACK

procedure escribir_nivel(integer nivel)
text_color(color_nivel)
bk_color(fondo_nivel)
position(yn,xn)
printf(1,"%7d",{nivel})
text_color(WHITE)
bk_color(BLACK)
end procedure

procedure mensaje_nivel()
position(yn-1,xn)
puts(1,"NIVEL")
end procedure

constant
xl = 1, -- Cooerdenadas de pantalla para el numero de Lineas.
yl = 7,
color_lineas = BRIGHT_CYAN, -- Color en que se muestra el numero de Lineas.
fondo_lineas = BLACK

procedure escribir_lineas(integer lineas)
text_color(color_lineas)
bk_color(fondo_lineas)
position(yl,xl)
printf(1,"%7d",{lineas})
text_color(WHITE)
bk_color(BLACK)
end procedure

procedure mensaje_lineas()
position(yl-1,xl)
puts(1,"LINEAS")
end procedure

constant
xp = 1, -- Cooerdenadas de pantalla para el Puntaje.
yp = 10,
color_puntaje = YELLOW, -- Color en que se muestra el puntaje.
fondo_puntaje = BLACK

procedure escribir_puntaje(integer puntaje)
text_color(color_puntaje)
bk_color(fondo_puntaje)
position(yp,xp)
printf(1,"%7d",{puntaje})
text_color(WHITE)
bk_color(BLACK)
end procedure

procedure mensaje_puntaje()
position(yp-1,xp)
puts(1,"PUNTAJE")
end procedure

constant
xt = 1, -- Cooerdenadas en pantalla para el mensaje de teclas.
yt = 13

procedure mensaje_teclas()
put_screen_char(yt,xt,{24,WHITE})
put_screen_char(yt+1,xt,{25,WHITE})
put_screen_char(yt+2,xt,{26,WHITE})
put_screen_char(yt+3,xt,{27,WHITE})
position(yt,xt+2)
puts(1,"Rotar")
position(yt+1,xt+2)
puts(1,"Soltar")
position(yt+2,xt+2)
puts(1,"Derecha")
position(yt+3,xt +2)
puts(1,"Izquierda")
position(yt+4,xt)
puts(1,"Esp Proxima")
position(yt+5,xt)
puts(1,"Esc Pausa")
end procedure

constant
xmt = 5, -- Coordenadas en pantalla par el mensaje Triste.
ymt = 21

procedure mensaje_triste()
put_screen_char(ymt,xmt,{'T',1,'r',2,'i',3,'s',4,'t',5,'e',6})
put_screen_char(ymt+1,xmt,{'T',9,'r',10,'i',11,'s',12,'t',13,'e',14})
end procedure

constant
xest = 28,
yest = {21,3,6,9,12,15,18} -- Cooerdenadas en pantalla para estadisticas.

integer total -- Numero total de fichas.
sequence porcentaje -- Numero de cada una de las fichas.

procedure estadisticas(integer f)
-- Actualizar y mostrar estadisticas en base a la nueva ficha f.
total += 1
porcentaje[f] += 1
for i = 1 to numero_fichas do
text_color(color[i])
position(yest[i]+1,xest+5)
printf(1,"%6.2f%%",{porcentaje[i]/total*100})
end for
text_color(WHITE)
position(yest[1]+3,xest+5)
printf(1,"%6d",{total})
end procedure

procedure iniciar_estadisticas()
position(yest[1]+3,xest)
puts(1,"Total:")
text_color(WHITE)
position(2,xest)
puts(1,"ESTADISTICAS")
for i = 1 to numero_fichas do
pintar(i,1,xest-otpx+cfx-1,yest[i]-otpy+cfy-1)
end for
porcentaje = {0,0,0,0,0,0,0}
total = 0
end procedure

constant
color_fin = YELLOW, -- Colores para el mensaje FIN.
fondo_fin = WHITE

procedure mensaje_fin()
text_color(color_fin)
bk_color(fondo_fin)
position(otpy+ht/2-1,otpx-1)
puts(1," ")
position(otpy+ht/2,otpx-1)
puts(1," F I N ")
position(otpy+ht/2+1,otpx-1)
puts(1," ")
text_color(WHITE)
bk_color(BLACK)
end procedure

-- JUEGO.

procedure pausa_juego()
-- Espera con el juego detenido.
sequence pantalla
pantalla = save_text_image({1,1},{25,40})
clear_screen()
text_color(BRIGHT_WHITE)
puts(1,"nnn PAUSA...")
text_color(WHITE)
puts(1," Esc: Continuar.")
while wait_key() != 27 do
end while
display_text_image({1,1},pantalla)
end procedure

function nuevo_tablero(integer altura)
-- Retorna un nuevo tablero, con una determinada altura de lineas iniciales
-- aleatorias.
sequence tab
tab = tablero_vacio
for j = ht-altura+oty to ht+oty-1 do
while 1 do
for i = otx to at+otx-1 do
tab[j][i] = rand(numero_fichas+1)-1 > 0
end for
if not equal(tab[j][otx..at+otx-1],linea) then
exit
end if
end while
end for
return tab
end function

function posible(integer fic,integer ori,integer x,integer y,sequence tab)
-- Retorna si es posible poner la ficha fic con orientacion ori en las
-- coordenadas (x,y) del tablero tab.
for j = 1 to hf do

-- for i = 1 to af do -- ERROR: Ficha I fuera del tablero.
-- Gracias a "Archie Ritter" por notarlo y mandarme una traza.
-- (Thanks to "Archie Ritter" for note it and send me a trace.)

for i = af to 1 by -1 do -- CORRECCION.
if forma[fic][ori][j][i] and tab[y+oty+j-cfy][x+otx+i-cfx] then
return 0
end if
end for
end for
return 1
end function

function fijar(integer fic,integer ori,integer x,integer y,sequence tab)
-- Fija la ficha fic con orientacion ori en las coordenadas (x,y) del tablero
-- tab.
for j = 1 to hf do
for i = 1 to af do
if forma[fic][ori][j][i] then
tab[y+oty+j-cfy][x+otx+i-cfx] = 1
end if
end for
end for
return tab
end function

function linea_completa(integer l,sequence tab)
-- Retorna si hay una linea completa a la altura i del tablero.
return equal(tab[l+oty-1][otx..otx+at-1],linea)
end function

-- figura es un sequence: {ficha,orientacion,x,y}

function izquierda(sequence figura)
-- Retorna la figura resultante de mover figura un posicion a la izquierda.
figura[3] -= 1
return figura
end function

function derecha(sequence figura)
-- Retorna la figura resultante de mover figura una posicion a la derecha.
figura[3] += 1
return figura
end function

function rotar(sequence figura)
-- Retorna la figura resultante de rotar figura 90 grados en sentido anti-
-- horario.
figura[2] = remainder(figura[2],4) + 1
return figura
end function

function bajar(sequence figura)
-- Retorna la figura resultante de mover figura una posicion hacia abajo.
figura[4] += 1
return figura
end function

function borrar_linea(integer l,sequence tab)
tab[oty+1..l+oty-1] = tab[oty..l+oty-2]
return tab
end function

constant
tecla_izq = 331, -- Flechas.
tecla_der = 333,
tecla_rot = 328,
tecla_sol = 336,
tecla_pre = ' ',
tecla_pau = 27 -- Escape.

constant tiempo = {.55,.5,.45,.4,.35,.3,.25,.2,.15,.1} -- Para movimientos.

constant extra = {2,4,8,16} -- Puntos extra por lineas completas.

function juego(integer nivel,integer altura,integer prever)
-- Mi algoritmo para el Tetris.
sequence tab -- Tablero.

integer prox -- Fichas y figuras.
sequence fig
sequence fig1

atom t -- Tiempo.
atom t_mover

integer tecla -- Lectura del teclado.

integer puntaje -- Manejo del puntaje.
integer lineas
integer caida
integer apoyo
integer giros

t_mover = tiempo[nivel+1] -- Inicializacion.
puntaje = 0
lineas = 0
clear_screen()
mensaje_nivel()
mensaje_lineas()
mensaje_puntaje()
mensaje_teclas()
mensaje_proxima()
mensaje_triste()
escribir_nivel(nivel)
escribir_lineas(lineas)
escribir_puntaje(puntaje)
iniciar_estadisticas()
tab = nuevo_tablero(altura)
prox = rand(numero_fichas)
pintar_tablero(tab)
pintar_proxima(prox,prever)
t = time()

while 1 do
fig = {prox,oi,pix,piy}
if not posible(fig[1],fig[2],fig[3],fig[4],tab) then
exit
end if
prox = rand(numero_fichas)
call(retraso_vertical)
pintar_proxima(fig[1],0)
pintar(fig[1],fig[2],fig[3],fig[4])
pintar_proxima(prox,prever)
estadisticas(fig[1])
caida = 0
giros = 0
for i = 1 to 10 do -- Limpiar buffer del teclado.
tecla = get_key()
end for
while 1 do
tecla = get_key()
if tecla = tecla_izq then
-- Mover a izquierda.
fig1 = izquierda(fig)
if posible(fig1[1],fig1[2],fig1[3],fig1[4],tab) then
call(retraso_vertical)
borrar(fig[1],fig[2],fig[3],fig[4])
pintar(fig1[1],fig1[2],fig1[3],fig1[4])
fig = fig1
end if
elsif tecla = tecla_der then
-- Mover a derecha.
fig1 = derecha(fig)
if posible(fig1[1],fig1[2],fig1[3],fig1[4],tab) then
call(retraso_vertical)
borrar(fig[1],fig[2],fig[3],fig[4])
pintar(fig1[1],fig1[2],fig1[3],fig1[4])
fig = fig1
end if
elsif tecla = tecla_rot then
-- Rotar.
fig1 = rotar(fig)
if posible(fig1[1],fig1[2],fig1[3],fig1[4],tab) then
call(retraso_vertical)
borrar(fig[1],fig[2],fig[3],fig[4])
pintar(fig1[1],fig1[2],fig1[3],fig1[4])
fig = fig1
giros += 1
end if
elsif tecla = tecla_sol then
-- Soltar.
fig1 = bajar(fig)
caida = ht - fig[4]
while posible(fig1[1],fig1[2],fig1[3],fig1[4],tab) do
call(retraso_vertical)
borrar(fig[1],fig[2],fig[3],fig[4])
pintar(fig1[1],fig1[2],fig1[3],fig1[4])
fig = fig1
fig1 = bajar(fig)
end while
apoyo = ht - fig[4]
caida = caida - apoyo
exit
elsif tecla = tecla_pre then
-- Vista Previa (si/no)
prever = not prever
pintar_proxima(prox,prever)
elsif tecla = tecla_pau then
-- Pausa.
pausa_juego()
end if
if time() - t > t_mover then
fig1 = bajar(fig)
if posible(fig1[1],fig1[2],fig1[3],fig1[4],tab) then
-- Bajar.
call(retraso_vertical)
borrar(fig[1],fig[2],fig[3],fig[4])
pintar(fig1[1],fig1[2],fig1[3],fig1[4])
fig = fig1
t = time()
else
apoyo = ht - fig[4] - 1
exit
end if
end if
end while
tab = fijar(fig[1],fig[2],fig[3],fig[4],tab)
sonido_apoyo()
puntaje += (1-prever) * 4 + caida + apoyo + 3 * nivel + floor(altura/3)
- prever * floor(giros/2) - (1-prever) * floor(giros/4)
escribir_puntaje(puntaje)
for i = 1 to 4 do
for j = 1 to ht do
if linea_completa(j,tab) then
tab = borrar_linea(j,tab)
lineas += 1
sonido_linea(i)
escribir_lineas(lineas)
puntaje += extra[i]
escribir_puntaje(puntaje)
call(retraso_vertical)
bajar_lineas(j)
if remainder(lineas,10) = 1 and lineas > 10*(nivel+1) then
nivel += 1
escribir_nivel(nivel)
if nivel < 9 then
t_mover = tiempo[nivel+1]
end if
end if
exit
end if
end for
end for
end while
sonido_fin()
mensaje_fin()
t = time()
while time() - t < .5 do
end while
return {puntaje,lineas,nivel}
end function


-- PROGRAMA.

constant numero_registros = 7
constant registro_vacio = repeat({0,0,0,"---"},numero_registros)
constant op_iniciales = {0,0,0}
sequence registro
sequence op
sequence resultado
integer c
integer archivo
sequence x
integer salir

archivo = open("triste.za","r") -- Recuperar datos guardados.
if archivo = -1 then
op = op_iniciales
registro = registro_vacio
else
x = get(archivo)
if x[1] = GET_SUCCESS then
op = x[2]
else
op = op_iniciales
end if
x = get(archivo)
if x[1] = GET_SUCCESS then
registro = x[2]
else
registro = registro_vacio
end if
close(archivo)
end if

if graphics_mode(1) then
puts(1,"nNo se puede cambiar el modo grafico.n")
c = wait_key()
end if

tick_rate(100)

while 1 do
cursor(NO_CURSOR)
clear_screen()
puts(1,"n")
puts(1," ÛÛÛ ÛÛ Û ÛÛÛ ÛÛÛ ÛÛÛn")
puts(1," Û Û Û Û ÛÛ Û Û n")
puts(1," Û ÛÛ Û ÛÛ Û ÛÛ n")
puts(1," Û Û Û Û ÛÛÛ Û ÛÛÛn")
puts(1,"nn")
puts(1," Puntaje Lineas Nivel Nombren")
puts(1,"n")
for i = numero_registros to 1 by -1 do
text_color(color[remainder(i,numero_fichas)+1])
printf(1," %7d %6d %5d %sn",registro[i])
end for
puts(1,"nnn")
text_color(BRIGHT_WHITE)
puts(1,"1-Nivel:n")
puts(1,"2-Altura:n")
puts(1,"3-Proxima:n")
puts(1,"Esp-Jugar.n")
puts(1,"Esc-Salir.n")
text_color(WHITE)
salir = 0
while 1 do
position(20,11)
printf(1,"%2d",op[1..1])
position(21,11)
printf(1,"%2d",op[2])
position(22,11)
if op[3] then
printf(1,"%s",{"Si"})
else
printf(1,"%s",{"No"})
end if
c = get_key()
if c = '1' then
op[1] = remainder(op[1]+1,10)
elsif c = '2' then
op[2] = remainder(op[2]+1,15)
elsif c = '3' then
op[3] = not op[3]
elsif c = ' ' then
exit
elsif c = 27 then
salir = 1
exit
end if
if rand(250) = 1 then
text_color(rand(15))
call(retraso_vertical)
position(1,1)
puts(1,"n")
puts(1," ÛÛÛ ÛÛ Û ÛÛÛ ÛÛÛ ÛÛÛn")
puts(1," Û Û Û Û ÛÛ Û Û n")
puts(1," Û ÛÛ Û ÛÛ Û ÛÛ n")
puts(1," Û Û Û Û ÛÛÛ Û ÛÛÛn")
puts(1,"nn")
text_color(WHITE)
end if
end while
if salir then
exit
end if
while 1 do
resultado = juego(op[1],op[2],op[3])
put_screen_char(25,1,{24,BRIGHT_WHITE})
position(25,2)
text_color(YELLOW)
puts(1," Jugar de nuevo.")
text_color(WHITE)
for i = 1 to 10 do
c = get_key()
end for
if wait_key() != tecla_rot then
exit
end if
end while
if resultado[1] > registro[1][1] then
registro[1][1..3] = resultado
clear_screen()
puts(1,"nnn ")
text_color(BRIGHT_WHITE)
cursor(THICK_UNDERLINE_CURSOR)
registro[1][4] = prompt_string("Escriba su nombre: ")
text_color(WHITE)
if length(registro[1][4]) > 10 then
registro[1][4] = registro[1][4][1..10]
end if
registro = sort(registro)
end if
end while

if graphics_mode(-1) then
puts(1,"nNo se puede restaurar el modo grafico.n")
c = wait_key()
end if

archivo = open("triste.za","w") -- Guardar datos.
if archivo != -1 then
print(archivo,op)
puts(archivo," ")
print(archivo,registro)
close(archivo)
end if

puts(1,"nProgramado por Maxi: [email protected]")
puts(1,"Basado en el juego encontrado en la pagina:n")
puts(1,"http://vadim.www.media.mit.edu/Tetris.htmnn")
puts(1,"Utilizando la rutina de retraso_vertical encontrada en la pagina:n")
puts(1,"http://www.eberlein.org/euphoriann")
Descargar adjuntos
COMPARTE ESTE TUTORIAL

COMPARTIR EN FACEBOOK
COMPARTIR EN TWITTER
COMPARTIR EN LINKEDIN
COMPARTIR EN WHATSAPP
TUTORIAL ANTERIOR

SIGUIENTE TUTORIAL