MOFIAR (Sinclair ZX Spectrum) by Avlixa
A downloadable game
*** MOFIAR ***
A ZX Spectrum game for the 2024 BASIC 10Liner contest from Homeputerium
https://gkanold.wixsite.com/homeputerium
Antonio Silva – Avlixa
EXTREME-256
*** Introduction ***
MOFIAR (My Own Four In A Row, or Connect 4) is my 10-line BASIC implementation of Connect 4 board game whose objective is to line up 4 pieces before your opponent on a 7x6 board either horizontally, vertically or diagonally.
A game for ZX Spectrum 16/48K.
*** Game description ***
In this game you play against the ZX Spectrum. The first player to line up 4 checkers wins the game. Each player throws his checker alternately, you can choose any of the 7 columns of the board by pressing the key 1 to 7 corresponding to that column. The piece falls to the lowest available row in that column.
Be patient, the ZX Spectrum computer is almost the same age as you, and it takes its time to choose the best option, wait your turn to throw your piece.
The game displays messages in Spanish, depending on the message you will have the following options:
• “Pulsa una tecla” – Press any key to continue.
• “Su turno” – It's the player's turn, choose column with keys 1 to 7 to drop the tile.
• “ZX Juega” – It's ZX Spectrum's turn. Wait while he thinks about his move.
• “Espere” – Wait while the ZX Spectrum checks the board for 4 in a row.
• “Jugador gana” – Player has won the game, press a key for a new game
• “ZX gana” – Computer has won the game, press a key for a new game
10 DIM h(12,13): DIM r(3,13): DIM f$(3,8): DEF FN c(x,y,w,z)=h(y,x)+h(y+z,x+w)+h(y+2*z,x+2*w)+h(y+3*z,x+3*w): LET t=0: GO TO 100: DATA 1+INT (RND*2),-1,1,0,0,0,0," MOFIAR - Conecta 4"," 1234567"," ---------","Su turno","ZX juega","Espere" 20 RESTORE 60: READ s,a,g,l,m,o,p: FOR i=(20*(g+(k=3))+j-3) TO j: PRINT ".";: RESTORE 30: READ o,p,b,u,d,g,g,g,l,m,i: LET a=(ABS s>ABS b)+(s<b)*(ABS s=ABS b): LET s=s*a+b*NOT a: LET a=(ABS s>ABS u)+(s<u)*(ABS s=ABS u): LET s=s*a+u*NOT a: LET a=(ABS s>ABS d)+(s<d)*(ABS s=ABS d): LET s=s*a+d*NOT a: NEXT i: RETURN 30 FOR n=4 TO 10: LET j=n: LET k=r(1,j): LET r(2,j)=0: IF k>3 THEN GO SUB 20: LET r(2,j)=s: LET k=k-1: LET r(3,j)=0: IF k>3 THEN GO SUB 20: LET r(3,j)=s: DATA o+1,p-1,FN c(i,k,1,0),FN c(i,o,1,1),FN c(i,p,1,-1),2*(ABS b=4),g+(g=0)*3*(ABS u=4),g+(g=0)*4*(ABS d=4),(i-1)*(g>0),k*(g=2)+o*(g=3)+p*(g=4)-1,i+g*j 40 NEXT n: LET c=4: LET e=r(2,c): FOR q=5 TO 10: LET f=r(2,q): LET l=(ABS f>=ABS e)*((r(3,q)<>3)*(INT (RND*2)) OR (ABS f=3)): LET l=l-l*(f=3)*(e=-3): LET c=q*l+c*NOT l: LET e=f*l+e*NOT l: NEXT q: RETURN 50 PRINT AT 18,0;f$(3);AT 19,0,,,,;AT 19,0;: LET k=r(1,j): LET r(1,j)=k-1: LET h(k,j)=w: LET l=j: GO SUB 90: LET j=l: GO SUB 20: FOR i=1 TO 4: PRINT INK 8;AT m,l; OVER 1; INVERSE (g>0);" ": LET l=l+(g>1): LET m=m+(g<>2)-2*(g=4): NEXT i: RETURN 60 LET w=-1+2*(t=1): GO SUB 50: LET t=1+(t=1): PRINT AT 18,0; FLASH (t=1);f$(t): GO TO 70+10*(t=1)+20*(g>0)+10*(g>0)*(t=2): DATA FN c(j,k,0,1),ABS s,(a=4),j-1,k-1,k-4,k+4 70 LET e=0: GO SUB 30: FOR i=0 TO 1: LET j=(e=0)*(4+INT (RND*7))+(e<>0)*c: LET i=i-(h(4,j)<>0): NEXT i: GO TO 60 80 FOR i=-1 TO 0 STEP 0: LET i$=INKEY$: LET i=i+(i$>"0" AND i$<"8"): NEXT i: LET j=3+VAL i$: GO TO 60+20*(h(4,j)<>0) 90 PRINT AT 0,0;b$,,,c$: FOR i=4 TO 9: PRINT AT i-1,2;"|";: FOR j=4 TO 10: PRINT INK 2+4*(h(i,j)=1);"\* \*"(2+h(i,j));: NEXT j: PRINT "|": NEXT i: PRINT d$;AT 19,0;: RETURN 100 PAUSE 1: PRINT FLASH 1;AT 18,0;"ZX Gana" AND (t=1);"Jugador Gana" AND (t=2);" Pulsa una tecla ": PAUSE 0: PAPER 5: BORDER 5: CLS : RESTORE : READ t,w,v,k,g,l,m,b$,c$,d$,f$(1),f$(2),f$(3): FOR i=4 TO 10: FOR j=4 TO 10: LET h(i,j)=0: LET r(v,j)=9*(v=1): NEXT j: LET v=v+(v<3): NEXT i: GO SUB 90: PRINT AT 18,0; FLASH (t=1);f$(t): GO TO 70+10*(t=1)
Status | Released |
Rating | Rated 5.0 out of 5 stars (1 total ratings) |
Author | BASIC 10Liner |
Genre | Strategy |
Tags | 10liner, 8-Bit, basic, sinclair, ZX Spectrum |
Download
Install instructions
*** Loading the game ***
The game is distributed in a .tap file, mofiar.tap
You can play it in your favourite ZX Spectrum emulator. If you do not have one, I recommend FUSE emulator http://fuse-emulator.sourceforge.net/
Dowload and install it. It is recommendable to use a Spectrum 16K or 48K machine.
Load the game by drag-n-drop the .tap or using the menú option file→open.
The game starts automatically.
Development log
- After show release: MOFIAR-PVPMar 28, 2024
Comments
Log in with itch.io to leave a comment.
Greetings Antonio,
we hope you are doing great. I am Areeba (aka Titania) from the BrewOtaku-Team, we are launching BrewOtaku #002 - The Homebrew Gaming Magazine soon.
We loved your work and we have mentioned "MOFIAR” in it. Kindly share your contact details so we can share it with you. You are anyhow free to share this on your social media channels or homepage.
We look forward to hearing from you soon.
Kind regards
Titania