Tres en Raya
Basic
Actualizado el 11 de Octubre del 2024 por Adelino (27 códigos) (Publicado el 9 de Septiembre del 2024)
995 visualizaciones desde el 9 de Septiembre del 2024
Juego de tres raya para Gwbasic o Qbasic en pantalla de texto.
100 key off: width 40
120 cls: color 7,0
130 defint a-z
140 dim T$(9),C$(1),ply(9)
150 dim N(9,60,7),Y(9,9)
160 dim H(9,3),I(1,7)
170 dim A(9),C(9),D(9),G(9)
180 dim X(9),V(9),W(9)
190 dim B(1),K(15),Q(15)
200 A$="123456789147258369159357"
210 C$(0)="1-0": C$(1)="0-1"
220 B(0)=7: B(1)=4
230 c=1: ply(0)=9
240 for w=0 to 9
250 W(w)=w mod 2
260 V(w)=1-2*W(w)
270 X(w)=-1: G(w)=-1
280 next
300 for w=0 to 23
310 v=asc(mid$(A$,w+1))-48
320 G(v)=G(v)+1
330 H(v,G(v))=w\3
340 next
370 for w=0 to 8
380 v=9-w: ply(v)=v
390 y=20: x=7+6*(w mod 3): A$=chr$(97+w mod 3)
400 gosub 6000
410 T$(v)=A$
420 y=16-5*(w\3): x=2: A$=chr$(49+w\3)
430 gosub 6000
440 T$(v)=T$(v)+A$
450 next
460 for v=0 to 3
470 y=4+5*v: x=5: A$="----- ----- -----"
480 gosub 6000
490 next
500 y=3: x=25: A$="Blancas Rojas"
510 gosub 6000
520 y=4: A$="------- -------"
530 gosub 6000
540 for w=0 to 15
550 y=6+2*(w\4): x=25+4*(w mod 4)-w mod 2
560 A$=mid$("---",2-w mod 2)
570 gosub 6000
580 K(w)=y-1: Q(w)=x
590 next
690 rem **** Teclado ****
700 b=0: gosub 5000
710 z=(E$="M")-(E$="K")
720 c=c+z: if(c<1) then c=9
730 if(c>9) then c=1
740 if(D(c)) goto 720
750 b=B(t): gosub 5000
760 color 7,0
770 for w=0 to 15
780 y=K(w): x=Q(w): A$=mid$(" ",2-w mod 2)
790 gosub 6000
800 next
820 for w=0 to X(c)+1
830 v=c: if(w) then v=N(c,f-1,w-1)
840 y=K(2*w+2*t): x=Q(2*w+2*t): A$=T$(v)
850 gosub 6000
860 next
870 E$=" "+inkey$: if(E$=" ") goto 870
880 E$=right$(E$,1)
890 if(E$<>chr$(13)) goto 700
910 y=K(t): x=Q(1+2*t): A$=C$(t)
920 for w=0 to G(c)
930 v=I(t,H(c,w))
940 I(t,H(c,w))=v+1
960 if(v>1) then gosub 6000: end
970 next
1000 ply(0)=ply(0)-1
1010 if(ply(0)*X(c)=0) then end
1020 z=1: t=1-t
1030 C(0)=10: D(c)=1
1040 goto 720
4090 rem **** Figura ****
5000 a=c-1: color 0,b
5010 y=5+5*(a\3): x=18-6*(a mod 3): A$=" "
5020 gosub 6000: y=y+3: gosub 6000
5040 y=y-1: x=x-1: A$=" "
5050 gosub 6000: y=y-1
5090 rem **** Plasmar ****
6000 locate y,x: print A$
6010 return
Comentarios sobre la versión: 1.1 (0)
No hay comentarios