Skip to content

deepakvarma1536/Path_validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Path Validator

A Java depth-first search (DFS) project that checks whether a valid path exists from Start (S) to End (E) in a 2D grid.

What this project does

  • Reads a grid from console input.
  • Treats:
    • S as start
    • E as end
    • 0 as walkable cell
    • 1 as blocked cell (wall)
  • Runs DFS in 4 directions (up, down, left, right).
  • Prints:
    • Path Exists
    • No Path Exists

Project files

  • Main.java: Handles user input and runs the validator.
  • PathValidator.java: Contains DFS path-check logic.
  • index.html: Optional browser helper to generate/edit a grid and copy values for Java testing.

Requirements

  • Java 8 or newer

Compile and run

From this project folder, run:

javac Main.java PathValidator.java
java Main

Console input format

  1. Enter number of rows.
  2. Enter number of columns.
  3. Enter each row as a string of characters with no spaces.

Example for a 3x3 grid:

Rows: 3
Columns: 3
Row 0: S01
Row 1: 001
Row 2: 00E

In this example, output should be:

Path Exists

Browser helper (index.html)

Open index.html in a browser to:

  • Generate a random grid
  • Edit cells (S, E, 0, 1)
  • View grid values to use as test input in Java

This page is a helper UI and does not run the Java code directly.

Notes

  • Ensure the grid has at least one S and one E.
  • If there are multiple S or E cells, behavior is based on the first S found and any E reachable from it.

MazeEscapePlanner

MazeEscapePlanner

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors