If we go back to our Tic-Tac-Toe result solution, you'll notice that there are a number of functions that receive board as a parameter:
auto allLines = [](const auto& board) {
...
};
auto allColumns = [](const auto& board) {
...
};
auto mainDiagonal = [](const auto& board){
...
};
auto secondaryDiagonal = [](const auto& board){
...
};
auto allDiagonals = [](const auto& board) -> Lines {
...
};
auto allLinesColumnsAndDiagonals = [](const auto& board) {
...
};
We can define a board as follows, for example:
Board board {
{'X', 'X', 'X'},
{' ', 'O', ' '},
{' ', ' ', 'O'}
};
Then, when we pass it into the functions, it's like we're binding the board to the parameter of the functions. Now, let's...