★ AMSTRAD CPC ★ GAMESLIST ★ FOUR IN A ROW (c) COMPUTING WITH THE AMSTRAD ★

Computing with the Amstrad
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

DUDLEY BROOKE adapts Connect 4

FOUR in a row is a computer adaptation of the well known game Connect 4. You can play either a human opponent or the computer. If you prefer you can even sit back and watch the computer compete against itself.

To get started just follow the onscreen prompts to identify the players. Once into the game all you need to do to place a counter is select a column by positioning the arrow using the cursor keys, then press Copy to confirm your choice.

Lines 1490-2370 contain the algorithm for choosing the computer's move, and it can be a ruthless opponent. The routine only changes one major variable col, so it would be fairly easy for anyone wishing to write their own algorithm to implement it within the framework of the rest of the program.

The “check against arrays” routine (lines 1950-2130) searches the arrays for an offered string tst$. If a match is found it returns with col set to the appropriate column in which to drop the counter.

The program has been designed for speed, and the computer will not take more than 10 seconds to arrive at a decision.

To achieve this the position of each counter is stored four times in four string arrays and these correspond to the four directions in which a winning line may be made-either in a column, a row or diagonally. This allows the speed of the INSTR command to be used to search for a match.

In general, single letter variables are not passed to other routines, the notable exception being p which is either 1 or -1 and identifies the current player.

The program is quite complex, especially the routines which handle the selection of the computer's move, and particularly the arithmetic expressions which access the strings storing the game position.

Any typing errors with these could be quite difficult to debug, but given this little clue and the checksums, you have some advantage.

CWTA

FOUR IN A ROW
(c) COMPUTING WITH THE AMSTRAD

AUTHOR: DUDLEY BROOKE

★ YEAR: 1987
★ LANGUAGE:
★ GENRE: INGAME MODE 1 , BASIC , CONNECT 4 , MULTIPLAYER , BASIC
★ LiCENCE: LISTING
★ COLLECTION: COMPUTING WITH THE AMSTRAD 1987

 

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listings:
» Four  in  a  Row    (Computing  with  the  Amstrad)    ENGLISHDATE: 2020-08-05
DL: 229
TYPE: ZIP
SiZE: 7Ko
NOTE: 40 Cyls
.HFE: Χ

» Four  in  a  Row    (Computing  with  the  Amstrad)    LISTING    ENGLISHDATE: 2016-10-26
DL: 123
TYPE: text
SiZE: 9Ko
NOTE: Uploaded by hERMOL ;

Je participe au site:
» Vous avez des infos personnel ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 609 millisecondes et consultée 1137 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.