Esempio n. 1
0
def test_point2upoint():
    assert point2upoint({a: 0, b: 0, c: 0, d: 0}) == ({a.uniqid, b.uniqid, c.uniqid, d.uniqid}, set()       )
    #assert point2upoint({a: 1, b: 0, c: 0, d: 0}) == ({   2, 3, 4}, {1         })
    #assert point2upoint({a: 0, b: 1, c: 0, d: 0}) == ({1,    3, 4}, {   2      })
    #assert point2upoint({a: 1, b: 1, c: 0, d: 0}) == ({      3, 4}, {1, 2      })
    #assert point2upoint({a: 0, b: 0, c: 1, d: 0}) == ({1, 2,    4}, {      3   })
    assert point2upoint({a: 1, b: 0, c: 1, d: 0}) == ({   b.uniqid,    d.uniqid}, {a.uniqid,    c.uniqid   })
    #assert point2upoint({a: 0, b: 1, c: 1, d: 0}) == ({1,       4}, {   2, 3   })
    #assert point2upoint({a: 1, b: 1, c: 1, d: 0}) == ({         4}, {1, 2, 3   })
    #assert point2upoint({a: 0, b: 0, c: 0, d: 1}) == ({1, 2, 3   }, {         4})
    #assert point2upoint({a: 1, b: 0, c: 0, d: 1}) == ({   2, 3   }, {1,       4})
    assert point2upoint({a: 0, b: 1, c: 0, d: 1}) == ({a.uniqid,    c.uniqid   }, {   b.uniqid,    d.uniqid})
    #assert point2upoint({a: 1, b: 1, c: 0, d: 1}) == ({      3   }, {1, 2,    4})
    #assert point2upoint({a: 0, b: 0, c: 1, d: 1}) == ({1, 2      }, {      3, 4})
    #assert point2upoint({a: 1, b: 0, c: 1, d: 1}) == ({   2      }, {1,    3, 4})
    #assert point2upoint({a: 0, b: 1, c: 1, d: 1}) == ({1         }, {   2, 3, 4})
    assert point2upoint({a: 1, b: 1, c: 1, d: 1}) == (set()       , {a.uniqid, b.uniqid, c.uniqid, d.uniqid})
Esempio n. 2
0
def test_point2upoint():
    assert point2upoint({a: 0, b: 0, c: 0, d: 0}) == ({aa, bb, cc, dd}, set())
    assert point2upoint({a: 1, b: 0, c: 0, d: 0}) == ({bb, cc, dd}, {aa})
    assert point2upoint({a: 0, b: 1, c: 0, d: 0}) == ({aa, cc, dd}, {bb})
    assert point2upoint({a: 1, b: 1, c: 0, d: 0}) == ({cc, dd}, {aa, bb})
    assert point2upoint({a: 0, b: 0, c: 1, d: 0}) == ({aa, bb, dd}, {cc})
    assert point2upoint({a: 1, b: 0, c: 1, d: 0}) == ({bb, dd}, {aa, cc})
    assert point2upoint({a: 0, b: 1, c: 1, d: 0}) == ({aa, dd}, {bb, cc})
    assert point2upoint({a: 1, b: 1, c: 1, d: 0}) == ({dd}, {aa, bb, cc})
    assert point2upoint({a: 0, b: 0, c: 0, d: 1}) == ({aa, bb, cc}, {dd})
    assert point2upoint({a: 1, b: 0, c: 0, d: 1}) == ({bb, cc}, {aa, dd})
    assert point2upoint({a: 0, b: 1, c: 0, d: 1}) == ({aa, cc}, {bb, dd})
    assert point2upoint({a: 1, b: 1, c: 0, d: 1}) == ({cc}, {aa, bb, dd})
    assert point2upoint({a: 0, b: 0, c: 1, d: 1}) == ({aa, bb}, {cc, dd})
    assert point2upoint({a: 1, b: 0, c: 1, d: 1}) == ({bb}, {aa, cc, dd})
    assert point2upoint({a: 0, b: 1, c: 1, d: 1}) == ({aa}, {bb, cc, dd})
    assert point2upoint({a: 1, b: 1, c: 1, d: 1}) == (set(), {aa, bb, cc, dd})
Esempio n. 3
0
def test_point2upoint():
    assert point2upoint({a: 0, b: 0, c: 0, d: 0}) == ({aa, bb, cc, dd}, set())
    assert point2upoint({a: 1, b: 0, c: 0, d: 0}) == ({bb, cc, dd}, {aa})
    assert point2upoint({a: 0, b: 1, c: 0, d: 0}) == ({aa, cc, dd}, {bb})
    assert point2upoint({a: 1, b: 1, c: 0, d: 0}) == ({cc, dd}, {aa, bb})
    assert point2upoint({a: 0, b: 0, c: 1, d: 0}) == ({aa, bb, dd}, {cc})
    assert point2upoint({a: 1, b: 0, c: 1, d: 0}) == ({bb, dd}, {aa, cc})
    assert point2upoint({a: 0, b: 1, c: 1, d: 0}) == ({aa, dd}, {bb, cc})
    assert point2upoint({a: 1, b: 1, c: 1, d: 0}) == ({dd}, {aa, bb, cc})
    assert point2upoint({a: 0, b: 0, c: 0, d: 1}) == ({aa, bb, cc}, {dd})
    assert point2upoint({a: 1, b: 0, c: 0, d: 1}) == ({bb, cc}, {aa, dd})
    assert point2upoint({a: 0, b: 1, c: 0, d: 1}) == ({aa, cc}, {bb, dd})
    assert point2upoint({a: 1, b: 1, c: 0, d: 1}) == ({cc}, {aa, bb, dd})
    assert point2upoint({a: 0, b: 0, c: 1, d: 1}) == ({aa, bb}, {cc, dd})
    assert point2upoint({a: 1, b: 0, c: 1, d: 1}) == ({bb}, {aa, cc, dd})
    assert point2upoint({a: 0, b: 1, c: 1, d: 1}) == ({aa}, {bb, cc, dd})
    assert point2upoint({a: 1, b: 1, c: 1, d: 1}) == (set(), {aa, bb, cc, dd})
Esempio n. 4
0
    poss_prules = [[And(~p, ~c)], [And(~p, ~v)]]
    suffix = '3_nefariousvots'

# find all possible species of individuals
# ---

tt = expr2truthtable(f)  # truth table, each truth is one possible individual

poss_behs = list()  # create a list of possible behaviours
for row in tt.iter_relation():  # for each row in the truth table

    if row[1].is_one():  # if this row is a true in the table

        # point2upoint creates something like (frozenset({1, 3, 5}), frozenset())
        # where the first set is false variables and the second set is true variables
        upoint = point2upoint(row[0])
        vv = [~uniqid2evar[u]
              for u in upoint[0]] + [uniqid2evar[u] for u in upoint[1]]
        poss_behs.append(And(*vv))

# awarder rules
# ---
# beh_vrules: rules to do with the basic behaviour of the punisher
# pun_vrules: rules to do with the punishment behaviour of the punisher -- if any these behaviours are in the punisher rules then will not vote for punsiher

# only vote for punishers
poss_beh_vrules = [
    [p],
]

# NOTE for now the only pun_vrule is punishing self