Im Magazin „Microcomputing" wurde im September 1978 der folgende Artikel abgedruckt.
Das Strategiespiel Fox and Hounds.
|
|
Jack A. Inman
922 E. Edgecomb Ave.
Covina CA 91724
|
Tally Ho!
This strategic game program offers proof that fox hunting is not obsolete.
Fox and Hounds is an old game – a variation of checkers played on a standard checkerboard.
Unlike checkers, this game is played with only five pieces on the board.
There are one fox and four hounds; one player moves the fox, the other the hounds.
In this case the computer moves the "fox," and the human player moves the "hounds."
Since the number of pieces is limited, neither side can jump pieces.
The hounds can move in a forward direction only.
The solitary fox would run out of moves very quickly if allowed movement only in one direction, so he can move either forward or backward.
All moves for both fox and hounds are limited to the standard checker move – that is, one space diagonally per move.
The object of the game is for the fox to reach the safety of line one (1).
If the fox can get to line one, the computer (fox) wins.
If the human player can trap Renard in a location from which he cannot escape, the human wins.
I wrote this game in SWTP 8K version 2.0 BASIC, which supports multiple statements on each line.
However, since most BASICs do not have this feature, I chose not to use it.
I also tried to use only the standard BASIC statements that should be available in any good version.
I did this so anyone can type the program into his machine without having to rewrite half the program.
(I hate to have to try to figure out what some special statement is supposed to do.)
I did use one nonstandard statement, PRINT CHR$(16); CHR$(22), several times to cause my terminal (SWTP CT-1024) to home up and clear the screen.
If you have this feature, fine; no change is required.
If you do not, you can omit the lines and the program will work anyway.
If you have scrolling, simply omit these lines.
Program Description
The program listing shows the program starting in a standard game fashion:
asking if the player wants Instructions.
If the player's answer is yes, the instructions are printed out.
Even though the program prints TYPE YES OR NO, anything other than a yes answer is ignored, causing the program to go on to the next line.
I see no good reason to force the player to type NO if he does not want the instructions.
The board array is set by the DIM statement in line 110.
The array is set to 9 by 9, even though the board is only 8 by 8, so the automatic moves by the computer do not test out of bounds of the array and cause error stops.
Line 330 sets up the fox in his initial position.
Lines 340 to 370 set up variables to keep track of the fox's position for the automatic moves.
They are also used to print out the computer's moves for the player.
The screen Is cleared and homed by line 405.
Next, the board is printed out by lines 410 through 530.
Line 406 branches to the subroutine that prints the computer's moves for the player.
During printing of the board, the letters X, H, F and O are printed, dependent upon the value in the array position.
The X indicates a square that cannot be moved onto;
the H is the position of a hound;
the F is the fox's position;
and the O is a vacant square that can be occupied by a piece.
I used the designations F and H for the fox and hounds rather than the conventional R (red) and B (black) because this made the pieces easier to track.
The board is printed out after each move.
After each printout, lines 540 and 560 test for a win by either the computer or the human.
Lines 600 through 640 obtain the player's move.
Each move requires two coordinates to tell which hound is to be moved.
Two more coordinates are required to tell where the player wants to move the hound.
The required format is line first, then column, for all coordinates.
The validity of the move is tested by lines 650 through 710.
Valid moves can be only one space forward and one diagonally, right or left.
The space the player wants to move to must also be vacant (indicated by the presence of a 4 in the position of the array).
The screening also verifies that the player is attempting to move only a hound, which is indicated by a 2 in the position of the array, the position being the "from" (F,F1) coordinates for the hound test.
The "to" test is made on the T,T1 coordinates.
If the tests prove the move is valid, lines 720 and 730 reverse the position of the hound and the vacant square in the array.
Thus the hound is moved.
The computer moves next.
Lines 903 through 940 randomize the left-right diagonal movement of the fox.
Without this, movement would always be either diagonally left or right, depending upon which came first in the program, and the fox's moves would be too predictable.
The Q variable is used to assure that all possible moves are tested.
Forward moves are always tested before backward moves are attempted.
(Remember, the fox is trying to get to line one.)
Lines 950 through 1270 do the actual testing and moving for the fox.
This is one of the places the variables X, Y, A and B are used to keep track of the fox's position.
In each of the four possible moves, the position to be attained is tested for vacancy.
If it's vacant, the fox is moved.
Next, the space the fox was in is changed to a vacant space (4).
If no vacant space is found for the move being tested, the value of Q tells the program which move to try next until all move possibilities are exhausted.
If no more moves are available, the variable Z will be set to 1 by line 1170 or 1260, indicating to line 560 in the board printout that the human has won the game.
It also causes a computer-move printout of I CAN'T MOVE.
If, however, the computer can find a valid move, the values of X and Y are left holding the position in the array for the moved-to position.
The values of A and B retain the moved-from position in the array.
All of these are used later to print out the computer's move.
Playing the Game
A run of the program is included.
It shows what the board looks like and how the computer requests moves from the player.
Each line is numbered for convenience; each column is numbered below the column.
The computer moves are printed above the board; the request for the player's move is printed below the board.
The request for the move contains a reminder to type line and then column in that order.
The printout of the board shows all of the vacant squares as represented by the letter O.
Nonvalid squares are represented by the letter X.
The player can move onto any vacant square in the line which is one line greater than the line and one column diagonally from the current position of the hound to be (standard checker move).
I did not include any nonvalid moves in the run;
the screening does however, work.
That about covers the game. Good luck to the hounds!
|
Sample run. |
Eingescanned von
Werner Cirsovius
Januar 2014
© Microcomputing (kilobaud)