Skip to content

nguyenquan24/AWING-Interview

Repository files navigation

Treasure Hunt Solver

A web application that helps find the optimal path to collect treasures with minimum fuel consumption.

Running Locally

Prerequisites

Before running the application locally, you need to install:

  1. .NET 8.0 SDK

  2. Node.js (v18 or later)

  3. SQL Server

Backend (API)

  1. Navigate to the API project directory:

    cd TreasureHunt.API
  2. Make sure you have installed EF Core CLI:

    dotnet tool install --global dotnet-ef
  3. Create and update the database:

    dotnet ef database update
  4. Start the API:

    dotnet run

    The API will start at: https://localhost:7294

Frontend

  1. Navigate to the frontend project directory:

    cd TreasureHunt.Frontend
  2. Install dependencies:

    npm install
  3. Start the frontend application:

    npm start

    The application will open at: http://localhost:3000

Running with Docker

If you don't want to install the prerequisites, you can run the application using Docker:

  1. Install Docker

  2. Run the Application

    • Open a terminal in the project root directory
    • Run the following commands:
    docker-compose up -d --build
    • Wait for the containers to start (this might take a few minutes on first run)
    • Open your browser and navigate to: http://localhost
  3. Stop the Application

    docker-compose down

Using the Application

image

  1. Enter Matrix Dimensions

    • Rows (N): Enter the number of rows (maximum 500)
    • Columns (M): Enter the number of columns (maximum 500)
    • Max Chest Number (P): Enter the maximum chest number (maximum N*M)
  2. Fill the Treasure Map Matrix

    • Enter numbers from 1 to P in the matrix cells
    • Each number represents a chest that must be collected in sequence
  3. Solve

    • Click the "SOLVE" button to find the optimal path
    • The result will show the minimum fuel needed
  4. View History

    • Previous solutions are saved and displayed below
    • Each entry shows the matrix size, number of chests, and result

Troubleshooting

  • If you see a database connection error, ensure SQL Server is running
  • If the frontend can't connect to the API, check if both applications are running
  • For Docker issues, try:
    docker-compose down
    docker system prune -f
    docker-compose up -d --build

Support

If you encounter any issues or need help, please create an issue in the repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors