added winning condition and fixed blinking led logic