Giter VIP home page Giter VIP logo

izp-2's Introduction

Maze Solver

This program navigates through a maze defined in a text file using a rectangular matrix of integers. The objective is to print the coordinates of the path from the maze's entrance to its exit.

Compilation and Execution

Compile the program using:

$ gcc -std=c11 -Wall -Wextra -Werror maze.c -o maze

Run the program in the following ways:

./maze --help
./maze --test file.txt
./maze --rpath R C file.txt
./maze --lpath R C file.txt
./maze --shortest R C file.txt (Optional Premium Feature)
$ ./maze --shortest 3 7 bludiste.txt
3,7
2,7
2,6
2,5
2,4
1,4
1,3
1,2
1,1

Features

  • Maze Validation: Checks if the provided maze file is correctly formatted.
  • Pathfinding: Supports different algorithms to find a path using the right-hand or left-hand rules, or the shortest path.
  • Output: Prints a sequence of coordinates representing the path through the maze.

image

File Format

The maze is represented in a text file as a series of numbers:

  • The first two numbers define the dimensions of the maze.
  • Each subsequent line contains values for each cell, where a 3-bit value defines the boundaries of each triangular cell.

Example:

6 7
1 4 4 2 5 0 6
1 4 4 0 4 0 2
1 0 4 0 4 6 1
1 2 7 1 0 4 2
3 1 4 2 3 1 2
4 2 5 0 4 2 5

Example Input and Output

Mazes are solved by providing starting coordinates, and the program outputs the sequence of moves to navigate through the maze.

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.