Split session_loop into separate functions for handling 3-in-a-row, 4-in-a-row, and filling holes