コード例 #1
0
ファイル: Player.py プロジェクト: dogbyday/SET
def getLeastSet(board, deck, sets):
    minSet = -1
    minExistingSets = -1
    numSetsForSet = 0
    setNum = 0
    
    for eachSet in sets:
        cards = eachSet.returnSet()
        for card in cards:
            for secondCard in (board + deck):
                if secondCard != card:
                    thirdCard = Set.predictThird(card, secondCard)
                    if thirdCard in (board + deck):
                        numSetsForSet += 1
        if minExistingSets == -1 or numSetsForSet < minExistingSets:
            minExistingSets = numSetsForSet
            minSet = setNum
        numSetsForSet = 0
        setNum += 1
    return sets[minSet]
コード例 #2
0
ファイル: Player.py プロジェクト: dogbyday/SET
def getMostCard(board, deck, sets):
    minSet = -1
    maxExistingSets = -1
    numSetsForCard = 0
    setNum = 0
    
    for eachSet in sets:
        cards = eachSet.returnSet()
        for card in cards:
            for secondCard in (board + deck):
                if secondCard != card:
                    thirdCard = Set.predictThird(card, secondCard)
                    if thirdCard in (board + deck):
#                             print( card, secondCard, thirdCard)
                        numSetsForCard += 1
            if maxExistingSets == -1 or numSetsForCard > maxExistingSets:
                
                maxExistingSets = numSetsForCard
                minSet = setNum
        numSetsForCard = 0
        setNum += 1
    return sets[minSet]