mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-04-19 04:09:41 +00:00
Improve openings database code
This commit is contained in:
parent
b7667d1d40
commit
3b11b9d4f3
19 changed files with 3709 additions and 28331 deletions
|
@ -10,21 +10,32 @@ 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
|
||||
# a.tsv
|
||||
echo -n "static const char a_tsv[] =" > openings.hpp
|
||||
sed -i '1d' a.tsv # remove header
|
||||
cat a.tsv | sed -e "s/^/\"/g" -e "s/$/\\\n\"/g" -e '$ s/\\n"/";/g' >> openings.hpp;
|
||||
|
||||
# b.tsv
|
||||
echo -n "static const char b_tsv[] =" >> openings.hpp
|
||||
sed -i '1d' b.tsv
|
||||
cat b.tsv | sed -e "s/^/\"/g" -e "s/$/\\\n\"/g" -e '$ s/\\n"/";/g' >> openings.hpp;
|
||||
|
||||
# c.tsv
|
||||
echo -n "static const char c_tsv[] =" >> openings.hpp
|
||||
sed -i '1d' c.tsv
|
||||
cat c.tsv | sed -e "s/^/\"/g" -e "s/$/\\\n\"/g" -e '$ s/\\n"/";/g' >> openings.hpp;
|
||||
|
||||
# d.tsv
|
||||
echo -n "static const char d_tsv[] =" >> openings.hpp
|
||||
sed -i '1d' d.tsv
|
||||
cat d.tsv | sed -e "s/^/\"/g" -e "s/$/\\\n\"/g" -e '$ s/\\n"/";/g' >> openings.hpp;
|
||||
|
||||
# e.tsv
|
||||
echo -n "static const char e_tsv[] =" >> openings.hpp
|
||||
sed -i '1d' e.tsv
|
||||
cat e.tsv | sed -e "s/^/\"/g" -e "s/$/\\\n\"/g" -e '$ s/\\n"/";/g' >> openings.hpp;
|
||||
|
||||
# Save
|
||||
mv openings.hpp "$dst"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue