예제 #1
0
def one_three_zeros(value):
    squad = Squad()
    for i in ELEMENTS:
        s = Stone()
        s[i] = value
        squad.append(Scient(i, s))
    return squad
예제 #2
0
파일: helpers.py 프로젝트: jessetane/btpy
def one_three_zeros(value):
    squad = Squad()
    for i in ELEMENTS:
        s = Stone()
        s[i] = value
        squad.append(Scient(i, s))
    return squad
예제 #3
0
def max_squad_by_value(value):
    """Takes an integer, ideally even because we round down, and returns a
    squad such that comp[element] == value, comp[orth] == value/2, comp[opp]
    == 0"""
    squad = Squad()
    value = value / 2  #more logical, really.
    half = value / 2
    for i in ELEMENTS:
        s = Stone()
        s[i] = value
        s[OPP[i]] = 0
        for o in ORTH[i]:
            s[o] = half
        squad.append(Scient(i, s))
    return squad
예제 #4
0
파일: helpers.py 프로젝트: jessetane/btpy
def max_squad_by_value(value):
    """Takes an integer, ideally even because we round down, and returns a
    squad such that comp[element] == value, comp[orth] == value/2, comp[opp]
    == 0"""
    squad = Squad()
    value = value / 2  # more logical, really.
    half = value / 2
    for i in ELEMENTS:
        s = Stone()
        s[i] = value
        s[OPP[i]] = 0
        for o in ORTH[i]:
            s[o] = half
        squad.append(Scient(i, s))
    return squad
예제 #5
0
def rand_squad(suit=None, kind='Scient'):
    """Returns a Squad of five random Scients of suit. Random suit used
       if none given."""
    #please clean me up.
    squad = Squad()
    if kind == 'Scient':
        size = 5
        if not suit in ELEMENTS:
            for _ in range(size):
                squad.append(rand_unit(rand_element(), kind))
        else:
            for _ in range(size):
                squad.append(rand_unit(suit, kind))
    else:
        if not suit in ELEMENTS:
            while squad.free_spaces >= 2:
                squad.append(rand_unit(rand_element()))
            if squad.free_spaces == 1:
                squad.append(rand_unit(rand_element(), kind='Scient'))
        else:
            while squad.free_spaces >= 2:
                squad.append(rand_unit(suit))
            if squad.free_spaces == 1:
                squad.append(rand_unit(suit, kind='Scient'))
    squad.name = rand_string()
    return squad
예제 #6
0
파일: helpers.py 프로젝트: jessetane/btpy
def rand_squad(suit=None, kind="Scient"):
    """Returns a Squad of five random Scients of suit. Random suit used
       if none given."""
    # please clean me up.
    squad = Squad()
    if kind == "Scient":
        size = 5
        if not suit in ELEMENTS:
            for _ in range(size):
                squad.append(rand_unit(rand_element(), kind))

        else:
            for _ in range(size):
                squad.append(rand_unit(suit, kind))

    else:
        if not suit in ELEMENTS:
            while squad.free_spaces >= 2:
                squad.append(rand_unit(rand_element()))
            if squad.free_spaces == 1:
                squad.append(rand_unit(rand_element(), kind="Scient"))
        else:
            while squad.free_spaces >= 2:
                squad.append(rand_unit(suit))
            if squad.free_spaces == 1:
                squad.append(rand_unit(suit, kind="Scient"))
    squad.name = rand_string()
    return squad