added a function that checks for victory conditions