Fixed types
This commit is contained in:
parent
8c41443935
commit
22356ca529
1 changed files with 7 additions and 7 deletions
14
logic.c
14
logic.c
|
|
@ -19,21 +19,21 @@
|
||||||
#include "logic.h"
|
#include "logic.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
static int heightMask( const int a ){
|
static column_t heightMask( const rowsint_t a ){
|
||||||
return ( 1 << a ) - 1;
|
return ( 1 << a ) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int safeHeightMask( const int a ){
|
static column_t safeHeightMask( const rowsint_t a ){
|
||||||
return a > 0 ? heightMask( a ) : 0;
|
return a > 0 ? heightMask( a ) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bottomHeightMask( const int a, const int b ){
|
static column_t bottomHeightMask( const rowsint_t a, const rowsint_t b ){
|
||||||
return safeHeightMask( bottom( a, b ) );
|
return safeHeightMask( bottom( a, b ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void playMove(
|
void playMove(
|
||||||
board_t *boardptr,
|
board_t *boardptr,
|
||||||
const int column
|
const columnsint_t column
|
||||||
){
|
){
|
||||||
boardptr->column [ column ] |=
|
boardptr->column [ column ] |=
|
||||||
boardptr->player << boardptr->height [ column ];
|
boardptr->player << boardptr->height [ column ];
|
||||||
|
|
@ -43,7 +43,7 @@ void playMove(
|
||||||
void calcWins(
|
void calcWins(
|
||||||
wins_t *wins,
|
wins_t *wins,
|
||||||
const board_t board,
|
const board_t board,
|
||||||
const int column
|
const columnsint_t column
|
||||||
){
|
){
|
||||||
// First the simplest win, the humble tower
|
// First the simplest win, the humble tower
|
||||||
// Check for lil towers
|
// Check for lil towers
|
||||||
|
|
@ -72,7 +72,7 @@ void calcWins(
|
||||||
// Now the rest of the wins
|
// Now the rest of the wins
|
||||||
// First connect 2
|
// First connect 2
|
||||||
for(
|
for(
|
||||||
int i = top( column - 1, 0 );
|
columnsint_t i = top( column - 1, 0 );
|
||||||
i < bottom( column + 1, board.columns - 1 );
|
i < bottom( column + 1, board.columns - 1 );
|
||||||
i++
|
i++
|
||||||
){
|
){
|
||||||
|
|
@ -101,7 +101,7 @@ void calcWins(
|
||||||
}
|
}
|
||||||
// Then stitch the twos together and count
|
// Then stitch the twos together and count
|
||||||
for(
|
for(
|
||||||
int i = top( column - 3, 0 );
|
columnsint_t i = top( column - 3, 0 );
|
||||||
i < bottom( column + 1, board.columns - 3 );
|
i < bottom( column + 1, board.columns - 3 );
|
||||||
i++
|
i++
|
||||||
){
|
){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue