aboutsummaryrefslogtreecommitdiff
path: root/tools/openings.sh
blob: b0f1e04ea11a006b4e91682ee51035b1acf8bc19 (plain)
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
#!/bin/bash
# OChess is using the lichess chess-openings database
# that can be found here: https://github.com/lichess-org/chess-openings

# Init variables
urldb="https://github.com/lichess-org/chess-openings"
tmp=$(mktemp -d)
wai=$(dirname $(readlink -f "$0")) # Current script directory
dst="${wai}/../src/binres/"

# Fetch database
git clone "$urldb" "$tmp"

# Generate c_str from database
cd $tmp
wxbin2c a.tsv a_tsv.hpp
wxbin2c b.tsv b_tsv.hpp
wxbin2c c.tsv c_tsv.hpp
wxbin2c d.tsv d_tsv.hpp
wxbin2c e.tsv e_tsv.hpp

# Combine c_str files
cat a_tsv.hpp > openings.hpp
cat b_tsv.hpp >> openings.hpp
cat c_tsv.hpp >> openings.hpp
cat d_tsv.hpp >> openings.hpp
cat e_tsv.hpp >> openings.hpp

# Save
mv openings.hpp "$dst"

# Cleaning
rm -rf "$tmp"