debugged win condition checker