a-star-search

Created: 2011-07-09 19:13
Updated: 2015-02-13 02:03
c

README.md

ABOUT

This is collection of C library data structures and a solution for the fifteen puzzle, using an A* Search.

TODO

  • Library:

    • Better comments, standard format
  • Fifteen Puzzle:

    • Must free memory allocated by the a-star-search

    • Must write unit tests for the solver

INSTALL

  • Install Check, a C testing framework.

  • Download source code.

  • In the a-star-search directory, compile the source files with:

    $ make
    
  • Also in the a-star-search directory, run the tests and ensure they all pass. To run library tests:

    $ make libcheck
    
  • To use the data structures, include the path to the src folder, and link the library object file directory. Here's an example including the linkedlist.h file and linking the lib/src/* folder

    In hello.c:

    /*
     * include the linkedlist header file
     */
    include "../lib/src/linkedlist.h"
    // ...
    

    When compiling:

    $ gcc -o hello hello.c ../lib/src/*.o
    

USAGE

On the command line in the directory with the solver executable, run it with:

  $ ./solver [--help] [--verbose] [--heuristic <hamming | manhattan>] <dim> <pos 1> <pos 2> ... <pos dim * dim>

Running solver with the --help flag will print this screen:

   arguments summary:
         --help                                        Displays this help text.
         --verbose                                     Displays verbose output when solving. This includes a GUI printout and the value of the distance metric.
         --heuristic <hamming | manhattan>             Heuristic metric to use for the A* search. Manhattan is default.
         <dim>                                         Dimension of the square board. If the dimension is n, then we have an n x n board.
         <pos k>                                       Number at position k, where starting from 1, we count left to right, up to down. Put a 0 to mark the empty spot.

SOURCE

a-star-search/
    README.md
    Makefile
    lib/
        src/
            Collection of data structure libraries, including linkedlist, arraylist, priorityqueue, stack, queue, and heap.
        tests/
            Collection of tests for these data structures, using the Check framework
    fifteen-puzzle/
        src/
            Implementation of an A* Search on the fifteen puzzle.
        tests/
            Tests for the fifteen puzzle solver

REFERENCES

README Markdown syntax:

Makefile tutorials:

C Macros:

C iterators:

C auto, static, extern

C arrays:

C function pointers:

Functional programming in C

Common C errors:

C error handling:

C Enums:

Dereferencing Void Pointers:

Printing with color

C Command Line Options

Fifteen Puzzle Parity

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more