Skip to content

Commit

Permalink
Added new Project - N_Queen and also updated index.js file in Main (#525
Browse files Browse the repository at this point in the history
)

## Related Issue

[Cite any related issue(s) this pull request addresses. If none, simply
state "None”]
write issue no. here




## Description

[Please include a brief description of the changes or features added]

## Type of PR

- [ ] Bug fix
- [ ] Feature enhancement
- [ ] Documentation update
- [ ] Security enhancement
- [ ] Other (specify): _______________


check in issue by entering [X] in boxes

## Screenshots / Videos (if applicable)

[Attach any relevant screenshots or videos demonstrating the changes]

## Checklist
- [ ] I have performed a self-review of my code.
- [ ] I have read and followed the Contribution Guidelines.
- [ ] I have tested the changes thoroughly before submitting this pull
request.
- [ ] I have provided relevant issue numbers, screenshots, and videos
after making the changes.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have followed the code style guidelines of this project.
- [ ] I have checked for any existing open issues that my pull request
may address.
- [ ] I have ensured that my changes do not break any existing
functionality.
- [ ] Each contributor is allowed to create a maximum of 4 issues per
day. This helps us manage and address issues efficiently.
- [ ] I have read the resources for guidance listed below.
- [ ] I have followed security best practices in my code changes.

check in issue by entering [X] in boxes
## Additional Context

[Include any additional information or context that might be helpful for
reviewers.]




## Contribution Guidelines

Thank you for considering contributing to our project! To ensure smooth
collaboration and effective contribution management, please adhere to
the following guidelines:

### Issue Creation

1. **Limit on Issues:**
- Each contributor is allowed to create a maximum of **4 issues per
day**. This helps us manage and address issues efficiently.

### Contribution Levels

2. **Basic Contributions:**
- This project is primarily focused on documentation. Most of the setup
has been completed, so contributors will generally need to work on basic
code tasks, such as writing tests.
   - For these tasks, issues will be assigned the **Easy** label.

3. **Acknowledging Hard Work:**
- If a contributor puts in significant effort on a task, the issue will
be upgraded to **Medium**. This is our way of recognizing and
appreciating extra effort.

4. **Feature Additions and Component Work:**
- Contributors working on new features or components using JSX/TSX will
be assigned a level based on the complexity and quality of their work.
- The more complex and valuable the contribution, the higher the level
assigned.

### Level Definitions

- **Easy:**
- Tasks are straightforward, such as fixing minor bugs, writing tests,
or making simple documentation updates.
- **Medium:**
- Tasks require more effort, such as addressing complex bugs, improving
existing features, or making substantial documentation improvements.
- **Hard:**
- Tasks are highly complex and involve significant new feature
development, major refactoring, or extensive contributions to the
project’s core components.

We look forward to your contributions and appreciate your effort in
helping us improve the project!
  • Loading branch information
dhairyagothi authored Jan 14, 2025
2 parents c1c544e + 1d38760 commit f9c59d6
Show file tree
Hide file tree
Showing 4 changed files with 249 additions and 3 deletions.
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ document.addEventListener('DOMContentLoaded', fillTable());
function fillTable(){




data = [["Day 1","To-Do List"," /public/TO_DO_LIST/todolist.html"],["Day 2","Digital Clock"," /public/digital_clock/digitalclock.html"],["Day 3","Indian Flag"," /public/indianflag/flag.html"],["Day 4","Dropdown Nav Bar"," /public/dropdown_navbar/index.html"],["Day 5","Animated Cursor"," /public/Animated-cursor/animated-cursor.html"],["Day 6","Auto Background Image Slider"," /public/Background-Image-sider/slider.html"],["Day 7","Typewriter"," /public/typewriter/typewriter.html"],["Day 8","Parallel-X Website"," /public/Parallel-x%20website/parallal.html"],["Day 9","Captcha Generator"," /public/captcha/captcha.html"],["Day 10","QR Code Generator"," /public/qr%20generator/qr.html"],["Day 11","Serve Website Using Express"," /public/index.html"],["Day 12","Nodemailer Contact Form"," /public/gmail_nodemailer/public/mail.html"],["Day 13","Login Form Using MERN","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/loginusingmern"],["Day 14","File Uploader","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/file_uploader"],["Day 15","Progress Bar"," /public/progress_bar/progress_bar.html"],["Day 16","Scroll Bar CSS"," /public/index.html"],["Day 17","Slider Using Swiper API"," /public/slider%20box/index.html"],["Day 18","Carousel Solar System"," /public/carousal/index.html"],["Day 19","Planto"," /public/plantwebsite/plant.html"],["Day 20","EveSparks"," /public/https://evesparks.onrender.com/"],["Day 21","Video BG Slider Using React"," /public/https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/travel_website"],["Day 22","Page Loader"," /public/pageloader/pageloader.html"],["Day 23","Jarvis Virtual Assistant"," /public/Jarvis-AI-main/index.html"],["Day 24","Chat Bot"," /public/AI%20ChatBot/chatbot.html"],["Day 25","Tic-Tac-Toe"," /public/TicTacToe/index.html"],["Day 26","Maze Game"," /public/Maze-Game-main/index.html"],["Day 27","Memory Game"," /public/MemoryGame/index.html"],["Day 28","Wordle"," /public/WORDLE/index.html"],["Day 29","Snake Game"," /public/snake_game/index.html"],["Day 30","Flappy-bird-game"," /public/Flappy-bird-main/index.html"],["Day 31","Password Manager"," /public/password%20manager/index.html"],["DAY-32","Missionaries & Cannibals"," /public/Missionaries&Cannibals/index.html"],["Day 33","Weather Forcasting"," /public/Weather%20Forcasting/index.html"],["Day 34","Email Validator"," /public/email%20validator/index.html"],["Day 35","Vanilla-JavaScript-Calculator"," /public/Vanilla-JavaScript-Calculator-master/index.html"],["Day 36","Medical App"," /public/Medical_App/index.html"],["Day 37","2048 Game"," /public/2048_game/index.html"],["Day 38","Github Profile Finder","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/github_profile_finder"],["Day 39","Notes App"," /public/notes-app/index.html"],["Day 40","Analog Clock"," /public/AnalogClock/index.html"],["Day 41","Scroll Dark Game"," /public/Scroll%20Game%20Dark%20Run/index.html"],["Day 42","Amazon App"," /public/Amazon_Clone/index.html"],["Day 43","Password Generator"," /public/Password_Generator/index.html"],["Day 44","BMI Calculator"," /public/BMI_Calculator/index.html"],["Day 45","Black Jack"," /public/BlackJack/blackJ.html"],["Day 46","Palindrome Generator"," /public/Palindrome_Generator/index.html"],["Day 47","Ping Pong Game"," /public/ping/index.html"],["Day 48","TextToVoiceConverter"," /public/TextToVoiceConverter/index.html"],["Day 49","Url Shortener","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/url_shortener"],["Day 50","Recipe Genie","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/Recipe-Genie"],["Day 51","Netflix Landing Page Clone"," /public/Netflix_Cloning/Index.html"],["Day 52","ClimaCode"," /public/ClimaCode%202.0/index.html"],["Day 53","E-Commerce Website with Simple Cart Functionality"," /public/e-commerce_cart/index.html"],["Day 54","Budget Tracker"," /public/Budget%20Tracker/index.html"],["Day 55","Cricket Game"," /public/cricket/index.html"],["Day 56","Pastebin using svelte","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/pastebin"],["Day 57","Glowing Social Media Icons"," /public/Social%20Media%20Glowing/index.html"],["Day 58","Music App"," /public/Music%20App/index.html"],["Day 59","Blog Page"," /public/Blog%20Page/index.html"],["Day 60","Marketing template website"," /public/marketing_website/index.html"],["Day 61","Hologram Button"," /public/Holo%20Button/index.html"],["Day 62","Solar System Explorer"," /public/Solar%20System%20Explorer%20in%20CSS%20only%20haml/template.html"],["Day 63","Image to Text App"," /public/Image-To-Text-App/index.html"],["Day 64","Zomato-clone"," /public/zomato-clone/zomato.html"],["Day 65","The Cube"," /public/The%20Cube/index.html"],["Day 66","Flask Authentication App","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/flask_auth_app/README.md"],["Day 67","Blog-Website"," /public/blog/main.html"],["Day 68","3d Rotating Card"," /public/3d%20cards/index.html"],["Day 69","Spotify Clone Project"," /public/spotify-clone%20-project/index.html"],["Day 70","Insect-Catch_Game"," /public/Insect-Catch-Game/index.html"],["Day 71","Quotely Laughs"," /public/Quotely-Laughs/index.html"],["Day 72","Contact Book","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/Contact%20Book/README.md"],["Day 73","Candy_Crush_Game"," /public/Candy_Crush_Game/index.html"],["Day 74","Stock Profit Calculator"," /public/Stock-Profit-Calculator/index.html"],["Day 75","code-space-game project"," /public/code-jump-space-game/index.html"],["Day 76","Animated Searchbar"," /public/Animated%20Searchbar/index.html"],["Day 77","Rock-Paper-Scissor-game project"," /public/Stone-Paper-Scissor/index.html"],["Day 78","NPM Package Search"," /public/NPM%20Package%20Search/index.html"],["Day 79","Linkedin Homepage Clone"," /public/Linkedin-Clone/index.html"],["Day 80","Resume Studio"," /public/ResumeStudio/index.html"],["Day 81","Simon Says Game"," /public/Simon_Says_Game/index.html"],["Day 82","Love Calculator Game"," /public/Love-Calculator/index.html"],["Day 83","Exchange Currency"," /public/Exchange_Currency/index.html"],["Day 84","Lights Out Puzzle","/public/Lights_Out_Puzzle/index.html"],["Day 85", "Image Search Engine", "/public/Image Search Engine/index.html"],["Day 86","Profile Card","/public/3d profile Card/index.html"],["Day 87", "Breakout game", "/public/Breakout game/index.html"],["Day 88","Job dashboard","/public/Job dashboard/jobs.html"]]
data = [["Day 1","To-Do List"," /public/TO_DO_LIST/todolist.html"],["Day 2","Digital Clock"," /public/digital_clock/digitalclock.html"],["Day 3","Indian Flag"," /public/indianflag/flag.html"],["Day 4","Dropdown Nav Bar"," /public/dropdown_navbar/index.html"],["Day 5","Animated Cursor"," /public/Animated-cursor/animated-cursor.html"],["Day 6","Auto Background Image Slider"," /public/Background-Image-sider/slider.html"],["Day 7","Typewriter"," /public/typewriter/typewriter.html"],["Day 8","Parallel-X Website"," /public/Parallel-x%20website/parallal.html"],["Day 9","Captcha Generator"," /public/captcha/captcha.html"],["Day 10","QR Code Generator"," /public/qr%20generator/qr.html"],["Day 11","Serve Website Using Express"," /public/index.html"],["Day 12","Nodemailer Contact Form"," /public/gmail_nodemailer/public/mail.html"],["Day 13","Login Form Using MERN","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/loginusingmern"],["Day 14","File Uploader","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/file_uploader"],["Day 15","Progress Bar"," /public/progress_bar/progress_bar.html"],["Day 16","Scroll Bar CSS"," /public/index.html"],["Day 17","Slider Using Swiper API"," /public/slider%20box/index.html"],["Day 18","Carousel Solar System"," /public/carousal/index.html"],["Day 19","Planto"," /public/plantwebsite/plant.html"],["Day 20","EveSparks"," /public/https://evesparks.onrender.com/"],["Day 21","Video BG Slider Using React"," /public/https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/travel_website"],["Day 22","Page Loader"," /public/pageloader/pageloader.html"],["Day 23","Jarvis Virtual Assistant"," /public/Jarvis-AI-main/index.html"],["Day 24","Chat Bot"," /public/AI%20ChatBot/chatbot.html"],["Day 25","Tic-Tac-Toe"," /public/TicTacToe/index.html"],["Day 26","Maze Game"," /public/Maze-Game-main/index.html"],["Day 27","Memory Game"," /public/MemoryGame/index.html"],["Day 28","Wordle"," /public/WORDLE/index.html"],["Day 29","Snake Game"," /public/snake_game/index.html"],["Day 30","Flappy-bird-game"," /public/Flappy-bird-main/index.html"],["Day 31","Password Manager"," /public/password%20manager/index.html"],["DAY-32","Missionaries & Cannibals"," /public/Missionaries&Cannibals/index.html"],["Day 33","Weather Forcasting"," /public/Weather%20Forcasting/index.html"],["Day 34","Email Validator"," /public/email%20validator/index.html"],["Day 35","Vanilla-JavaScript-Calculator"," /public/Vanilla-JavaScript-Calculator-master/index.html"],["Day 36","Medical App"," /public/Medical_App/index.html"],["Day 37","2048 Game"," /public/2048_game/index.html"],["Day 38","Github Profile Finder","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/github_profile_finder"],["Day 39","Notes App"," /public/notes-app/index.html"],["Day 40","Analog Clock"," /public/AnalogClock/index.html"],["Day 41","Scroll Dark Game"," /public/Scroll%20Game%20Dark%20Run/index.html"],["Day 42","Amazon App"," /public/Amazon_Clone/index.html"],["Day 43","Password Generator"," /public/Password_Generator/index.html"],["Day 44","BMI Calculator"," /public/BMI_Calculator/index.html"],["Day 45","Black Jack"," /public/BlackJack/blackJ.html"],["Day 46","Palindrome Generator"," /public/Palindrome_Generator/index.html"],["Day 47","Ping Pong Game"," /public/ping/index.html"],["Day 48","TextToVoiceConverter"," /public/TextToVoiceConverter/index.html"],["Day 49","Url Shortener","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/url_shortener"],["Day 50","Recipe Genie","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/Recipe-Genie"],["Day 51","Netflix Landing Page Clone"," /public/Netflix_Cloning/Index.html"],["Day 52","ClimaCode"," /public/ClimaCode%202.0/index.html"],["Day 53","E-Commerce Website with Simple Cart Functionality"," /public/e-commerce_cart/index.html"],["Day 54","Budget Tracker"," /public/Budget%20Tracker/index.html"],["Day 55","Cricket Game"," /public/cricket/index.html"],["Day 56","Pastebin using svelte","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/pastebin"],["Day 57","Glowing Social Media Icons"," /public/Social%20Media%20Glowing/index.html"],["Day 58","Music App"," /public/Music%20App/index.html"],["Day 59","Blog Page"," /public/Blog%20Page/index.html"],["Day 60","Marketing template website"," /public/marketing_website/index.html"],["Day 61","Hologram Button"," /public/Holo%20Button/index.html"],["Day 62","Solar System Explorer"," /public/Solar%20System%20Explorer%20in%20CSS%20only%20haml/template.html"],["Day 63","Image to Text App"," /public/Image-To-Text-App/index.html"],["Day 64","Zomato-clone"," /public/zomato-clone/zomato.html"],["Day 65","The Cube"," /public/The%20Cube/index.html"],["Day 66","Flask Authentication App","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/flask_auth_app/README.md"],["Day 67","Blog-Website"," /public/blog/main.html"],["Day 68","3d Rotating Card"," /public/3d%20cards/index.html"],["Day 69","Spotify Clone Project"," /public/spotify-clone%20-project/index.html"],["Day 70","Insect-Catch_Game"," /public/Insect-Catch-Game/index.html"],["Day 71","Quotely Laughs"," /public/Quotely-Laughs/index.html"],["Day 72","Contact Book","https://github.com/dhairyagothi/50_days_50_web_project/tree/Main/public/Contact%20Book/README.md"],["Day 73","Candy_Crush_Game"," /public/Candy_Crush_Game/index.html"],["Day 74","Stock Profit Calculator"," /public/Stock-Profit-Calculator/index.html"],["Day 75","code-space-game project"," /public/code-jump-space-game/index.html"],["Day 76","Animated Searchbar"," /public/Animated%20Searchbar/index.html"],["Day 77","Rock-Paper-Scissor-game project"," /public/Stone-Paper-Scissor/index.html"],["Day 78","NPM Package Search"," /public/NPM%20Package%20Search/index.html"],["Day 79","Linkedin Homepage Clone"," /public/Linkedin-Clone/index.html"],["Day 80","Resume Studio"," /public/ResumeStudio/index.html"],["Day 81","Simon Says Game"," /public/Simon_Says_Game/index.html"],["Day 82","Love Calculator Game"," /public/Love-Calculator/index.html"],["Day 83","Exchange Currency"," /public/Exchange_Currency/index.html"],["Day 84","Lights Out Puzzle","/public/Lights_Out_Puzzle/index.html"],["Day 85", "Image Search Engine", "/public/Image Search Engine/index.html"],["Day 86","Profile Card","/public/3d profile Card/index.html"],["Day 87", "Breakout game", "/public/Breakout game/index.html"],["Day 88","Job dashboard","/public/Job dashboard/jobs.html"],["Day 89","N-Queen","/public/N_Queen/index.html"]]



Expand Down
31 changes: 31 additions & 0 deletions public/N_Queen/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>N-Queens Game</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">

<h1>N-Queens Game</h1>

<div class="borad-details">
<div class="board-size">
<label for="boardSize">Choose Board Size (N):</label>
<input type="number" id="boardSize" min="4" value="4">
</div>
<div class="start-reset-button">
<button id="startGame">Start Game</button>
</div>
</div>

<button id="resetGame" class="reset-button" style="display: none;">Reset Game</button>
<p id="message"></p>
<div id="gameBoard"></div>

</div>
<script src="script.js"></script>
</body>
</html>
82 changes: 82 additions & 0 deletions public/N_Queen/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@


const startGameButton = document.getElementById("startGame");
const resetGameButton = document.getElementById("resetGame");
const boardInput = document.getElementById("boardSize");
const board = document.getElementById("gameBoard");
const message = document.getElementById("message");

let queens = [];

startGameButton.addEventListener("click", startGame);
resetGameButton.addEventListener("click", resetGame);

function startGame() {
const n = parseInt(boardInput.value);
if (isNaN(n) || n < 4) {
alert("Please enter a valid board size (minimum 4).");
return;
}

resetGame();

board.style.gridTemplateColumns = `repeat(${n}, 60px)`;
board.innerHTML = "";
message.textContent = "";

for (let i = 0; i < n * n; i++) {
const square = document.createElement("div");
square.classList.add("square");
square.addEventListener("click", () => placeQueen(i, n));
board.appendChild(square);
}

queens = [];
startGameButton.style.display = "none";
resetGameButton.style.display = "inline-block";
}

function placeQueen(index, n) {
const row = Math.floor(index / n);
const col = index % n;

if (queens.some(([r, c]) => r === row || c === col || Math.abs(r - row) === Math.abs(c - col))) {
message.textContent = "Invalid placement! Queens are attacking each other. Try again.";
message.classList.add("error");
highlightConflicts(row, col, n);
return;
}

queens.push([row, col]);
const squares = document.querySelectorAll(".square");
squares[index].innerHTML = `<span class="queen">&#9819;</span>`;
message.textContent = "";

if (queens.length === n) {
message.textContent = "Congratulations! You've placed all queens safely!";
message.classList.remove("error");
}
}

function highlightConflicts(row, col, n) {
const squares = document.querySelectorAll(".square");
squares.forEach((square, index) => {
const r = Math.floor(index / n);
const c = index % n;

if (r === row || c === col || Math.abs(r - row) === Math.abs(c - col)) {
square.classList.add("highlight");
} else {
square.classList.remove("highlight");
}
});
}

function resetGame() {
board.innerHTML = "";
queens = [];
message.textContent = "";
message.classList.remove("error");
startGameButton.style.display = "inline-block";
resetGameButton.style.display = "none";
}
135 changes: 135 additions & 0 deletions public/N_Queen/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@

body {
font-family: 'Arial', sans-serif;
background-color: #121212;
color: #ffffff;
text-align: center;
margin: 0;
padding: 0;
}

.container {
max-width: fit-content;
margin: 20px auto;
padding: 20px;
background: #1e1e2f;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
border-radius: 15px;
}

h1 {
font-size: 2.5em;
color: #ff6347;
margin-bottom: 20px;
}

label {
font-weight: bold;
font-size: 1.2em;
color: #ffa07a;
padding-bottom: 20px;
}

input[type="number"] {
margin: 10px 0;
padding: 8px;
font-size: 1.1em;
border: 2px solid #ffa07a;
border-radius: 8px;
width: 80px;
text-align: center;
background-color: #282c34;
color: #f6f6f6;
}

button {
background-color:#48bb78 ;
color: #fff;
border: none;
padding: 10px 20px;
font-size: 1.2em;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.3s;
}

button:hover {
background-color: #6cde9b;
}

#gameBoard {
display: grid;
margin: 20px auto;
border: 4px solid #ff6347;
background: #2c2f40;
width: fit-content;
border-radius: 10px;
}

.square {
width: 60px;
height: 60px;
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
border: 0.5px solid #e4806e;
cursor: pointer;
transition: background-color 0.3s;
}

.square:nth-child(odd) {
background-color: #495057;
}

.square:nth-child(even) {
background-color: #343a40;
}

.queen {
font-size: 32px;
color: #ffa07a;
pointer-events: none;
}

#message {
font-size: 1.4em;
font-weight: bold;
margin-top: 20px;
color: #48bb78;
}

#message.error {
color: #e53e3e;
}

.highlight {
background-color: rgba(229, 62, 62, 0.6);
}

.reset-button {
background-color: #ff6347;
margin-top: 10px;
padding: 10px 20px;
color: #fff;
border: none;
border-radius: 8px;
font-size: 1.2em;
cursor: pointer;
transition: background-color 0.3s;

}

.reset-button:hover {
background-color:#f34b2e;
}

.board-details {
display: flex;
flex-direction: column;
}

.board-size{
padding-bottom:20px;
}

0 comments on commit f9c59d6

Please sign in to comment.