Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __author__ = 'marius'
- Prob = [[[[[0]]]], [[[[0]]], [[[0]], [[0], [0, 1, 2], [0, 1, 2]], [[0], [0, 1, 2], [0, 1, 2]]],
- [[[0]], [[0], [0, 1, 2], [0, 1, 2]], [[0], [0, 1, 2], [0, 1, 2]]]],
- [[[[0]]], [[[0]], [[0], [0, 1, 2], [0, 1, 2]], [[0], [0, 1, 2], [0, 1, 2]]],
- [[[0]], [[0], [0, 1, 2], [0, 1, 2]], [[0], [0, 1, 2], [0, 1, 2]]]]]
- "Lea: Prob = [[[[[[2, 0.5]]]]], [[[[[1, 0.0]]]], [[[[1, 0.0]]], [[[1, 1.0]], [0, 1, 2], [0, [2, 1.0], [1, 1.0]]], [[0], [0, 1, [2, 0.0]], [0, [1, 1.0], [1, 0.0]]]], [[[[1, 1.0]]], [[0], [0, [2, 1.0], 2], [0, [3, 0.3333], [1, 1.0]]], [[0], [0, [1, 0.0], 2], [0, [1, 1.0], [2, 0.5]]]]], [[[[[1, 0.0]]]], [[[0]], [[0], [[1, 1.0], 1, [3, 0.3333]], [0, 1, [1, 1.0]]], [[[1, 1.0]], [0, [2, 0.5], [2, 0.0]], [0, 1, [1, 0.0]]]], [[[0]], [[0], [0, [2, 0.5], [1, 1.0]], [[1, 1.0], [1, 1.0], 2]], [[0], [0, [1, 1.0], [2, 0.5]], [0, [2, 0.5], [2, 0.5]]]]]]"
- "Vilde: Prob = [[[[[[8, 0.25]]]]], [[[[[6, 0.6667]]]], [[[[2, 0.5]]], [[[1, 1.0]], [0, [2, 1.0], [4, 0.5]], [0, [8, 0.75], [5, 0.6]]], [[0], [0, [5, 0.2], [7, 0.2857]], [0, [4, 0.0], [4, 0.75]]]], [[[[2, 1.0]]], [[[3, 1.0]], [[1, 1.0], [7, 0.8571], [5, 0.2]], [0, [2, 0.5], [9, 0.3333]]], [[0], [[1, 0.0], [5, 1.0], [8, 0.625]], [0, [7, 0.4286], [3, 0.3333]]]]], [[[[[2, 0.0]]]], [[[[4, 0.25]]], [[[1, 0.0]], [[1, 0.0], [4, 0.25], [8, 0.625]], [0, [3, 0.3333], [3, 0.0]]], [[[2, 1.0]], [[3, 1.0], [7, 0.8571], [4, 0.75]], [0, [10, 0.4], [4, 0.0]]]], [[[0]], [[[1, 0.0]], [0, [5, 0.0], [1, 1.0]], [[2, 1.0], [12, 0.5], [4, 0.5]]], [[0], [0, [1, 1.0], [9, 0.2222]], [0, [3, 0.0], 2]]]]]"
- "Marius: Prob = [[[[[[10, 0.6]]]]], [[[[[4, 0.25]]]], [[[[3, 0.6667]]], [[[1, 1.0]], [0, [1, 1.0], [4, 0.75]], [0, [8, 0.875], [7, 0.5714]]], [[[1, 1.0]], [[1, 1.0], [8, 0.625], [10, 0.5]], [0, [9, 0.4444], [8, 0.625]]]], [[[[4, 0.75]]], [[[1, 0.0]], [0, [9, 0.5556], [10, 0.3999]], [[3, 0.0], [2, 0.5], [11, 0.3636]]], [[[1, 1.0]], [0, [10, 0.7], [11, 0.3636]], [[1, 0.0], [9, 0.3332], [5, 0.8]]]]], [[[[[6, 0.3333]]]], [[[[1, 0.0]]], [[[2, 1.0]], [[1, 0.0], [4, 0.0], [11, 0.4545]], [[1, 1.0], [11, 0.6364], [9, 0.2222]]], [[[3, 0.0]], [0, [8, 0.875], [5, 0.8]], [[1, 0.0], [11, 0.5455], [7, 0.2857]]]], [[[[2, 0.5]]], [[0], [[2, 0.0], [5, 0.4], [9, 0.4444]], [0, [11, 0.2727], [8, 0.625]]], [[[1, 0.0]], [0, [6, 0.5], [8, 0.25]], [0, [5, 0.2], [2, 0.5]]]]]]"
- """b = None
- while b != "y" and b != "yes" and b != "n" and b != "no":
- b = input("Input probabilities? (y/n) ")
- if b == "y" or b == "yes":
- Prob = input("Enter prob:\n")
- print(str(Prob))"""
- Human = [0] * 5
- Predictability = [0, 0]
- def find(a): # H is the last a inputs in new-old order
- L = Prob
- global H
- H = Human[-5:]
- H.reverse()
- for n in H[:a]:
- L = L[n]
- for n in range(5 - a):
- L = L[0]
- if a == 0:
- if type(L) == int: ###
- print("!!!" + "X" * 32) ###
- elif type(L) is int: # Will nest to find non-0
- Prob[H[0]][H[1]][H[2]][H[3]][H[4]] = [0, 0]
- return find(a - 1)
- elif len(L) == 1 or L == [0, 0]:
- return find(a - 1)
- print(" " * 18 + str(L))
- if a == 5:
- L.append(L)
- print(L)
- return L
- else:
- return [0, 0, L]
- while True:
- Chance = find(5)
- I = input(
- "..." + str(Human[-5]) + ", " + str(Human[-4]) + ", " + str(Human[-3]) + ", " + str(Human[-2]) + ", " + str(
- Human[-1]) + ", ")
- # Can be shortened
- if not (I == "1" or I == "2"):
- J = input("Terminate? ")
- J.lower()
- if J == "y" or J == "yes":
- print(("_" * 64 + "\n") * 3)
- break
- print("Resuming..")
- continue
- I = int(I)
- Predictability[0] += 1
- if I == 1:
- Predictability[1] += 1 - Chance[2][1]
- if I == 2:
- Predictability[1] += Chance[2][1]
- Chance[1] = float(Chance[1]) * int(Chance[0]) + I - 1
- Chance[0] += 1
- Chance[1] = round((Chance[1] / Chance[0]), 4)
- Prob[Human[-1]][Human[-2]][Human[-3]][Human[-4]][Human[-5]] = Chance[:2]
- print("-" * 32 + "\n" + "-" * 32)
- print(Predictability)
- Human.append(I)
- J = input("Print Prob? ")
- J.lower()
- if J == "y" or J == "yes":
- print("\n" + str(Prob), end="\n")
- print(str(Predictability[0]) + " inputs\n" + str(round(Predictability[1] / Predictability[0] * 1000)) + " ‰ predictable")
Advertisement
Add Comment
Please, Sign In to add comment