forked from Math-Engine/TestRun-1-Mystic-ov-26-with-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.py
68 lines (52 loc) · 2.71 KB
/
script.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import json
import sys
import os
sys.set_int_max_str_digits(2147483647)
param = int(sys.argv[1])
os.system(f'git pull -f')
with open('max.json', 'r') as f:
max_json = json.load(f)
print(json.dumps(max_json, indent="\t"))
with open('result.json', 'r') as f:
result_json = json.load(f)
print(json.dumps(result_json, indent="\t"))
max_json['a'] = int(max_json['a']) + 1
start_max_a = max_json['a']
max_json['b'] = int(max_json['b']) + 1
start_max_b = max_json['b']
max_json['c'] = int(max_json['c']) + 1
start_max_c = max_json['c']
max_json['d'] = int(max_json['d']) + 1
start_max_d = max_json['d']
number_of_changes_to_result = 0
for a in range(int(max_json['a']), int(max_json['a']) + param):
for b in range(int(max_json['b']), int(max_json['b']) + param):
for c in range(int(max_json['c']), int(max_json['c']) + param):
for d in range(int(max_json['d']), int(max_json['d']) + param):
if a**c - b**d == 2 and c > 1 and d > 1:
print(str(a) + "^" + str(c) + " - " + str(b) + "^" + str(d))
number_of_changes_to_result = number_of_changes_to_result + 1
temp_result = {}
temp_result["a"] = str(a)
temp_result["b"] = str(b)
temp_result["c"] = str(c)
temp_result["d"] = str(d)
result_json.append(temp_result)
max_json["a"] = str(a)
max_json["b"] = str(b)
max_json["c"] = str(c)
max_json["d"] = str(d)
with open('max.json', 'w') as max_file:
json.dump(max_json, max_file, indent=" ")
with open('result.json', 'w') as result_file:
json.dump(result_json, result_file, indent=" ")
os.system(f'git config user.name "github-actions[bot]"')
os.system(f'git config user.email "github-actions[bot]@users.noreply.github.com"')
os.system(f'git add .')
os.system(f'echo "a = <code>{start_max_a}</code> => <code>{max_json['a']}</code><br> b = <code>{start_max_b}</code> => <code>{max_json['b']}</code><br> c = <code>{start_max_c}</code> => <code>{max_json['c']}</code><br> d = <code>{start_max_d}</code> => <code>{max_json['d']}</code>" >> $GITHUB_STEP_SUMMARY')
if number_of_changes_to_result == 0:
commit_message = f"({start_max_a}, {start_max_b}, {start_max_c}, {start_max_d}) ~ ({max_json["a"]}, {max_json["b"]}, {max_json["c"]}, {max_json["d"]}) [{param ** 4}] 까지 확인한 결과, 해가 없음"
else:
commit_message = f"({start_max_a}, {start_max_b}, {start_max_c}, {start_max_d}) ~ ({max_json["a"]}, {max_json["b"]}, {max_json["c"]}, {max_json["d"]}) [{param ** 4}] 까지 확인한 결과, {number_of_changes_to_result}개의 해를 찾음"
os.system(f'git commit --allow-empty -m "' + commit_message + '"')
os.system(f'git push')