-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake.py
31 lines (29 loc) · 834 Bytes
/
make.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
# Only one large file is accepted, I use a scipt to combine them
files = [
'checkers/checkers.h',
'checkers/checker_engine.h',
'mcts/mcts.h',
'mcts/tree.h',
'mcts/msws.h',
'checkers/checker_engine.c',
'mcts/tree.c',
'mcts/msws.c',
'oj/oj.c']
outfile = 'combined.c'
preamble = """/*
* This file is automatically combined to be submitted to oj.
* Also on my repo
* https://github.com/melonedo/mcts-for-checkers
*/\n\n\n
"""
origin_format = "// ------ from {} ------\n"
import re
with open(outfile, 'wt') as outf:
outf.write(preamble);
for dir in files:
with open(dir, 'rt') as inf:
outf.write(origin_format.format(dir))
for line in inf:
if re.fullmatch('#include ".*"\n', line) is None:
outf.write(line)
print("Done")