Coder Social home page Coder Social logo

aggstam / freecell_solver Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 38 KB

This program solves freecell solitaire puzzles using four algorithms: Depth first search, Breadth first search, Best first search and A*

License: Apache License 2.0

C 99.16% Makefile 0.84%
ai-algorithms c freecell-solver

freecell_solver's Introduction

freecell_solver

This program solves freecell solitaire puzzles using four algorithms:

  • Depth first search [1]
  • Breadth first search [2]
  • Best first search [3]
  • A* [4]

Puzzles are read from an input file, while solution is written to an output file.
Max card number per stack is defined in the first line of the input file.
Three input files have been provided to play with.
Note: Breadth first search will result in OOM for max card number > 4.
This is due to algorithms nature, not implementation.

Usage

Make usage

% make

To use a different method:

% make METHOD={method}

To use a different input file:

% make FILE={input_file}

To configure output file name:

% make OUTPUT={output_file}

Direct usage

Compilation:

% gcc -o project_freecell project_freecell.c

Execution:

% ./project_freecell {method} {input_file} {output_file}

Execution example

❯ make
gcc -o project_freecell project_freecell.c
./project_freecell depth test_file_size_5.txt output.txt
Building puzzle with N: 5
Solving test_file_size_5.txt using depth...
Solution found! (30 steps)
Time spent: 0.001146 secs

References

[1] https://en.wikipedia.org/wiki/Depth-first_search
[2] https://en.wikipedia.org/wiki/Breadth-first_search
[2] https://en.wikipedia.org/wiki/Best-first_search
[2] https://en.wikipedia.org/wiki/A*_search_algorithm

freecell_solver's People

Contributors

aggstam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.