Check for wins.
Check for wins, that is, 4 in a row in the board for a given player. We only need to check for a win as a result of the current move. Any wins on the board must have been caused by the current move. We must check for multiple wins>.
More...
|
Files |
| file | win.h |
| | Check for wins - header file.
|
Functions |
| int | win_1 (short *bptr, int offset, short *board) |
| | Check for wins.
|
Detailed Description
Check for wins, that is, 4 in a row in the board for a given player. We only need to check for a win as a result of the current move. Any wins on the board must have been caused by the current move. We must check for multiple wins>.
Wins are checked in the following order:
1) Top view, horizontal.
2) Top view, vertical.
3) Top view, diagonal (upper left to lower right).
4) Top view, diagonal (lower left to upper right).
5) Side view, vertical.
6) Side view, diagonal (upper left to lower right).
7) Side view, diagonal (lower left to upper right).
8) End view, diagonal (upper left to lower right).
9) End view, diagonal (lower left to upper right).
10) Diagonal view (upper top left to lower bottom right).
11) Diagonal view (upper bottom left to lower top right).
12) Diagonal view (lower top left to upper bottom right).
13) Diagonal view (lower bottom left to upper top right).
Function Documentation
| win_1 |
( |
short * |
bptr, |
|
|
int |
offset, |
|
|
short * |
board |
|
) |
|
|
|
|
Check for wins.
- Parameters:
-
| bptr | short * : address of a plain (&board + 10, 11, 12, or 13). |
| offset | int : offset in bptr[]. |
| board | short * : &a_board_1[0] or &b_board_1[0]. |
- Returns:
- int.
- Return values:
-
| TRUE | - there is a win for the player. |
| FALSE | - there is not a win for the player. |
|
Generated on Sat Sep 24 09:00:12 2011 for ScoreFour by
1.4.5