Added command-line option for setting size of board
This commit is contained in:
parent
e47d63b430
commit
72b6290798
6 changed files with 101 additions and 74 deletions
6
logic.c
6
logic.c
|
|
@ -62,7 +62,7 @@ void calcWins(
|
|||
// First the simplest win, the humble tower
|
||||
wins->count0.vertical = 0;
|
||||
wins->count1.vertical = 0;
|
||||
for( int i = 0; i < BOARD_WIDTH; i++ ){
|
||||
for( int i = 0; i < board.columns; i++ ){
|
||||
// Check for lil towers
|
||||
wins->same.vertical2 [ i ] =
|
||||
~( board.column [ i ]
|
||||
|
|
@ -89,7 +89,7 @@ void calcWins(
|
|||
wins->count0.diagonalDown = 0;
|
||||
wins->count1.diagonalDown = 0;
|
||||
// First connect 2
|
||||
for( int i = 0; i < BOARD_WIDTH - 1; i++ ){
|
||||
for( int i = 0; i < board.columns - 1; i++ ){
|
||||
wins->same.horizontal2 [ i ] =
|
||||
~( board.column [ i ]
|
||||
^ board.column [ i + 1 ] )
|
||||
|
|
@ -114,7 +114,7 @@ void calcWins(
|
|||
& ~1; // A diagonal line down ain't starts at the floor innit?
|
||||
}
|
||||
// Then stitch the twos together and count
|
||||
for( int i = 0; i < BOARD_WIDTH - 3; i++ ){
|
||||
for( int i = 0; i < board.columns - 3; i++ ){
|
||||
wins->same.horizontal4 [ i ] =
|
||||
wins->same.horizontal2 [ i ]
|
||||
& wins->same.horizontal2 [ i + 1 ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue