Skip to main content
added 84 characters in body
Source Link
KSFT
  • 1.6k
  • 10
  • 23

SabotageCampers - Python

def choose(rounds, players, previous):
    if rounds<3:
        return 1
    prevchoices=[int(i) for i in " ".join(previous[-5:]).split(" ")]
    remove=[]
    for i in prevchoices:
        if prevchoices.count(i)<3:
            remove.append(i)
    campers=[i for i in prevchoices if i not in remove]
    return random.choice(campers)

The campers are still winning. Let me know if you have any suggestions for this.

SabotageCampers - Python

def choose(rounds, players, previous):
    if rounds<3:
        return 1
    prevchoices=[int(i) for i in " ".join(previous[-5:]).split(" ")]
    remove=[]
    for i in prevchoices:
        if prevchoices.count(i)<3:
            remove.append(i)
    campers=[i for i in prevchoices if i not in remove]
    return random.choice(campers)

SabotageCampers - Python

def choose(rounds, players, previous):
    if rounds<3:
        return 1
    prevchoices=[int(i) for i in " ".join(previous[-5:]).split(" ")]
    remove=[]
    for i in prevchoices:
        if prevchoices.count(i)<3:
            remove.append(i)
    campers=[i for i in prevchoices if i not in remove]
    return random.choice(campers)

The campers are still winning. Let me know if you have any suggestions for this.

deleted 273 characters in body
Source Link
KSFT
  • 1.6k
  • 10
  • 23

SabotageCampers - Python

def choose(rounds, players, previous):
    import random
    if rounds==1rounds<3:
        return 1
    playerchoices=zip(*[[intprevchoices=[int(choicei) for choicei in round" ".join(previous[-5:]).split(" ")] for round in previous])
    ncampers={}remove=[]
    for playeri in playerchoicesprevchoices:
        if allprevchoices.count([choice==player[0] for choice in player]i):
            if player[0] not in campers<3:
                campers[player[0]]=0
            campers[player[0]]+=1
    maxcampers=max(ncampersremove.valuesappend()i)
    mostcampers=[icampers=[i for i in ncampersprevchoices if ncampers[i]==maxcampers]i not in remove]
    return random.choice(mostcamperscampers)

SabotageCampers - Python

def choose(rounds, players, previous):
    import random
    if rounds==1:
        return 1
    playerchoices=zip(*[[int(choice) for choice in round.split(" ")] for round in previous])
    ncampers={}
    for player in playerchoices:
        if all([choice==player[0] for choice in player]):
            if player[0] not in campers:
                campers[player[0]]=0
            campers[player[0]]+=1
    maxcampers=max(ncampers.values())
    mostcampers=[i for i in ncampers if ncampers[i]==maxcampers]
    return random.choice(mostcampers)

SabotageCampers - Python

def choose(rounds, players, previous):
    if rounds<3:
        return 1
    prevchoices=[int(i) for i in " ".join(previous[-5:]).split(" ")]
    remove=[]
    for i in prevchoices:
        if prevchoices.count(i)<3:
            remove.append(i)
    campers=[i for i in prevchoices if i not in remove]
    return random.choice(campers)
Source Link
KSFT
  • 1.6k
  • 10
  • 23

SabotageCampers - Python

def choose(rounds, players, previous):
    import random
    if rounds==1:
        return 1
    playerchoices=zip(*[[int(choice) for choice in round.split(" ")] for round in previous])
    ncampers={}
    for player in playerchoices:
        if all([choice==player[0] for choice in player]):
            if player[0] not in campers:
                campers[player[0]]=0
            campers[player[0]]+=1
    maxcampers=max(ncampers.values())
    mostcampers=[i for i in ncampers if ncampers[i]==maxcampers]
    return random.choice(mostcampers)