★ AMSTRAD CPC ★ GAMESLIST ★ CONNECT FOUR (COMPUTER CHALLENGES FOR THE AMSTRAD) (c) DUCKWORTH ★

Computer Challenges for 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 ★ 

Summary

So far this book has dealt with the uses of artificial intelligence and some of the major extensions to Basic which Locomotive Basic offers, developing the use of both in a selection of 'intelligent' games and puzzles. In the puzzles, the machine displays a level of artificial intelligence by forbidding you to make illegal moves, which it achieves by comparing the move you have requested against an inbuilt criterion of legality. For example, in the Towers of Hanoi puzzle you cannot place a larger disc on one of smaller size, and in the Sliding Puzzle you are only permitted to slide an adjacent tile into the empty space. Without these rules the puzzles would often become trivial to solve and thereby offer no intellectual stimulus, which is the aim of a computer challenge.

For the games, however, an extension of the above intelligence is required, since, although confirmation of legality is an important and vital step, the computer must also decide on a move which will make it as difficult as possible for you to obtain a victory. This additional display of artificial intelligence can be obtained in several different ways, and a selection has been employed in the games in this book to facilitate sensible play by the computer.

In Noughts and Crosses, if the computer goes first it adopts an algorithmic approach which develops after each square of the grid has been occupied. This is achieved by selecting a square at random (either 1,3,5,7 or 9) and then playing a different game depending on this choice. Should it be required to defend, the computer employs a heuristic approach as it has been educated in many of the tricks which can be used to obtain a victory and is therefore able to block such attempts at winning the game.

With Cribbage, the computer considers in turn the fifteen different ways of choosing four of the six cards it has been dealt, and by checking to see the score for each hand it is able to select the one with the maximum number of points. By using this method the computer never gambles on the cut of the cards which the human player might attempt, but is instead content to play a safe game which will probably prove to be successful in the long term. An extra artificial intelligence routine is required in this program since the game also comprises the 'play for points' section, where the players lay their cards alternately in an attempt to reach 31, obtain pairs or runs, etc., and the computer must be able to perform this intelligently if it is to have a chance of winning.

The third technique employed is that of weighting, in which each legal move is considered and the resulting position is weighted on its benefit to either player, i.e. the higher the weighting, the better the position for the Amstrad. This is particularly useful with board games when it is not clear what the best move may be and an algorithm for victory cannot be produced. Clearly the computer will play better if the position after several subsequent moves is examined, but this is extremely time-consuming and is therefore not possible when writing in Basic. However, a compromise is reached in the game of Draughts, in which a deeper level of look-ahead is employed on some occasions, notably when there are fewer pieces on the board and therefore fewer legal possibilities to consider.

This book is meant to be instructive as well as entertaining. With this in mind, the remaining pages are used to demonstrate the development of the game Connect Four from the initial conception up to the time of writing the routine for the computer's move. This step is omitted to allow you the opportunity of writing one of the artificial intelligence routines of the game. Some hints on the route to take are included.

Connect Four

The game is played on a vertical board with seven columns and six rows of holes which can be filled by a counter. You and the computer take alternate turns at dropping a counter into one of the columns with the aim of obtaining a row of four either vertically, horizontally or diagonally.

The first step in writing the program is to construct a simple flowchart outlining the basic blocks which will need to be formulated separately.

Let us consider each step individually, constructing the code in the form of subroutines.

CONNECT FOUR (COMPUTER CHALLENGES FOR THE AMSTRAD)
(c) DUCKWORTH

Authors: Richard HURLEY and David VIRGO

★ COLLECTION: Computer Challenges for the Amstrad

★ YEAR: 1985
★ LANGUAGE:
★ GENRE: BASIC , BOARD , CONNECT 4
★ LiCENCE: LISTING

 



★ AMSTRAD CPC ★ DOWNLOAD ★

Aucun fichier de disponible:
» Vous avez des fichiers que nous ne possédons pas concernent cette page ?
Je participe au site:
» Pour ce titre nous ne disposons de fichier executable sur CPC (Dump, Saisie du listing) , alors si vous avez ça dans vos cartons ou vous désirez usé vos petit doigts boudinés sur votre clavier faites le nous savoir.
» 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.732-desktop/c
Page créée en 171 millisecondes et consultée 211 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.