aboutsummaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
Diffstat (limited to 'resources')
-rwxr-xr-xresources/do_buildroot.sh2
-rwxr-xr-xresources/extract.sh68
2 files changed, 1 insertions, 69 deletions
diff --git a/resources/do_buildroot.sh b/resources/do_buildroot.sh
index 2df2e76..9933469 100755
--- a/resources/do_buildroot.sh
+++ b/resources/do_buildroot.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# This file is part of ct1986
+# This file is part of ctak1986
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/resources/extract.sh b/resources/extract.sh
deleted file mode 100755
index 346547e..0000000
--- a/resources/extract.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/bash
-
-db_file=games_anon.db
-
-#chosen_players="AaaarghBot Tiltak_Bot TakticianBot"
-chosen_players=""
-
-query() {
- query="(size == $1) and (result != '1-0') and (result != '0-1') and (result != '0-0') and (result != '1/2-1/2')"
- selct=""
- for player in $chosen_players; do
- selct="$selct(player_black = '$player') or (player_white = '$player') or "
- done;
- if [ -n "$selct" ]; then
- query="$query and (${selct:0:-4})"
- fi
- echo "SELECT $2 FROM games WHERE $query;"
-}
-
-extract() {
- size="$1"
- things="$2"
- if [ ! -f "data/$db_file" ]; then
- wget "https://www.playtak.com/games_anon.db" -O "data/$db_file"
- fi
- echo Extracing games of size "$size" with query: "$(query $size $things)"
- sqlite3 "data/$db_file" "$(query $size $things)" | shuf > "data/playtak-$size"
-}
-
-prepare() {
- size=$1
- ./pptdb "$size" "data/playtak-$size" > "data/check-$size"
- tail -n22 "data/check-$size"
- echo -ne "\tStripping overflows and illegal games... "
- grep -Fvxf "data/check-$size" "data/playtak-$size" > "data/good-playtak-$size-all"
- shuf "data/good-playtak-$size-all" > "data/good-playtak-$size"
- rm "data/good-playtak-$size-all"
-
- echo -en "Done.\n\tGenerating training data... "
- ./pptdb "$size" "data/good-playtak-$size" generate
-}
-
-process() {
- size=$1
- num_t=$2
- num_v=$3
- total=$(( num_t + num_v ))
-
- echo -en "\tChoosing $num_t + $num_v = $total of $(wc -l data/parsed-$size.csv | cut -d\ -f1) samples... "
- shuf -n $total "data/parsed-$size.csv" > "data/shuf-$size.csv"
- head -n $num_t "data/shuf-$size.csv" > "data/training-$size.csv"
- tail -n $num_v "data/shuf-$size.csv" > "data/validation-$size.csv"
-
- echo "Done. "
-}
-
-if [ ! -d data ]; then
- mkdir data
-fi
-
-make pptdb
-
-for size in 5 6; do
- echo
- extract $size notation,result
- prepare $size
- process $size 1000000 20000
-done