Skip to content

Commit

Permalink
compelted project
Browse files Browse the repository at this point in the history
  • Loading branch information
saatviknagpal committed Feb 19, 2024
0 parents commit 90810b9
Show file tree
Hide file tree
Showing 55 changed files with 20,858 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/main_a-mazing-journey-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build and deploy JAR app to Azure Web App - a-mazing-journey-backend

on:
push:
paths:
- 'backend/**'
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Set up Java version
uses: actions/setup-java@v1
with:
java-version: '17'

- name: Build with Maven in backend
run: mvn clean install
working-directory: backend

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: java-app
path: 'backend/target/a-mazing-journey-backend.jar'


deploy:
runs-on: windows-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: java-app
working-directory: backend

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'a-mazing-journey-backend'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_12EF4EE9C6C641EFA72D001B30FB92ED }}
package: '*.jar'
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Denys Tsebulia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
119 changes: 119 additions & 0 deletions Python_Fundamentals.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"gpuType": "T4",
"authorship_tag": "ABX9TyNezBWilfob/w0MKaM8YNcL",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/d3nnyyy/A-MazingJourney/blob/main/Python_Fundamentals.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"source": [
"import torch\n",
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt"
],
"metadata": {
"id": "YA8GSQHc3SMy"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"### Introduction to Tensors\n",
"### Scalar"
],
"metadata": {
"id": "ZBid7fGY4QYi"
}
},
{
"cell_type": "code",
"source": [
"scalar = torch.tensor(7)\n",
"scalar"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "hzhwg5T148bR",
"outputId": "6fd8b173-aaca-423d-eda2-345833d336c5"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"tensor(7)"
]
},
"metadata": {},
"execution_count": 4
}
]
},
{
"cell_type": "code",
"source": [
"array = torch.tensor([1,2,3])\n",
"array"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "ocL4jhpB6BeH",
"outputId": "50125eca-f1a2-441a-aa1c-67fc5cdec0a3"
},
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"tensor([1, 2, 3])"
]
},
"metadata": {},
"execution_count": 5
}
]
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "hYRyhw376wfq"
},
"execution_count": null,
"outputs": []
}
]
}
86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# OptiMaze

Welcome to the OptiMaze! This project consists of a maze-solving game built with Spring Boot for the backend and React for the frontend. Players can navigate through a maze to reach the destination while visualizing their path and the optimal path. The project is deployed on Microsoft Azure, with Azure App Services for both the backend and frontend. Additionally, it manages continuous integration and deployment (CI/CD) using GitHub Actions for the backend and Azure DevOps Pipelines for the frontend.

## Table of Contents

- [Website](#website)
- [Technologies](#technologies)
- [Local Development](#local-development)
- [Dockerization](#dockerization)
- [API Documentation with Swagger](#api-documentation-with-swagger)
- [Usage](#usage)
- [Authors](#authors)
- [Contributing](#contributing)

## Technologies

### Backend

- Java 17
- Spring Boot
- JUnit
- Mockito
- Swagger
- Azure App Services

### Algorithms:

There are two main algorithms used:

1. The first algorithm is used for maze generating. It is a randomized depth-first search.
It goes through all the possible cells in unfilled maze, creating paths in random directions, until it fills every single cell. After that there is an algorithm that creates 'circles', which are actually just for making more possible paths from start to finish.
2. The second algorithm is used for maze solving. It is a breadth-first search.
It goes through all the cells and all the passages one-by-one, filling cells with distances from current cell to start. It does that until it reaches the finish. After that the algorithm goes from finish to start, choosing the cell with the shortest distance to the start each time. That's how the shortest path is found.

### Frontend

- React.js
- Material UI
- Emotion
- Axios

### Continuous Integration and Deployment (CI/CD)

- GitHub Actions (Backend)
- Azure DevOps Pipelines (Frontend)

## Local Development

To run the project locally for development, follow these steps:

### Clone the repository to your local machine:

```bash
git clone https://github.com/saatviknagpal/OptiMaze.git
```

### Backend

1. Open the backend project located in the `backend` directory using an IDE or code editor.
2. Run `mvn clean install` to install dependencies.
3. Run `mvn spring-boot:run` to start the development server.

### Frontend

1. Open the frontend project located in the `frontend` directory using an IDE or code editor.
2. Run `npm install` to install dependencies.
3. Run `npm start` to start the development server.

_Note! Dont forget to change backend url for post requests as you want to test it locally._

## API Documentation with Swagger

We use Swagger to provide detailed documentation for the backend API. Swagger UI allows you to explore and interact with the API endpoints directly from a web interface.

After running the backend Docker container (as explained in the Dockerization section), you can access the Swagger UI at `http://localhost:8080/swagger-ui.html`.

Swagger UI provides a user-friendly way to visualize and test the API endpoints. It's a great tool for developers and testers to understand the available routes and their inputs/outputs.

## Usage

You can access the OptiMaze game through the provided URL. You can interact with the maze, navigate through it using keyboard inputs, and observe your chosen path alongside the optimal path. The game offers a visual representation of the maze-solving process, providing an engaging and educational experience.

## Contributing

If you're interested in contributing to OptiMaze, feel free to submit pull requests or issues on our GitHub repository. We welcome your feedback and contributions to enhance the game.
36 changes: 36 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
mvnw.cmd
mvnw
.mvn
4 changes: 4 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openjdk:17-oracle
COPY target/a-mazing-journey-backend.jar a-mazing-journey-backend.jar
EXPOSE 8080
CMD ["java", "-jar", "a-mazing-journey-backend.jar"]
15 changes: 15 additions & 0 deletions backend/buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 0.2

phases:
build:
commands:
- echo Entering the build phase...
- cd backend
- mvn clean package
post_build:
commands:
- echo Build completed successfully!
artifacts:
files:
- backend/target/a-mazing-journey-backend.jar
discard-paths: yes
Loading

0 comments on commit 90810b9

Please sign in to comment.