File: process-982-dump.rb

package info (click to toggle)
freecell-solver 3.26.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,864 kB
  • ctags: 3,658
  • sloc: ansic: 34,721; perl: 12,320; xml: 5,999; python: 1,149; sh: 965; ruby: 347; cpp: 304; makefile: 151
file content (27 lines) | stat: -rw-r--r-- 825 bytes parent folder | download | duplicates (2)
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
File.open("982.dump", "r") do |file|
    # Position of the first line like that.
    file.seek(834785485)
    while (l = file.gets)
        if (l == "Depth: 68\n") then
            while (not l =~ /^Foundations: /)
                l = file.gets
            end
            board = l + ""
            while (l =~ /\S/)
                l = file.gets
                board += l
            end
            board.gsub!(/^: /, '')
            puts "Processing: <<<\n#{board}\n>>>\n"
            IO.popen("./fc-solve --freecells-num 2 -to 01ABCDE -sp r:tf -p -t -sam -", "r+") { |io|
            # IO.popen("cat -", "r+") { |io|
                io.print(board)
                io.close_write()
                while (fcs_line = io.gets)
                    print fcs_line
                end
            }

        end
    end
end