Implementation of isWon function