File: 982_dbm_total.bash

package info (click to toggle)
freecell-solver 3.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,332 kB
  • sloc: ansic: 29,493; perl: 8,911; xml: 5,162; python: 1,124; sh: 777; ruby: 358; cpp: 304; makefile: 150
file content (58 lines) | stat: -rw-r--r-- 1,678 bytes parent folder | download
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
#!/bin/bash

# Parameters for the deal:
deal_idx=982

# Some preferences
delta_limit="40,000,000"
count_items_in_queue="5,000"
cache_size="40,000,000"

board="$deal_idx.board"

if ! test -e "$board" ; then
    pi-make-microsoft-freecell-board -t "$deal_idx" > "$board"
fi

let iter=0

cache_size="${cache_size//,/}"
pre_cache_dummy_size="1000"
caches_delta="$(($cache_size - $pre_cache_dummy_size))"

while true; do

    intermediate_output="out-$deal_idx-$iter.txt"
    intermediate_output_processed="out-$deal_idx-$iter-proc.txt"
    get_proc=''

    if test \( \! -e "$intermediate_output_processed" \) -o \( $iter -eq 0 \) ; then

        if test $iter -gt 0 ; then
            get_proc="--intermediate-input $previous_intermediate_input"
        fi
        if ! ./dbm_fc_solver -o "$intermediate_output" \
            $get_proc \
            --iters-delta-limit "${delta_limit//,/}" \
            --max-count-of-items-in-queue "${count_items_in_queue//,/}" \
            --pre-cache-max-count "$pre_cache_dummy_size" \
            --caches-delta "$caches_delta" \
            --num-threads 1 \
            982.board ; then
            echo "Error in iter $iter!" 1>2
            exit 1
        fi
        perl scripts/dbm-process.pl "$intermediate_output" \
            > "$intermediate_output_processed"
        if ! test -s "$intermediate_output_processed" ; then
            echo "No solution was found at iter ${iter}"
            exit 0
        fi
    elif ! test -s "$intermediate_output_processed" ; then
        echo "No solution was found at iter ${iter}"
        exit 0
    fi

    let iter++
    previous_intermediate_input="$intermediate_output_processed"
done