Added method to check winning condition and print result