Calling a function on event
I programmed the 4 in line game in ASCII characters. Now, I am creating a visual interface for it, and this brings whole new concepts that I must learn.
I using the openCV library, and with it I was able to draw the game board. This library also has some mouse callback functions that allow me to use the mouse to make a move on the board easily.
But when it comes to the computer making a move on its own, it is not that simple.
I have a variable that changes between 1 and 2, depending on who's turn it is to play. I was wondering if there is any way to call the function that generates the move every time that variable changes to 2 (computers turn).
If maybe you could provide a simple example, for example, a function that prints "Hello" every time a counter changes in some other function (without calling it ofc), I think I could understand and adapt it to my code.