Gomoku game example (5 in a row):
Finish:
If desired, the game can be changed as you like, for example turn into tic-tac-toe, for this you need to change the field size to 3 and the line size to 3 too:
At the end of the game, a window is displayed where you can start a new game with certain parameters: