refactor winning condition for new data structure