home *** CD-ROM | disk | FTP | other *** search
/ Futura 19 / Futura_Issue_19_1996_NOSAUG_Disk_1_of_2_Side_A_BASIC.atr / mouse8.doc < prev    next >
Text File  |  2023-02-26  |  5KB  |  1 lines

  1. ¢ADDING A MOUSE¢¢Part 8¢¢by Kevin Cooke¢¢¢"Roll out the red carpet... start the drum roll... let the musicians play... yes, ladies and gentlemen, boys and girls, could you please put you hands together for the exciting, the exclusive, the incredible MOUSE-CONTROLLED NOUGHTS AND CROSSES!"¢¢     Well, now that I've done the introduction, let me tell you about the game.  First of all, it was written by me (an immediate bonus you might think!) using the Multi Mouse program by Simon Trew, and as far as I know is the first Noughts and Crosses program to allow control by a mouse.¢¢    Don't worry if I haven't yet pursuaded you to buy a mouse as Noughts and Crosses also lets you use a joystick or touch-tablet.¢¢    After taking a simple look at the loading instructions below, you should be able to use the program with ease.¢¢¢LOADING INSTRUCTIONS¢¢    First of all, hold down OPTION to boot DOS.  From here, you first need to choose which sort of controller to use (i.e. mouse, joystick or touch-tablet).  The chart below tells you which file to load using DOS option "L"¢¢Mouse        -  MOUSE.DRI¢Joystick     -  JOYST.DRI¢Touch-Tablet -  TOUCH.DRI¢¢    After loading the appropriate file, Turbo BASIC and the Noughts and Crosses program will automatically load and RUN.¢¢PLEASE NOTE: The controller being used MUST be plugged into joystick port 2.¢¢¢PROGRAM NOTES¢¢    For those even remotely interested in the program listing itself, below are a few notes:¢¢    Although the program is not intended to be an example of good programming techniques, I hope that you find it reasonably structured.  This should allow you to follow it with confidence.¢¢    You may notice that the listing is very long for a simple Noughts and Crosses game but I believe this is justified.  Firstly, the program does allow you to play against the computer - the routine to do this is in itself quite long.  In fact, I did have another method to allow the computer to make its choices but I scrapped it in preference for my latest program because of two important advantages:¢¢a) The version in use is easy to follow    and modify.¢¢b) This version actually works!¢¢    Another reason for the program being so long is that I wanted it to be easy and intuitive to use.  I could have compacted many of the lines together but decided to leave them as they stand to allow easy reading and modification.¢¢    I will now describe how the computer decides where to make its move.  First of all, whenever one of its (or your) pieces are placed, the space is effectively filled with either a "1" for player one or a "4" for player two.  Using this combination means that any single row will have one of the following values when the boxes in it are added together:¢¢VALUE  EXPLAINATION OF LINE VALUE¢¢  0    Three blank spaces¢       (0+0+0)¢¢  1    Two blank spaces and one "O"¢       (0+0+1)¢¢  2    One blank space and two O's¢       (0+1+1)¢¢  3    Line contains 3 O's (win!)¢       (1+1+1)¢¢  4    Two blank spaces and one "X"¢       (0+0+4)¢¢  5    One blank space, one X and O¢       (0+1+4)¢¢  6    One X and two O's¢       (4+1+1)¢¢  8    One blank space and two X's¢       (0+4+4)¢¢  9    Two X's and one O¢       (4+4+1)¢¢ 12    Line contains 3 X's (win!)¢       (4+4+4)¢¢So, on making the calculation, the computer acts on it:¢¢If the calculation gives a 12 or a 3, the computer knows that either it (player 2) or player 1 has won.¢¢If the calculation gives a 2 or 8, the computer finds the missing space in the line and fills it either to block the opponent from making a winning line or to make one itself!¢¢If the calculation gives a value of 4, the computer realises that 2 spaces in a line are blank and the other space is filled with one of it's pieces.  It then places another of its pieces in the line, giving it a chance to win on its next move.¢¢Any other value will simply make the computer pick one of the free squares from random and place an X there.¢¢    Hopefully that has given you some sort of idea as to what the computer does to calculate its move.¢¢    Although the computer can be beaten fairly easily, there is a reason for this.  If both players use "best play", a game can only end in a draw.  For this reason, the computer makes some deliberate mistakes in the hope that its mistakes per session of games will be approximately balanced with the number its human opponent makes.¢¢¢ONE LAST THING TO NOTE:¢¢    The version of Turbo BASIC used with Multi Mouse has had it's Ramtop modified to prevent it from crashing when both programs clash.  Therefore, it is not, strictly speaking, a standard version of Turbo BASIC.  Anyway, I hope you enjoy the program.¢¢¢MOUSE TRIVIA¢¢    Fed up with the Magic Eye (or stereogram) craze?  Well then, be careful when buying a mouse mat as some bright spark has even started manufacturing mouse mats with these annoying pictures on them!  However, priced at around 7-8 pounds, you may find getting a cheaper mouse mat and a Stereogram book better value for money!¢