zxmines 77_7*49999O :480 :Comments at EOF 8*** Blanquear los cuadros de alrededor de uno dado *** 8X=CX :Y=CY :X<1 Y<1 X>ANCHO Y>ALTO X=1 8 $V(X-1,Y)=0 V(X-1,Y)=1 :(59000x+PD), X-1 :(59300+PD), Y :PD=PD+1 :T(X-1,Y)=0 CX=X-1 :CY=Y :(59500l+PP),X :(597004+PP),Y :PP=PP+1 :3 :PP=PP-1 :X=(59500l+PP) :Y=(597004+PP) XY>1 V(X-1,Y-1)=0 V(X-1,Y-1)=1 :(59000x+PD), X-1 :(59300+PD), Y-1 :PD=PD+1 :T(X-1,Y-1)=0 CX=X-1 :CY=Y-1 :(59500l+PP),X :(597004+PP),Y :PP=PP+1 :3 :PP=PP-1 :X=(59500l+PP) :Y=(597004+PP) UY1 V(X+1,Y-1)=0 V(X+1,Y-1)=1 :(59000x+PD), X+1 :(59300+PD), Y-1 :PD=PD+1 :T(X+1,Y-1)=0 CX=X+1 :CY=Y-1 :(59500l+PP),X :(597004+PP),Y :PP=PP+1 :3 :PP=PP-1 :X=(59500l+PP) :Y=(597004+PP) -Y1 V(X,Y-1)=0 V(X,Y-1)=1 :(59000x+PD), X :(59300+PD), Y-1 :PD=PD+1 :T(X,Y-1)=0 CX=X :CY=Y-1 :(59500l+PP),X :(597004+PP),Y :PP=PP+1 :3 :PP=PP-1 :X=(59500l+PP) :Y=(597004+PP)  0 "Spanish/English? (s/e)", L$ ; 1'L$"s"L$"S"L$"e"L$"E"480 23*** Declaracion de las variables del programa *** 3COL=6 :PAP=1 5 COL:PAP 6L$="E"L$="e" 7L$="S"L$="s" <'T(12 ,12 ) :Campo de minas A/V(12 ,12 ) :Visto o no visto (0/1) FBUCLE=1 P.IX=1 :IY=1 :IX, IY del tablero UDIFICULTAD=0 Z%8000@ :DEFINIMOS LOS GRAFICOS d0 ::103g : e/C$(10 ) :N=1 10 :C$(N) :N f-H(10 ) :N=1 10 :H(N) :N g)"","1","2","3","4","5","6","7","8","" hZ0, 1, 3, 2, 2, 2, 2, 2, 2, 0 i2300 :Dibujar pantalla n2400` :Dibujar tablero o DIFICULTAD0 116t pzL$="e"4, 18 ; "1. New Easy"; :5, 18 ; "2. New Normal"; :6, 18 ; "3. New Hard" qzL$="s"4, 18 ; "1. Facil "; :5, 18 ; "2. Medio "; :6, 18 ; "3. Dificil " t DIFICULTAD=0 119w u.L$="e"7, 18 ; "4. End game"; v/L$="s"7, 18 ; "4. Fin juego"; x2000 :Generar tablero DIFICULTAD=0 400 7CX=ANCHO/2 :CY=ALTO/2 :PUNTOS = 0 *** BUCLE PRINCIPAL *** ,[P$= (16) + (0) + (17) + (7) :X=1 ANCHO :P$=P$+"":X 6Y=1 ALTO ;IY+Y,IX+1 ; P$; rY Bucle principal de partida  DIFICULTAD=0 415 MINAS=QUEDAN 1600@ S1:IY+CY, IX+CX ; 1; 0 ; 7;" "; :0 :991 K$=:K$=""415 eK$="1"DIFICULTAD=1 :.0015wD,35# :2400` :1460 :996 :111o eK$="2"DIFICULTAD=2 :.0015wD,35# :2400` :1460 :996 :111o eK$="3"DIFICULTAD=3 :.0015wD,35# :2400` :1460 :996 :111o  DIFICULTAD=0 990 TK$="4"DIFICULTAD0 DIFICULTAD=0 :.0015wD,35# :1300 `K$="o"K$="O"K$="6"DIFICULTAD0 CX>1 1500 :CX=CX-1 :500 ^K$="p"K$="P"K$="7"DIFICULTAD0 CX1 1500 :CY=CY-1 :500 ]K$="a"K$="A"K$="8"DIFICULTAD0 CY GAME OVER <--"; "<L$="e"20,11 ; 7; "Score: "; PUNTOS ; #=L$="s"20,11 ; 7; "Puntos: "; PUNTOS ; $DIFICULTAD=0 % 1400x &L$="e"7:4, 18 ; " PRESS "; :5, 18 ; " ANY "; :6, 18 ; " KEY "; :7, 18 ; " "; :COL 'L$="s"7:4, 18 ; " PULSA "; :5, 18 ; " UNA "; :6, 18 ; " TECLA "; :7, 18 ; " "; :COL -=""1325- .W19,7 ; " "; :20,11 ; " "; /zL$="e"4, 18 ; "1. New Easy"; :5, 18 ; "2. New Normal"; :6, 18 ; "3. New Hard" 0zL$="s"4, 18 ; "1. Facil "; :5, 18 ; "2. Medio "; :6, 18 ; "3. Dificil " 11460 :996 2 400 x*** Mostrar tablero *** Y=1 ALTO P$= (16) + (0) + (17) + (7) :X=1 ANCHO :P$=P$+C$(T(X,Y)+1) :X :IY+Y,IX+1 ; P$; Y  *** Borrar tablero *** N=1 12 -IY+N,IX ; COL; PAP ; " "; N  **** Restaurar grafico bajo el cursor *** fV(CX,CY)=1 CY+IY,CX+IX ; 0; 7; H(T(CX,CY)+1) ;C$(T(CX,CY)+1); : 3CY+IY,CX+IX; 0; 0 ; 7; "";  @*** Victoria *** J;L$="e"19,7 ; 7; "--> YOU WIN! <--"; K;L$="s"19,7 ; 7; "--> GANASTE! <--"; N<L$="e"20,11 ; 7; "Score: "; PUNTOS ; O=L$="s"20,11 ; 7; "Puntos: "; PUNTOS ; PDIFICULTAD=0 Q`N=1 502:6:2:.002xn,40(+(N/10 ):6 :N :0 R 1400x SL$="e"7:4, 18 ; " PRESS "; :5, 18 ; " ANY "; :6, 18 ; " KEY "; :7, 18 ; " "; :COL TL$="s"7:4, 18 ; " PULSA "; :5, 18 ; " UNA "; :6, 18 ; " TECLA "; :7, 18 ; " "; :COL Y=""1625Y ZV19,7 ; " "; :20,11 ; " "; [zL$="e"4, 18 ; "1. New Easy"; :5, 18 ; "2. New Normal"; :6, 18 ; "3. New Hard" \zL$="s"4, 18 ; "1. Facil "; :5, 18 ; "2. Medio "; :6, 18 ; "3. Dificil " ]1460 :996 ^ 400 *** GENERACION DE TABLERO *** DIFICULTAD=0 _L$="e"19,1 ; "Generating board..."; 20,1 ; "> Placing mines: 0%"; _L$="s"19,1 ; "Generando tablero.."; 20,1 ; "> Insert. minas: 0%"; 5INCR=100d/MINAS :PORCEN=0 :CON=1 (Primero ponemos a cero todo el tablero -T(12 ,12 ) :V(12 ,12 ) RX = (*(ANCHO))+1 RY = (*(ALTO))+1 NAhora instalamos las minas. Si encontramos un hueco, pasamos a por otra mina N=1 MINAS  V(RX,RY)=1 2070 <V(RX,RY)=1 :(59000x+N),RX :(59300+N),RY ^CON=CON+1 :CON=5+DIFICULTAD 20,18 ; PORCEN ; "%"; :CON=1 PORCEN=PORCEN+INCR :N /Si no, generamos otro numeros y dec el indice RX = (*(ANCHO))+1  RY = (*(ALTO))+1 *N = N-1 4N 56L$="e"20,1 ; "> Preparing board: 0%"; 66L$="s"20,1 ; "> Gener. tablero: 0%"; =PORCEN=0 :CON=0 >N=1 MINAS ?^CON=CON+1 :CON=5+DIFICULTAD 20,20 ; PORCEN ; "%"; :CON=1 @PORCEN=PORCEN+INCR H)X=(59000x+N) :Y=(59300+N) SX=1 2138Z T+T(X-1,Y) = T(X-1,Y) + 1 UCY>1 T(X-1,Y-1)=T(X-1,Y-1)+1 V@Y1 T(X+1,Y-1)=T(X+1,Y-1)+1 a0Y1 T(X,Y-1)=T(X,Y-1)+1 pN q20,20 ; "100%"; uAhora plantamos las minas zIN=1 MINAS :T( (59000x+N), (59300+N)) = 9 :N V(12 ,12 ) 919,1 ; COL; PAP; " "; =20,1 ; COL; PAP; " ";  *** Preparar pantalla ***  g0,0 :255, 0 :0, 174 :-255, 0 :0, -174 (0, 30 :255, 0 8L$="e"2,18 ; PAP; COL; "Minesweeper"; 7L$="s"2,18 ; PAP; COL; "Buscaminas"; A#9 , 18 ; "KEYS/Joy:"; E!10 , 18; "O,P=<,>"; F!11 , 18; "Q,A=^,v"; G12 , 18; "SPACE"; L 4,3 ; "(c) 2003"; N$5,2 ; "NoP/Compiler"; P"6,3 ; "speccy.org"; V `*** Preparar tablero *** bDIFICULTAD=0 cCDIFICULTAD=1 ANCHO=8 :ALTO=8 :MINAS=8 dFDIFICULTAD=2 ANCHO=10 :ALTO=10 :MINAS=12 eFDIFICULTAD=3 ANCHO=12 :ALTO=12 :MINAS=25 jQUEDAN=ANCHO*ALTO  @*** Preparacion de GDUs *** E 90124# J-I=0 7:FILA :"I"+I, FILA :I O-I=0 7:FILA :"M"+I, FILA :I T-I=0 7:FILA :"E"+I, FILA :I #' #(*** Definicion de GDUs *** #2Grafico 0 (tablero) (I) #4M0, 1, 0, 17, 16, 1, 0, 170 #7Grafico 1 (mina) (M) #9T16, 186, 116t, 254, 124|, 186, 16, 0 #<Grafico 2 (esquina) (E) #>J1, 1, 1, 1, 1, 1, 1, 255 #F******************************************************************** #%ZXMines by Santiago Romero (c) 2003 #FThis program is free software; you can redistribute it and/or modify #Fit under the terms of the GNU General Public License as published by #Cthe Free Software Foundation; either version 2 of the License, or #%(at your option) any later version. #AThis program is distributed in the hope that it will be useful, #@but WITHOUT ANY WARRANTY; without even the implied warranty of #?MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #.GNU General Public License for more details. #CYou should have received a copy of the GNU General Public License #=along with this program; if not, write to the Free Software #;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #F******************************************************************** # #4- Feel free to improve the mine placing algorithm #>and my recursive version of the "open empty cells" function. #<They could be rewritten much times faster using ASM, but I #3must stick to the competition rules (only BASIC). #G- I also avoided the FLAG stuff... I hate flags in minesweepers... :P # #Version 1.03