black-hole-solitaire / black-hole-solitaire / all-in-a-row-range-solving / find-intractables.vala

class Demo.HelloWorld : GLib.Object {

    public static int main(string[] args)
    {
        try
        {
            for (int deal = 1; deal <= 1000000 ; deal++)
            {
                if (deal % 1000 == 0)
                {
                    stderr.printf("Reached %d\n", deal);
                }
                string fn = deal.to_string() + ".rs";
                // stdout.printf("%s\n", fn);
                
                var file = File.new_for_path(fn);

                if (file.query_exists(null))
                {
                    var in_stream = new DataInputStream (file.read (null));
                    string line = in_stream.read_line(null,null);

                    if (line != null)
                    {
                        if (/^Intract/.match(line))
                        {
                            stdout.printf("%s is intractable.\n", fn);
                        }
                    }
                    else
                    {
                        stdout.printf("%s is empty.\n", fn);
                    }
                }
                else
                {
                    stdout.printf("%s is missing.\n", fn);
                }
            }
        }
        catch (Error e) 
        {
            error ("%s", e.message);
        }

        return 0;
    }
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.