added win condition check