 @MrAuer/

# Subtraction Towers Solver ## No description

Files
• main.py
main.py
```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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
```
```#Solves subtraction pyramids recursively

import itertools

#How many rows in the tower the program is looking for
#This now runs okay up to 5 lines on this website
lines = 4

#Calculates the largest number that can be used (ex: 3 in 2-row tower)
largest = lines * (lines + 1) / 2

def evalTopRow(tuple_of_top_row):
final_tuple = tuple_of_top_row
current_row = tuple_of_top_row
while len(current_row) > 1:
new_row = ()
for k in range(1,len(current_row)):
new_row += (abs(current_row[k] - current_row[k-1]),)
final_tuple += new_row
current_row = new_row
return final_tuple

"""
Checks to make sure tuple of answers is legit
"""
state = True
for k in itertools.combinations(tuple_of_answers,2):
if k == k or k > max or k > largest:
state = False
return state

"""
Prints a good solution in a reasonable way
"""
if len(tuple_of_answers) > 0: