Refactor check_horizontal_win