diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-02-23 14:14:50 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-02-23 14:14:50 +0100 |
commit | 1a55f52bb79b609cd850a77e2f7a9fdc6b4fbf6b (patch) | |
tree | a28604c4e89be863954baa887e758bd0419d2e53 /voerbak/win.h | |
parent | 34c9fa5176f0d2c18457a72085f5803c2d616cc6 (diff) |
split up code into seperate files
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); |