all stats

farishafizhan's stats

guessed the most

namecorrect guessesgames togetherratio

were guessed the most by

namecorrect guessesgames togetherratio

entries

round #29

submitted at
0 likes

guesses
comments 0

post a comment


round29.py ASCII text, with CRLF line terminators
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
def entry(rule, state):
    rule_dict = {
        '111': 0,
        '110': 0,
        '101': 0,
        '100': 0,
        '011': 0,
        '010': 0,
        '001': 0,
        '000': 0
    }
    rule = f'{rule:08b}'[::-1]

    for i in range(8):
        rule_dict[f'{i:03b}'] = bool(int(rule[i]))
    
    print(rule_dict)

    state = '0' + ''.join(['1' if i else '0' for i in state]) + '0'

    new_state = []

    for i in zip(state, state[1:], state[2:]):
        i = ''.join(i)
        new_state.append(rule_dict[i])

    return new_state