Skip to main content
Commonmark migration
Source Link

#Victory Plus Minus One

Victory Plus Minus One

Randomly picks one above or below the last victory number.

import random

class VictoryPM1(object):
    def __init__(self, index):
        self.index = index
        self.victory = 0

    def select(self):
        if self.victory < 1 or self.victory > 10:
            return 1
        elif random.randint(0, 1):
            if self.victory < 2:
                return 2
            else:
                return self.victory - 1
        else:
            if self.victory > 9:
                return 9
            else:
                return self.victory + 1

    def update(self, choices):
        a = [0] * 11
        for b in choices:
            a[b] += 1
        for i in range(1, 10):
            if a[i] == 1:
                self.victory = i
                return

#Victory Plus Minus One

Randomly picks one above or below the last victory number.

import random

class VictoryPM1(object):
    def __init__(self, index):
        self.index = index
        self.victory = 0

    def select(self):
        if self.victory < 1 or self.victory > 10:
            return 1
        elif random.randint(0, 1):
            if self.victory < 2:
                return 2
            else:
                return self.victory - 1
        else:
            if self.victory > 9:
                return 9
            else:
                return self.victory + 1

    def update(self, choices):
        a = [0] * 11
        for b in choices:
            a[b] += 1
        for i in range(1, 10):
            if a[i] == 1:
                self.victory = i
                return

Victory Plus Minus One

Randomly picks one above or below the last victory number.

import random

class VictoryPM1(object):
    def __init__(self, index):
        self.index = index
        self.victory = 0

    def select(self):
        if self.victory < 1 or self.victory > 10:
            return 1
        elif random.randint(0, 1):
            if self.victory < 2:
                return 2
            else:
                return self.victory - 1
        else:
            if self.victory > 9:
                return 9
            else:
                return self.victory + 1

    def update(self, choices):
        a = [0] * 11
        for b in choices:
            a[b] += 1
        for i in range(1, 10):
            if a[i] == 1:
                self.victory = i
                return
Source Link
Shieru Asakoto
  • 6.3k
  • 16
  • 40

#Victory Plus Minus One

Randomly picks one above or below the last victory number.

import random

class VictoryPM1(object):
    def __init__(self, index):
        self.index = index
        self.victory = 0

    def select(self):
        if self.victory < 1 or self.victory > 10:
            return 1
        elif random.randint(0, 1):
            if self.victory < 2:
                return 2
            else:
                return self.victory - 1
        else:
            if self.victory > 9:
                return 9
            else:
                return self.victory + 1

    def update(self, choices):
        a = [0] * 11
        for b in choices:
            a[b] += 1
        for i in range(1, 10):
            if a[i] == 1:
                self.victory = i
                return