diff options
Diffstat (limited to 'voerbak/win.h')
-rw-r--r-- | voerbak/win.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/voerbak/win.h b/voerbak/win.h new file mode 100644 index 0000000..41122a5 --- /dev/null +++ b/voerbak/win.h @@ -0,0 +1,27 @@ +#pragma once +#include <stdbool.h> + +#include "voerbak.h" + +/** + * @brief Get length of longest streak with same color from `pos` in direction `direction` + * + * @param b Board to check + * @param pos Position to check win position from (position of last dropped disc) + * @param direction Direction offset to step forward to + * @param d_index Index of direction in directions array (defined in `checkWin()`) + * @param currentLength Current length of same color 'streak' + * + * @return Length of longest streak with same color from `pos` in direction `direction` + */ +int winCheckRecursive(Board*, int, int, int, int); + +/** + * @brief Check for winning position from position `pos` + * + * @param b Board to check + * @param pos Position to check win position from (position of last dropped disc) + * + * @return `true` if game was won by the color that's in `b->board[pos]` + */ +bool checkWin(Board*, int); |