Fixed a little silly
This commit is contained in:
parent
22356ca529
commit
e31258e26c
3 changed files with 5 additions and 4 deletions
4
logic.c
4
logic.c
|
|
@ -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(
|
||||||
columnsint_t i = top( column - 1, 0 );
|
columnsint_t i = clipped_subtract( column, 1 );
|
||||||
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(
|
||||||
columnsint_t i = top( column - 3, 0 );
|
columnsint_t i = clipped_subtract( column, 3 );
|
||||||
i < bottom( column + 1, board.columns - 3 );
|
i < bottom( column + 1, board.columns - 3 );
|
||||||
i++
|
i++
|
||||||
){
|
){
|
||||||
|
|
|
||||||
4
logic.h
4
logic.h
|
|
@ -6,11 +6,11 @@
|
||||||
|
|
||||||
extern void playMove(
|
extern void playMove(
|
||||||
board_t *boardptr,
|
board_t *boardptr,
|
||||||
const int column
|
const columnsint_t column
|
||||||
);
|
);
|
||||||
|
|
||||||
extern void calcWins(
|
extern void calcWins(
|
||||||
wins_t *wins,
|
wins_t *wins,
|
||||||
const board_t board,
|
const board_t board,
|
||||||
const int column
|
const columnsint_t column
|
||||||
);
|
);
|
||||||
|
|
|
||||||
1
macros.h
1
macros.h
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#define top( a, b ) ( a < b ? b : a )
|
#define top( a, b ) ( a < b ? b : a )
|
||||||
#define bottom( a, b ) ( a < b ? a : b )
|
#define bottom( a, b ) ( a < b ? a : b )
|
||||||
|
#define clipped_subtract( a, b ) ( a < b ? 0 : a - b )
|
||||||
|
|
||||||
#define XSTR(s) STR(s)
|
#define XSTR(s) STR(s)
|
||||||
#define STR(s) #s
|
#define STR(s) #s
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue