From b128911d449f07c32ab548385de997b2de55f6d7 Mon Sep 17 00:00:00 2001 From: Darshan C N Date: Sun, 13 Oct 2024 15:27:42 +0530 Subject: [PATCH] Fixed quiz questions as per feedback --- BlackJackGame/blackjack.html | 122 +- BlackJackGame/script.js | 498 ++-- BlackJackGame/style.css | 128 +- .../Bank Management System.cpp | 588 ++--- C++/Bank Management System/README.md | 76 +- C++/C++_STL_Explaination.cpp | 300 +-- C++/Linked_List.cpp | 282 +-- C++/Min_Flips.cpp | 80 +- C++/Minimum_coin_change.cpp | 132 +- C++/Stack.cpp | 170 +- C++/To_find_keyword.c | 94 +- C++/filesInCpp/bin/read | Bin C++/filesInCpp/bin/write | Bin C++/kadane.cpp | 80 +- Contributershub | 1 - DSA projects/RSA Encryption/cipherText.txt | 18 +- DSA projects/RSA Encryption/decipherText.txt | 18 +- DSA projects/RSA Encryption/main.cpp | 516 ++-- DSA projects/RSA Encryption/plainText.txt | 18 +- DSA projects/Tik Tac Toe/Main.java | 204 +- DSA projects/inorder_preorder_postorder.cpp | 190 +- DSA projects/rod_max_profit.cpp | 44 +- DSA projects/train managment system/main | Bin GO/go-mail-service/handlers.go | 0 GO/go-mail-service/helpers.go | 0 GO/go-mail-service/mailer.go | 0 GO/go-mail-service/main.go | 0 GO/go-mail-service/routes.go | 0 .../templates/mail.plain.gohtml | 0 .../templates/mailTest.html.gohtml | 0 Html/login.html | 52 +- Java/Java/travelling_Salesman.java | 122 +- Java/LinkedList/LL.java | 384 +-- Java/LinkedList/LList.java | 46 +- Java/Stack.java | 266 +-- Java/StackTest.java | 176 +- Java/StackTest.txt | 188 +- Java/StudentManagementApp | 1 - Java/anagram.java | 56 +- Java/guesserGameLaunch.java | 224 +- Javascript/fizzbuzz.js | 52 +- Javascript/tip-calculator/README.md | 6 +- Javascript/tip-calculator/index.html | 112 +- Javascript/tip-calculator/script.js | 94 +- Javascript/tip-calculator/styles.css | 190 +- Random_codes /Chatbot.python | 45 - Random_codes /Contributershub.iml | 11 - Random_codes /Credit Card Validator.cpp | 62 - Random_codes /Digital_clock.cpp | 162 -- Random_codes /Guess Game.javascript | 55 - Random_codes /Minimize Maximum of Array.cpp | 46 - Random_codes /PasswordGenerator.html | 178 -- Random_codes /Tic-Tac-Toe.java | 107 - Random_codes /Weather tool.python | 31 - Random_codes /anagram.java | 28 - Random_codes /lru_page replacement.c | 144 -- Random_codes /pangram.java | 24 - Random_codes /sort16.asm | 129 - Stopwatch_Timer/Timer.html | 60 +- Stopwatch_Timer/script.js | 152 +- Stopwatch_Timer/style.css | 228 +- WebD/Calculator/style.css | 282 +-- WebD/Card-Slider/style.css | 280 +-- WebD/Traveler-Landing-Page/index.html | 932 ++++---- WebD/Traveler-Landing-Page/post.html | 502 ++-- WebD/Traveler-Landing-Page/style.css | 2116 ++++++++--------- WebD/Traveler-Landing-Page/write.html | 266 +-- WebD/todo_app | 1 - python/Deepminer/deepminer.py | 150 +- python/Deepminer/deepsearch.py | 36 +- python/Deepminer/modules/deephelpers.py | 406 ++-- python/Deepminer/modules/deepsqlite.py | 174 +- python/Deepminer/output/log/deepminer.txt | 92 +- .../Library Management Sysytem/borrowed.txt | 1 + python/Library Management Sysytem/data.txt | 4 + python/Library Management Sysytem/library.py | 133 ++ python/Weather_Forecast.py | 104 +- python/rock_paper_scissors.py | 176 +- python/snake_game.py | 190 +- 79 files changed, 5974 insertions(+), 6861 deletions(-) mode change 100755 => 100644 C++/filesInCpp/bin/read mode change 100755 => 100644 C++/filesInCpp/bin/write delete mode 160000 Contributershub mode change 100755 => 100644 DSA projects/train managment system/main mode change 100755 => 100644 GO/go-mail-service/handlers.go mode change 100755 => 100644 GO/go-mail-service/helpers.go mode change 100755 => 100644 GO/go-mail-service/mailer.go mode change 100755 => 100644 GO/go-mail-service/main.go mode change 100755 => 100644 GO/go-mail-service/routes.go mode change 100755 => 100644 GO/go-mail-service/templates/mail.plain.gohtml mode change 100755 => 100644 GO/go-mail-service/templates/mailTest.html.gohtml delete mode 160000 Java/StudentManagementApp delete mode 100644 Random_codes /Chatbot.python delete mode 100644 Random_codes /Contributershub.iml delete mode 100644 Random_codes /Credit Card Validator.cpp delete mode 100644 Random_codes /Digital_clock.cpp delete mode 100644 Random_codes /Guess Game.javascript delete mode 100644 Random_codes /Minimize Maximum of Array.cpp delete mode 100644 Random_codes /PasswordGenerator.html delete mode 100644 Random_codes /Tic-Tac-Toe.java delete mode 100644 Random_codes /Weather tool.python delete mode 100644 Random_codes /anagram.java delete mode 100644 Random_codes /lru_page replacement.c delete mode 100644 Random_codes /pangram.java delete mode 100644 Random_codes /sort16.asm delete mode 160000 WebD/todo_app create mode 100644 python/Library Management Sysytem/borrowed.txt create mode 100644 python/Library Management Sysytem/data.txt create mode 100644 python/Library Management Sysytem/library.py diff --git a/BlackJackGame/blackjack.html b/BlackJackGame/blackjack.html index a7519a1..6ddc5bc 100644 --- a/BlackJackGame/blackjack.html +++ b/BlackJackGame/blackjack.html @@ -1,62 +1,62 @@ - - - - - Blackjack - - - - - -
-

Blackjack Game

-

Let's Play

- -
-
-

You: 0

-
- -
-

Dealer: 0

-
-
- -
-
- - - - -
-
-
- - - - - - - - - - - - -
WinLoseDraw
000
-
-
- - + + + + + Blackjack + + + + + +
+

Blackjack Game

+

Let's Play

+ +
+
+

You: 0

+
+ +
+

Dealer: 0

+
+
+ +
+
+ + + + +
+
+
+ + + + + + + + + + + + +
WinLoseDraw
000
+
+
+ + \ No newline at end of file diff --git a/BlackJackGame/script.js b/BlackJackGame/script.js index b7b1d99..60f003f 100644 --- a/BlackJackGame/script.js +++ b/BlackJackGame/script.js @@ -1,250 +1,250 @@ -let blackjackGame = { - you: { - scoreSpan: "#your-blackjack-result", - div: "#your-box", - boxSize: ".flex-blackjack-row-2 div", - score: 0, - }, - - dealer: { - scoreSpan: "#dealer-blackjack-result", - div: "#dealer-box", - boxSize: ".flex-blackjack-row-2 div", - score: 0, - }, - - cards: ["2", "3", "4", "5", "6", "7", "8", "9", "10", "K", "J", "Q", "A"], - - cardsMap: { - 2: 2, - 3: 3, - 4: 4, - 5: 5, - 6: 6, - 7: 7, - 8: 8, - 9: 9, - 10: 10, - K: 10, - J: 10, - Q: 10, - A: [1, 11], - }, - - wins: 0, - losses: 0, - draws: 0, - isStand: false, - isTurnsOver: false, - pressOnce: false, - }; - - const YOU = blackjackGame["you"]; - const DEALER = blackjackGame["dealer"]; - - const hitSound = new Audio("sounds/swish.m4a"); - const winSound = new Audio("sounds/cash.mp3"); - const loseSound = new Audio("sounds/aww.mp3"); - - let windowWidth = window.screen.width; - let windowHeight = window.screen.height; - let winner; - - //Button Event Listeners - document - .querySelector("#blackjack-hit-button") - .addEventListener("click", blackjackHit); - document - .querySelector("#blackjack-stand-button") - .addEventListener("click", blackjackStand); - document - .querySelector("#blackjack-deal-button") - .addEventListener("click", blackjackDeal); - document - .querySelector("#blackjack-reset-button") - .addEventListener("click", blackjackRestart); - - function blackjackHit() { - if (blackjackGame["isStand"] === false) { - let card = randomCard(); - showCard(card, YOU); - updateScore(card, YOU); - showScore(YOU); - } - } - - function randomCard() { - let randomIndex = Math.floor(Math.random() * 13); - return blackjackGame["cards"][randomIndex]; - } - - function showCard(card, activePlayer) { - if (activePlayer["score"] <= 21) { - let cardImage = document.createElement("img"); - cardImage.src = `images/${card}.png`; - cardImage.style = `width:${widthSize()}; height:${heightSize()};`; - document.querySelector(activePlayer["div"]).appendChild(cardImage); - hitSound.play(); - } - } - - function widthSize() { - if (windowWidth > 1000) { - let newWidthSize = window.screen.width * 0.1; - return newWidthSize; - } else { - return window.screen.width * 0.18; - } - } - - function heightSize() { - if (windowHeight > 700) { - let newHeightSize = window.screen.height * 0.18; - return newHeightSize; - } else { - return window.screen.height * 0.15; - } - } - - function updateScore(card, activePlayer) { - if (card === "A") { - if (activePlayer["score"] + blackjackGame["cardsMap"][card][1] <= 21) { - activePlayer["score"] += blackjackGame["cardsMap"][card][1]; - } else { - activePlayer["score"] += blackjackGame["cardsMap"][card][0]; - } - } else { - activePlayer["score"] += blackjackGame["cardsMap"][card]; - } - - console.log(activePlayer["score"]); - } - - function showScore(activePlayer) { - //Bust logic if score is over 21 - if (activePlayer["score"] > 21) { - document.querySelector(activePlayer["scoreSpan"]).textContent = "BUST!"; - document.querySelector(activePlayer["scoreSpan"]).style.color = "red"; - } else { - document.querySelector(activePlayer["scoreSpan"]).textContent = - activePlayer["score"]; - } - } - - function blackjackStand() { - if (blackjackGame.pressOnce === false) { - blackjackGame["isStand"] = true; - let yourImages = document - .querySelector("#your-box") - .querySelectorAll("img"); - - for (let i = 0; i < yourImages.length; i++) { - let card = randomCard(); - showCard(card, DEALER); - updateScore(card, DEALER); - showScore(DEALER); - } - - blackjackGame["isTurnsOver"] = true; - - computeWinner(); - showWinner(winner); - } - - blackjackGame.pressOnce = true; - } - - function computeWinner() { - if (YOU["score"] <= 21) { - if (YOU["score"] > DEALER["score"] || DEALER["score"] > 21) { - winner = YOU; - } else if (YOU["score"] < DEALER["score"]) { - winner = DEALER; - } else if (YOU["score"] === DEALER["score"]) { - winner = "Draw"; - } - } else if (YOU["score"] > 21 && DEALER["score"] <= 21) { - winner = DEALER; - } else if (YOU["score"] > 21 && DEALER["score"] > 21) { - winner = "None"; - } - - return winner; - } - - function showWinner(winner) { - let message, messageColor; - - if (winner === YOU) { - message = "You Won"; - messageColor = "#00e676"; - document.querySelector("#wins").textContent = blackjackGame["wins"] += 1; - winSound.play(); - } else if (winner === DEALER) { - message = "You Lost"; - messageColor = "red"; - document.querySelector("#losses").textContent = blackjackGame[ - "losses" - ] += 1; - loseSound.play(); - } else if (winner === "Draw") { - message = "You Drew"; - messageColor = "yellow"; - document.querySelector("#draws").textContent = blackjackGame["draws"] += 1; - loseSound.play(); - } else if (winner === "None") { - message = "You Both Busted!"; - messageColor = "orange"; - loseSound.play(); - } - - document.querySelector("#blackjack-result").textContent = message; - document.querySelector("#blackjack-result").style.color = messageColor; - } - - function blackjackDeal() { - if (blackjackGame["isTurnsOver"] === true) { - // Select all the images in both the user and dealer box - let yourImages = document - .querySelector("#your-box") - .querySelectorAll("img"); - let dealerImages = document - .querySelector("#dealer-box") - .querySelectorAll("img"); - - document.querySelector("#blackjack-result").style.color = "white"; - - //Sets the user and dealers scors to zero - YOU["score"] = DEALER["score"] = 0; - document.querySelector("#your-blackjack-result").textContent = 0; - document.querySelector("#dealer-blackjack-result").textContent = 0; - - //Reset color back to white - document.querySelector("#your-blackjack-result").style.color = "white"; - document.querySelector("#dealer-blackjack-result").style.color = "white"; - - //Reset to Let's Play - document.querySelector("#blackjack-result").textContent = "Lets Play"; - - //Removes the cards in the user's box - for (let i = 0; i < yourImages.length; i++) { - yourImages[i].remove(); - dealerImages[i].remove(); - } - - blackjackGame["isStand"] = false; - blackjackGame.pressOnce = false; - blackjackGame["isTurnsOver"] = false; - } - } - - function blackjackRestart() { - blackjackDeal(); - document.querySelector("#wins").textContent = 0; - document.querySelector("#losses").textContent = 0; - document.querySelector("#draws").textContent = 0; - - blackjackGame.wins = 0; - blackjackGame.losses = 0; - blackjackGame.draws = 0; +let blackjackGame = { + you: { + scoreSpan: "#your-blackjack-result", + div: "#your-box", + boxSize: ".flex-blackjack-row-2 div", + score: 0, + }, + + dealer: { + scoreSpan: "#dealer-blackjack-result", + div: "#dealer-box", + boxSize: ".flex-blackjack-row-2 div", + score: 0, + }, + + cards: ["2", "3", "4", "5", "6", "7", "8", "9", "10", "K", "J", "Q", "A"], + + cardsMap: { + 2: 2, + 3: 3, + 4: 4, + 5: 5, + 6: 6, + 7: 7, + 8: 8, + 9: 9, + 10: 10, + K: 10, + J: 10, + Q: 10, + A: [1, 11], + }, + + wins: 0, + losses: 0, + draws: 0, + isStand: false, + isTurnsOver: false, + pressOnce: false, + }; + + const YOU = blackjackGame["you"]; + const DEALER = blackjackGame["dealer"]; + + const hitSound = new Audio("sounds/swish.m4a"); + const winSound = new Audio("sounds/cash.mp3"); + const loseSound = new Audio("sounds/aww.mp3"); + + let windowWidth = window.screen.width; + let windowHeight = window.screen.height; + let winner; + + //Button Event Listeners + document + .querySelector("#blackjack-hit-button") + .addEventListener("click", blackjackHit); + document + .querySelector("#blackjack-stand-button") + .addEventListener("click", blackjackStand); + document + .querySelector("#blackjack-deal-button") + .addEventListener("click", blackjackDeal); + document + .querySelector("#blackjack-reset-button") + .addEventListener("click", blackjackRestart); + + function blackjackHit() { + if (blackjackGame["isStand"] === false) { + let card = randomCard(); + showCard(card, YOU); + updateScore(card, YOU); + showScore(YOU); + } + } + + function randomCard() { + let randomIndex = Math.floor(Math.random() * 13); + return blackjackGame["cards"][randomIndex]; + } + + function showCard(card, activePlayer) { + if (activePlayer["score"] <= 21) { + let cardImage = document.createElement("img"); + cardImage.src = `images/${card}.png`; + cardImage.style = `width:${widthSize()}; height:${heightSize()};`; + document.querySelector(activePlayer["div"]).appendChild(cardImage); + hitSound.play(); + } + } + + function widthSize() { + if (windowWidth > 1000) { + let newWidthSize = window.screen.width * 0.1; + return newWidthSize; + } else { + return window.screen.width * 0.18; + } + } + + function heightSize() { + if (windowHeight > 700) { + let newHeightSize = window.screen.height * 0.18; + return newHeightSize; + } else { + return window.screen.height * 0.15; + } + } + + function updateScore(card, activePlayer) { + if (card === "A") { + if (activePlayer["score"] + blackjackGame["cardsMap"][card][1] <= 21) { + activePlayer["score"] += blackjackGame["cardsMap"][card][1]; + } else { + activePlayer["score"] += blackjackGame["cardsMap"][card][0]; + } + } else { + activePlayer["score"] += blackjackGame["cardsMap"][card]; + } + + console.log(activePlayer["score"]); + } + + function showScore(activePlayer) { + //Bust logic if score is over 21 + if (activePlayer["score"] > 21) { + document.querySelector(activePlayer["scoreSpan"]).textContent = "BUST!"; + document.querySelector(activePlayer["scoreSpan"]).style.color = "red"; + } else { + document.querySelector(activePlayer["scoreSpan"]).textContent = + activePlayer["score"]; + } + } + + function blackjackStand() { + if (blackjackGame.pressOnce === false) { + blackjackGame["isStand"] = true; + let yourImages = document + .querySelector("#your-box") + .querySelectorAll("img"); + + for (let i = 0; i < yourImages.length; i++) { + let card = randomCard(); + showCard(card, DEALER); + updateScore(card, DEALER); + showScore(DEALER); + } + + blackjackGame["isTurnsOver"] = true; + + computeWinner(); + showWinner(winner); + } + + blackjackGame.pressOnce = true; + } + + function computeWinner() { + if (YOU["score"] <= 21) { + if (YOU["score"] > DEALER["score"] || DEALER["score"] > 21) { + winner = YOU; + } else if (YOU["score"] < DEALER["score"]) { + winner = DEALER; + } else if (YOU["score"] === DEALER["score"]) { + winner = "Draw"; + } + } else if (YOU["score"] > 21 && DEALER["score"] <= 21) { + winner = DEALER; + } else if (YOU["score"] > 21 && DEALER["score"] > 21) { + winner = "None"; + } + + return winner; + } + + function showWinner(winner) { + let message, messageColor; + + if (winner === YOU) { + message = "You Won"; + messageColor = "#00e676"; + document.querySelector("#wins").textContent = blackjackGame["wins"] += 1; + winSound.play(); + } else if (winner === DEALER) { + message = "You Lost"; + messageColor = "red"; + document.querySelector("#losses").textContent = blackjackGame[ + "losses" + ] += 1; + loseSound.play(); + } else if (winner === "Draw") { + message = "You Drew"; + messageColor = "yellow"; + document.querySelector("#draws").textContent = blackjackGame["draws"] += 1; + loseSound.play(); + } else if (winner === "None") { + message = "You Both Busted!"; + messageColor = "orange"; + loseSound.play(); + } + + document.querySelector("#blackjack-result").textContent = message; + document.querySelector("#blackjack-result").style.color = messageColor; + } + + function blackjackDeal() { + if (blackjackGame["isTurnsOver"] === true) { + // Select all the images in both the user and dealer box + let yourImages = document + .querySelector("#your-box") + .querySelectorAll("img"); + let dealerImages = document + .querySelector("#dealer-box") + .querySelectorAll("img"); + + document.querySelector("#blackjack-result").style.color = "white"; + + //Sets the user and dealers scors to zero + YOU["score"] = DEALER["score"] = 0; + document.querySelector("#your-blackjack-result").textContent = 0; + document.querySelector("#dealer-blackjack-result").textContent = 0; + + //Reset color back to white + document.querySelector("#your-blackjack-result").style.color = "white"; + document.querySelector("#dealer-blackjack-result").style.color = "white"; + + //Reset to Let's Play + document.querySelector("#blackjack-result").textContent = "Lets Play"; + + //Removes the cards in the user's box + for (let i = 0; i < yourImages.length; i++) { + yourImages[i].remove(); + dealerImages[i].remove(); + } + + blackjackGame["isStand"] = false; + blackjackGame.pressOnce = false; + blackjackGame["isTurnsOver"] = false; + } + } + + function blackjackRestart() { + blackjackDeal(); + document.querySelector("#wins").textContent = 0; + document.querySelector("#losses").textContent = 0; + document.querySelector("#draws").textContent = 0; + + blackjackGame.wins = 0; + blackjackGame.losses = 0; + blackjackGame.draws = 0; } \ No newline at end of file diff --git a/BlackJackGame/style.css b/BlackJackGame/style.css index b92844e..46e81f1 100644 --- a/BlackJackGame/style.css +++ b/BlackJackGame/style.css @@ -1,65 +1,65 @@ -body { - background: url("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxISEhUQEBAVFRUVDw8VFRUPDw8PDxUPFRUWFhUVFRUYHSggGBolHRUVITEhJSkrLi4uFx8zODMtNygtLisBCgoKDQ0NDw8PDysZFRkrKysrKysrKzctKys3KzctLS0rKzctKys3LS03Ky03KzctKysrKystKysrKysrKysrK//AABEIALcBEwMBIgACEQEDEQH/xAAZAAEBAQEBAQAAAAAAAAAAAAADAgEABAf/xAAbEAEBAQEBAQEBAAAAAAAAAAAAAQISEQNRIf/EABcBAQEBAQAAAAAAAAAAAAAAAAEAAgT/xAAWEQEBAQAAAAAAAAAAAAAAAAAAARH/2gAMAwEAAhEDEQA/APksV4yKjscLo2OioQ6RcjpFyEVki5HSEzGgyRcipleIQiZJnKplUwgmRecqmF5yQiZbyaZVMlAmW3JuGeJBvzRw9OsMuEnnuUXD03KLgIFwi5PrKNYBBYOx6OUayCDURqGsRqAhsRYaxFgI7E1dibEUVivGeApc1wTY2OioU6RcjJFyENhMxOYWQsukXMuzCSEOzlcipF5y0GZhcZbnBM5IT4rOSTKphJPLeSTKpggXFdMlmG8BBvzRcvRy7WUnluGay9FwjWUXnuR6y9GoOwJ57lG8vRrI9ZRebUHT7yOxkhsHYfUFqBoVibCWIsBHYyrsRQkua5FsWmLhDYTMTmEyQ3MLmJzCZhZVMlzE4NmEOzCzDMwuckNzkky7OS5yRrs5XMNzkkykiYVMLkVIULlvJ+WcpB4ZrBtYTYE89wjWXq5RrKLyXI9ZevWQ7yk82si1HquQ7gTz6grD6HqBp59QeofUFqAh1EUuoPUBg6mrsRQUua4FsXExeSFZJEZJksryXERDYjQXmFwjMLmFkmMmzEfMuSl5yTMZmEzEG5heWYhMxFmYqRWYrMSR42xfjZhIPLLDeJ1lIOp+D1l6LBaiQNQdj0WD1Enl1kW8vTqB1Enm1kWo9OoDcBBqC0fQtQF56jULsdrJgtIpKihpDXORbCQeSZQXCZRCZLJMw2ILBstRmlybEDg2GgXJ8QWIbCBcwsyjMLhJWYTMTkmUlSN8bIqQFnjcxvLUWaiLF1NSDco1Dag9RANgtQ2oLRQNB3Ho1A7iTz7Dp6dwG4C8+4LR9h1AQaHqG0LQItDpdDrJQ1zkWxcRF5QJkuRZJloU2IbIc02TGaXMPmAwbDQPk3zBh6PmgXJshybKJovMThcSVhUZFAqkZWxgSXWNrNFI0OloqkPQdw9DsgGoLZtA3UhfR59G1Q6SDsWi7FpkwOh6JoWg0PQ6TQ6yUuc5FsXBxeUC5JkWaXLQpcnzXnybJjNPg2AZpsVoV6Mn+cebB81B6MFgMU2akbBIGUmKiZ0RKqUEkd6m6d6E61ldU2lOtHqKqNVAev4LdJqi1ShbgNm1Q7SDoOjaDpIO6LRNh3Wa1B6Do2qLQI9DpNDrLSXOck6LyNcqRMlyHJc0slybIM0+a1AbJsvPmmzSy9GKbFefJc6IenNNHnzSTRT0ZpJQZpMgmzVBmlSpFjeh+uukl2ptTdMuknWo1XXSbpJOhbVqi3pJOwbXvQdVJG6K1e9B1QR7Dou6HQKKLRNC1QUaHV1FZaS1jknRURFRImSZFKTNINC4oIXNLJ5oudPPilzWmXpxS4rzZpvnoh6ZS5oJpU0U9Epc158aVNJPR02aBNL9CPdJ9HNu6RX07odrLpImtD1pN0O6QVqh1pVot6RZqh1Vei1UkborVb0PVZMTqh1VWj1QU6otVeh0NJqKqooLGscCyKiWxAkXKOKlIppS4rzylzWgeUua88pM0svRnRM1580mNNCvVNLzp5s1c0g9WdK7ebOiTST0TTuhdOmknoundh6ZdJG7ZrQvWXRRLpN0PtF2Eu6HvTLpFqLrRbqtaDuhM1RardaHqhpmqPVbqjtBZqjtVqorJZUVtZQWOY5FzYmNiS5VSoioQSUkoZVykHzV5oJSZpZNnRcV55pedEY9PSpoE0vOjox6c6bK880uaKejtvTzzTZtI807sPbukjTbroPTL9Eidp1oetp6SJ0PWk3SNaBbdD1p2qO0FuqPVdrQ9UF1Ra61NoLLU2utTaCyprawFnrmOCc1zklRUc4hsq5XOKXKqVziyTNVK5xVVNLmnOIVNLmnOIbNN6c5BvTunOSd0y6Y5JnrvXOBRdJ1pzkR3SLpzgUWptc4JFqa5wKKyucGk1jnBMY5yT//2Q=="); - background-repeat: no-repeat; - background-size: cover; - - padding:10px; - } - - - .container { - margin: 0 auto; - text-align: center; - color: white; - width:75%; - - } - - .flex-blackjack-row-1, - .flex-blackjack-row-2, - .flex-blackjack-row-3 { - display: flex; - padding: 5px; - flex-wrap: wrap; - flex-direction: row; - justify-content: space-evenly; - } - - .flex-blackjack-row-2 div { - padding: 10px; - border: 1px solid black; - - flex: 1; - height: 350px; - text-align: center; - } - - .flex-blackjack-row-2 div img { - padding: 10px; - } - - table { - border: 3px solid black; - border-collapse: collapse; - padding:10px; - width:45%; - background-color: white; - text-align: center; - } - table td { - border: 2px solid black; - } - - .flex-blackjack-row-3 div { - padding: 5px; - } - - .flex-blackjack-row-3 button { - padding: 10 px; - margin-bottom: 10px; - } - - .flex-blackjack-row-2, .flex-blackjack-row-3{ - background-image: url(https://i.stack.imgur.com/q02th.jpg); - border: 3px solid black; +body { + background: url("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxISEhUQEBAVFRUVDw8VFRUPDw8PDxUPFRUWFhUVFRUYHSggGBolHRUVITEhJSkrLi4uFx8zODMtNygtLisBCgoKDQ0NDw8PDysZFRkrKysrKysrKzctKys3KzctLS0rKzctKys3LS03Ky03KzctKysrKystKysrKysrKysrK//AABEIALcBEwMBIgACEQEDEQH/xAAZAAEBAQEBAQAAAAAAAAAAAAADAgEABAf/xAAbEAEBAQEBAQEBAAAAAAAAAAAAAQISEQNRIf/EABcBAQEBAQAAAAAAAAAAAAAAAAEAAgT/xAAWEQEBAQAAAAAAAAAAAAAAAAAAARH/2gAMAwEAAhEDEQA/APksV4yKjscLo2OioQ6RcjpFyEVki5HSEzGgyRcipleIQiZJnKplUwgmRecqmF5yQiZbyaZVMlAmW3JuGeJBvzRw9OsMuEnnuUXD03KLgIFwi5PrKNYBBYOx6OUayCDURqGsRqAhsRYaxFgI7E1dibEUVivGeApc1wTY2OioU6RcjJFyENhMxOYWQsukXMuzCSEOzlcipF5y0GZhcZbnBM5IT4rOSTKphJPLeSTKpggXFdMlmG8BBvzRcvRy7WUnluGay9FwjWUXnuR6y9GoOwJ57lG8vRrI9ZRebUHT7yOxkhsHYfUFqBoVibCWIsBHYyrsRQkua5FsWmLhDYTMTmEyQ3MLmJzCZhZVMlzE4NmEOzCzDMwuckNzkky7OS5yRrs5XMNzkkykiYVMLkVIULlvJ+WcpB4ZrBtYTYE89wjWXq5RrKLyXI9ZevWQ7yk82si1HquQ7gTz6grD6HqBp59QeofUFqAh1EUuoPUBg6mrsRQUua4FsXExeSFZJEZJksryXERDYjQXmFwjMLmFkmMmzEfMuSl5yTMZmEzEG5heWYhMxFmYqRWYrMSR42xfjZhIPLLDeJ1lIOp+D1l6LBaiQNQdj0WD1Enl1kW8vTqB1Enm1kWo9OoDcBBqC0fQtQF56jULsdrJgtIpKihpDXORbCQeSZQXCZRCZLJMw2ILBstRmlybEDg2GgXJ8QWIbCBcwsyjMLhJWYTMTkmUlSN8bIqQFnjcxvLUWaiLF1NSDco1Dag9RANgtQ2oLRQNB3Ho1A7iTz7Dp6dwG4C8+4LR9h1AQaHqG0LQItDpdDrJQ1zkWxcRF5QJkuRZJloU2IbIc02TGaXMPmAwbDQPk3zBh6PmgXJshybKJovMThcSVhUZFAqkZWxgSXWNrNFI0OloqkPQdw9DsgGoLZtA3UhfR59G1Q6SDsWi7FpkwOh6JoWg0PQ6TQ6yUuc5FsXBxeUC5JkWaXLQpcnzXnybJjNPg2AZpsVoV6Mn+cebB81B6MFgMU2akbBIGUmKiZ0RKqUEkd6m6d6E61ldU2lOtHqKqNVAev4LdJqi1ShbgNm1Q7SDoOjaDpIO6LRNh3Wa1B6Do2qLQI9DpNDrLSXOck6LyNcqRMlyHJc0slybIM0+a1AbJsvPmmzSy9GKbFefJc6IenNNHnzSTRT0ZpJQZpMgmzVBmlSpFjeh+uukl2ptTdMuknWo1XXSbpJOhbVqi3pJOwbXvQdVJG6K1e9B1QR7Dou6HQKKLRNC1QUaHV1FZaS1jknRURFRImSZFKTNINC4oIXNLJ5oudPPilzWmXpxS4rzZpvnoh6ZS5oJpU0U9Epc158aVNJPR02aBNL9CPdJ9HNu6RX07odrLpImtD1pN0O6QVqh1pVot6RZqh1Vei1UkborVb0PVZMTqh1VWj1QU6otVeh0NJqKqooLGscCyKiWxAkXKOKlIppS4rzylzWgeUua88pM0svRnRM1580mNNCvVNLzp5s1c0g9WdK7ebOiTST0TTuhdOmknoundh6ZdJG7ZrQvWXRRLpN0PtF2Eu6HvTLpFqLrRbqtaDuhM1RardaHqhpmqPVbqjtBZqjtVqorJZUVtZQWOY5FzYmNiS5VSoioQSUkoZVykHzV5oJSZpZNnRcV55pedEY9PSpoE0vOjox6c6bK880uaKejtvTzzTZtI807sPbukjTbroPTL9Eidp1oetp6SJ0PWk3SNaBbdD1p2qO0FuqPVdrQ9UF1Ra61NoLLU2utTaCyprawFnrmOCc1zklRUc4hsq5XOKXKqVziyTNVK5xVVNLmnOIVNLmnOIbNN6c5BvTunOSd0y6Y5JnrvXOBRdJ1pzkR3SLpzgUWptc4JFqa5wKKyucGk1jnBMY5yT//2Q=="); + background-repeat: no-repeat; + background-size: cover; + + padding:10px; + } + + + .container { + margin: 0 auto; + text-align: center; + color: white; + width:75%; + + } + + .flex-blackjack-row-1, + .flex-blackjack-row-2, + .flex-blackjack-row-3 { + display: flex; + padding: 5px; + flex-wrap: wrap; + flex-direction: row; + justify-content: space-evenly; + } + + .flex-blackjack-row-2 div { + padding: 10px; + border: 1px solid black; + + flex: 1; + height: 350px; + text-align: center; + } + + .flex-blackjack-row-2 div img { + padding: 10px; + } + + table { + border: 3px solid black; + border-collapse: collapse; + padding:10px; + width:45%; + background-color: white; + text-align: center; + } + table td { + border: 2px solid black; + } + + .flex-blackjack-row-3 div { + padding: 5px; + } + + .flex-blackjack-row-3 button { + padding: 10 px; + margin-bottom: 10px; + } + + .flex-blackjack-row-2, .flex-blackjack-row-3{ + background-image: url(https://i.stack.imgur.com/q02th.jpg); + border: 3px solid black; } \ No newline at end of file diff --git a/C++/Bank Management System/Bank Management System.cpp b/C++/Bank Management System/Bank Management System.cpp index 5c4cbc0..a67e30c 100644 --- a/C++/Bank Management System/Bank Management System.cpp +++ b/C++/Bank Management System/Bank Management System.cpp @@ -1,295 +1,295 @@ -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -// Structure to represent a transaction -struct Transaction { - string type; - int amount; - string timestamp; -}; - -class Bank { -private: - string client_id; - string client_name; - string client_city; - double client_balance = 0.0; - double client_donation = 0.0; - - static double total_donation; - - vector transactionHistory; - -public: - // Member function to set client details - void setDetails() { - cout << "\nClient Id: "; - cin >> client_id; - - cout << "Client Name: "; - cin.ignore(); - getline(cin, client_name); - - cout << "Client City: "; - getline(cin, client_city); - } - - // Member function for debit operation - void debit(double amt) { - client_balance -= amt; - recordTransaction("Debit", amt); - } - - // Member function for credit operation - void credit(double amt) { - client_balance += amt; - recordTransaction("Credit", amt); - } - - // Member function for donation operation - void donate(double amt) { - client_donation += amt; - total_donation += amt; - client_balance -= amt; - recordTransaction("Donation", amt); - } - - // Getter functions - double getTotalDonation() const { return total_donation; } - string getname() const { return client_name; } - string getid() const { return client_id; } - string getcity() const { return client_city; } - double getbalance() const { return client_balance; } - double getdonation() const { return client_donation; } - static double gettotaldonation() { return total_donation; } - - // Member function to display transaction history - void displayTransactionHistory() const { - cout << "\nTransaction History for " << client_name << " (ID: " << client_id << ")\n"; - cout << "---------------------------------------\n"; - cout << "Type\tAmount\tTimestamp\n"; - for (const Transaction &transaction : transactionHistory) { - cout << transaction.type << "\t" << transaction.amount << "\t" << transaction.timestamp << endl; - } - } - -private: - // Member function to record a transaction - void recordTransaction(const string &type, double amount) { - time_t now = time(0); - char *timestamp = ctime(&now); - timestamp[strlen(timestamp) - 1] = '\0'; - Transaction transaction; - transaction.type = type; - transaction.amount = amount; - transaction.timestamp = timestamp; - transactionHistory.push_back(transaction); - } -}; - -double Bank::total_donation = 0.0; - -int main() { - vector clients; - - int ch = 1; - cout << "\n\n----------------| Welcome to Naman's Bank of India |----------------\n"; - int selectedClient = -1; - int selectedClientInfo = -1; - string city; - - do { - cout << "\nPress 0. Exit\n"; - cout << "Press 1. Select Client\n"; - cout << "Press 2. View Max Donation\n"; - cout << "Press 3. Search By City\n"; - cout << "Press 4. Total Donation\n"; - cout << "Press 5. Display Info\n"; - cout << "Press 6. Create New Account\n"; - cout << "Press 7. Add Funds to Account\n"; - cout << "Press 8. Make a Donation\n"; - cout << "--> "; - cin >> ch; - - switch (ch) { - case 1: - cout << "\nSelect Client (1 to " << clients.size() << "): "; - cin >> selectedClient; - if (selectedClient >= 1 && static_cast(selectedClient) <= clients.size()) { - cout << "\nSelected client: " << clients[selectedClient - 1].getname() << " (ID: " - << clients[selectedClient - 1].getid() << ")\n"; - - int clientOption = -1; - while (clientOption != 2) { - cout << "Press 1 to Make a Donation\n"; - cout << "Press 2 to Add Funds to Account\n"; - cout << "Press 3 to Go Back\n"; - cout << "--> "; - cin >> clientOption; - - switch (clientOption) { - case 1: - double donationAmount; - cout << "\nEnter donation amount: "; - cin >> donationAmount; - - if (donationAmount > 0) { - if (donationAmount <= clients[selectedClient - 1].getbalance()) { - clients[selectedClient - 1].donate(donationAmount); - cout << "Donation of Rs. " << donationAmount << " /- has been successfully made by " << clients[selectedClient - 1].getname() << "\nThanks for the Donation !" << endl; - } else { - cout << "Insufficient balance. Cannot make the donation.\n"; - } - } else { - cout << "Invalid donation amount. Donation amount must be greater than 0.\n"; - } - break; - - case 2: - double creditAmount; - cout << "\nEnter the amount to add to the balance: "; - cin >> creditAmount; - - if (creditAmount > 0) { - clients[selectedClient - 1].credit(creditAmount); - cout << "\nRs. " << creditAmount << " /- has been successfully added to the balance of " << clients[selectedClient - 1].getname() << endl; - } else { - cout << "Invalid credit amount. Amount must be greater than 0.\n"; - } - break; - - case 3: - // Go back to the main menu. - break; - - default: - cout << "Invalid option. Please select 1 to make a donation, 2 to add funds, or 3 to go back.\n"; - } - } - } else { - cout << "\nInvalid client selection\n"; - } - break; - - case 2: - // Implement logic to find the client with the maximum donation and display their info. - { - Bank *clientWithMaxDonation = nullptr; - double maxDonation = -1.0; - for (Bank &client : clients) { - if (client.getdonation() > maxDonation) { - maxDonation = client.getdonation(); - clientWithMaxDonation = &client; - } - } - if (clientWithMaxDonation) { - cout << "\nClient with Max Donation: " << clientWithMaxDonation->getname() << " (ID: " - << clientWithMaxDonation->getid() << ")\n"; - } else { - cout << "No clients with donations found.\n"; - } - } - break; - - case 3: - // Implement logic to find the client with the maximum donation and display their info. - { - Bank *clientWithMaxDonation = nullptr; - double maxDonation = -1.0; - for (Bank &client : clients) { - if (client.getdonation() > maxDonation) { - maxDonation = client.getdonation(); - clientWithMaxDonation = &client; - } - } - if (clientWithMaxDonation) { - cout << "\nClient with Max Donation: " << clientWithMaxDonation->getname() << " (ID: " - << clientWithMaxDonation->getid() << ")\n"; - } else { - cout << "No clients with donations found.\n"; - } - } - break; - - case 4: - cout << "\nTotal Donations: " << Bank::gettotaldonation() << endl; - break; - - case 5: - cout << "\nSelect Client Info (1 to " << clients.size() << "): "; - cin >> selectedClientInfo; - if (selectedClientInfo >= 1 && static_cast(selectedClientInfo) <= clients.size()) { - clients[selectedClientInfo - 1].displayTransactionHistory(); - } else { - cout << "\nInvalid client selection\n"; - } - break; - - case 6: - // Create a new account - if (clients.size() < 10) { - cout << "\nCreate a New Account\n"; - Bank newClient; - newClient.setDetails(); - clients.push_back(newClient); - } else { - cout << "\nAccount limit reached. Cannot create more accounts." << endl; - } - break; - - case 7: - // Adds Funds in the client's Account - if (selectedClient != -1) { - double creditAmount; - cout << "\nEnter the amount to add to the balance: "; - cin >> creditAmount; - - if (creditAmount > 0) { - clients[selectedClient - 1].credit(creditAmount); - cout << fixed << "\nRs. " << setprecision(2) << creditAmount << " /- has been successfully added to the balance of " << clients[selectedClient - 1].getname() << endl; - } else { - cout << "Invalid credit amount. Amount must be greater than 0.\n"; - } - } else { - cout << "Please select a client before adding funds.\n"; - } - break; - - case 8: - // Adds Donations - if (selectedClient != -1) { - double donationAmount; - cout << "Enter donation amount: "; - cin >> donationAmount; - - if (donationAmount > 0) { - if (donationAmount <= clients[selectedClient - 1].getbalance()) { - clients[selectedClient - 1].donate(donationAmount); - cout << "Donation of Rs. " << donationAmount << " has been successfully made by " << clients[selectedClient - 1].getname() << endl; - } else { - cout << "Insufficient balance. Cannot make the donation.\n"; - } - } else { - cout << "Invalid donation amount. Donation amount must be greater than 0.\n"; - } - } else { - cout << "Please select a client before making a donation.\n"; - } - break; - - default: - cout << "\nThank you for using Naman's Bank of India\n"; - cout << "Do visit us Again !\n\n"; - } - } while (ch != 0); - - system("pause"); - return 0; +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +// Structure to represent a transaction +struct Transaction { + string type; + int amount; + string timestamp; +}; + +class Bank { +private: + string client_id; + string client_name; + string client_city; + double client_balance = 0.0; + double client_donation = 0.0; + + static double total_donation; + + vector transactionHistory; + +public: + // Member function to set client details + void setDetails() { + cout << "\nClient Id: "; + cin >> client_id; + + cout << "Client Name: "; + cin.ignore(); + getline(cin, client_name); + + cout << "Client City: "; + getline(cin, client_city); + } + + // Member function for debit operation + void debit(double amt) { + client_balance -= amt; + recordTransaction("Debit", amt); + } + + // Member function for credit operation + void credit(double amt) { + client_balance += amt; + recordTransaction("Credit", amt); + } + + // Member function for donation operation + void donate(double amt) { + client_donation += amt; + total_donation += amt; + client_balance -= amt; + recordTransaction("Donation", amt); + } + + // Getter functions + double getTotalDonation() const { return total_donation; } + string getname() const { return client_name; } + string getid() const { return client_id; } + string getcity() const { return client_city; } + double getbalance() const { return client_balance; } + double getdonation() const { return client_donation; } + static double gettotaldonation() { return total_donation; } + + // Member function to display transaction history + void displayTransactionHistory() const { + cout << "\nTransaction History for " << client_name << " (ID: " << client_id << ")\n"; + cout << "---------------------------------------\n"; + cout << "Type\tAmount\tTimestamp\n"; + for (const Transaction &transaction : transactionHistory) { + cout << transaction.type << "\t" << transaction.amount << "\t" << transaction.timestamp << endl; + } + } + +private: + // Member function to record a transaction + void recordTransaction(const string &type, double amount) { + time_t now = time(0); + char *timestamp = ctime(&now); + timestamp[strlen(timestamp) - 1] = '\0'; + Transaction transaction; + transaction.type = type; + transaction.amount = amount; + transaction.timestamp = timestamp; + transactionHistory.push_back(transaction); + } +}; + +double Bank::total_donation = 0.0; + +int main() { + vector clients; + + int ch = 1; + cout << "\n\n----------------| Welcome to Naman's Bank of India |----------------\n"; + int selectedClient = -1; + int selectedClientInfo = -1; + string city; + + do { + cout << "\nPress 0. Exit\n"; + cout << "Press 1. Select Client\n"; + cout << "Press 2. View Max Donation\n"; + cout << "Press 3. Search By City\n"; + cout << "Press 4. Total Donation\n"; + cout << "Press 5. Display Info\n"; + cout << "Press 6. Create New Account\n"; + cout << "Press 7. Add Funds to Account\n"; + cout << "Press 8. Make a Donation\n"; + cout << "--> "; + cin >> ch; + + switch (ch) { + case 1: + cout << "\nSelect Client (1 to " << clients.size() << "): "; + cin >> selectedClient; + if (selectedClient >= 1 && static_cast(selectedClient) <= clients.size()) { + cout << "\nSelected client: " << clients[selectedClient - 1].getname() << " (ID: " + << clients[selectedClient - 1].getid() << ")\n"; + + int clientOption = -1; + while (clientOption != 2) { + cout << "Press 1 to Make a Donation\n"; + cout << "Press 2 to Add Funds to Account\n"; + cout << "Press 3 to Go Back\n"; + cout << "--> "; + cin >> clientOption; + + switch (clientOption) { + case 1: + double donationAmount; + cout << "\nEnter donation amount: "; + cin >> donationAmount; + + if (donationAmount > 0) { + if (donationAmount <= clients[selectedClient - 1].getbalance()) { + clients[selectedClient - 1].donate(donationAmount); + cout << "Donation of Rs. " << donationAmount << " /- has been successfully made by " << clients[selectedClient - 1].getname() << "\nThanks for the Donation !" << endl; + } else { + cout << "Insufficient balance. Cannot make the donation.\n"; + } + } else { + cout << "Invalid donation amount. Donation amount must be greater than 0.\n"; + } + break; + + case 2: + double creditAmount; + cout << "\nEnter the amount to add to the balance: "; + cin >> creditAmount; + + if (creditAmount > 0) { + clients[selectedClient - 1].credit(creditAmount); + cout << "\nRs. " << creditAmount << " /- has been successfully added to the balance of " << clients[selectedClient - 1].getname() << endl; + } else { + cout << "Invalid credit amount. Amount must be greater than 0.\n"; + } + break; + + case 3: + // Go back to the main menu. + break; + + default: + cout << "Invalid option. Please select 1 to make a donation, 2 to add funds, or 3 to go back.\n"; + } + } + } else { + cout << "\nInvalid client selection\n"; + } + break; + + case 2: + // Implement logic to find the client with the maximum donation and display their info. + { + Bank *clientWithMaxDonation = nullptr; + double maxDonation = -1.0; + for (Bank &client : clients) { + if (client.getdonation() > maxDonation) { + maxDonation = client.getdonation(); + clientWithMaxDonation = &client; + } + } + if (clientWithMaxDonation) { + cout << "\nClient with Max Donation: " << clientWithMaxDonation->getname() << " (ID: " + << clientWithMaxDonation->getid() << ")\n"; + } else { + cout << "No clients with donations found.\n"; + } + } + break; + + case 3: + // Implement logic to find the client with the maximum donation and display their info. + { + Bank *clientWithMaxDonation = nullptr; + double maxDonation = -1.0; + for (Bank &client : clients) { + if (client.getdonation() > maxDonation) { + maxDonation = client.getdonation(); + clientWithMaxDonation = &client; + } + } + if (clientWithMaxDonation) { + cout << "\nClient with Max Donation: " << clientWithMaxDonation->getname() << " (ID: " + << clientWithMaxDonation->getid() << ")\n"; + } else { + cout << "No clients with donations found.\n"; + } + } + break; + + case 4: + cout << "\nTotal Donations: " << Bank::gettotaldonation() << endl; + break; + + case 5: + cout << "\nSelect Client Info (1 to " << clients.size() << "): "; + cin >> selectedClientInfo; + if (selectedClientInfo >= 1 && static_cast(selectedClientInfo) <= clients.size()) { + clients[selectedClientInfo - 1].displayTransactionHistory(); + } else { + cout << "\nInvalid client selection\n"; + } + break; + + case 6: + // Create a new account + if (clients.size() < 10) { + cout << "\nCreate a New Account\n"; + Bank newClient; + newClient.setDetails(); + clients.push_back(newClient); + } else { + cout << "\nAccount limit reached. Cannot create more accounts." << endl; + } + break; + + case 7: + // Adds Funds in the client's Account + if (selectedClient != -1) { + double creditAmount; + cout << "\nEnter the amount to add to the balance: "; + cin >> creditAmount; + + if (creditAmount > 0) { + clients[selectedClient - 1].credit(creditAmount); + cout << fixed << "\nRs. " << setprecision(2) << creditAmount << " /- has been successfully added to the balance of " << clients[selectedClient - 1].getname() << endl; + } else { + cout << "Invalid credit amount. Amount must be greater than 0.\n"; + } + } else { + cout << "Please select a client before adding funds.\n"; + } + break; + + case 8: + // Adds Donations + if (selectedClient != -1) { + double donationAmount; + cout << "Enter donation amount: "; + cin >> donationAmount; + + if (donationAmount > 0) { + if (donationAmount <= clients[selectedClient - 1].getbalance()) { + clients[selectedClient - 1].donate(donationAmount); + cout << "Donation of Rs. " << donationAmount << " has been successfully made by " << clients[selectedClient - 1].getname() << endl; + } else { + cout << "Insufficient balance. Cannot make the donation.\n"; + } + } else { + cout << "Invalid donation amount. Donation amount must be greater than 0.\n"; + } + } else { + cout << "Please select a client before making a donation.\n"; + } + break; + + default: + cout << "\nThank you for using Naman's Bank of India\n"; + cout << "Do visit us Again !\n\n"; + } + } while (ch != 0); + + system("pause"); + return 0; } \ No newline at end of file diff --git a/C++/Bank Management System/README.md b/C++/Bank Management System/README.md index 9f33899..0ebf304 100644 --- a/C++/Bank Management System/README.md +++ b/C++/Bank Management System/README.md @@ -1,38 +1,38 @@ -# Bank Management System - -This Bank Management System is a simple command-line program written in C++ that allows users to perform various banking operations. It was created by [NamanOG](https://github.com/NamanOG). - -## Features - -- Create and manage multiple bank client accounts. -- Perform operations such as debit, credit, and donation on client accounts. -- View the transaction history of each client. -- Find clients with the maximum donation. -- Search for clients by city. -- Keep track of the total donation across all clients. - -## How to Use - -1. Compile the code using a C++ compiler (e.g., g++).
-g++ bank_management.cpp -o bank_management - -2. Run the program.
-./bank_management - -3. Follow the on-screen menu to navigate and perform various banking operations. - -## Usage Instructions - -- Press `1` to select a client and view their details. -- Press `2` to find the client with the maximum donation. -- Press `3` to search for clients by city. -- Press `4` to view the total donation across all clients. -- Press `5` to display the transaction history of a selected client. -- Press `6` to create a new client account (up to a limit of 10 accounts). -- Press `0` to exit the program. - -## License - -This project is open-source and available under the [MIT License](LICENSE). - -Happy banking! +# Bank Management System + +This Bank Management System is a simple command-line program written in C++ that allows users to perform various banking operations. It was created by [NamanOG](https://github.com/NamanOG). + +## Features + +- Create and manage multiple bank client accounts. +- Perform operations such as debit, credit, and donation on client accounts. +- View the transaction history of each client. +- Find clients with the maximum donation. +- Search for clients by city. +- Keep track of the total donation across all clients. + +## How to Use + +1. Compile the code using a C++ compiler (e.g., g++).
+g++ bank_management.cpp -o bank_management + +2. Run the program.
+./bank_management + +3. Follow the on-screen menu to navigate and perform various banking operations. + +## Usage Instructions + +- Press `1` to select a client and view their details. +- Press `2` to find the client with the maximum donation. +- Press `3` to search for clients by city. +- Press `4` to view the total donation across all clients. +- Press `5` to display the transaction history of a selected client. +- Press `6` to create a new client account (up to a limit of 10 accounts). +- Press `0` to exit the program. + +## License + +This project is open-source and available under the [MIT License](LICENSE). + +Happy banking! diff --git a/C++/C++_STL_Explaination.cpp b/C++/C++_STL_Explaination.cpp index ea1eeee..d1fa924 100644 --- a/C++/C++_STL_Explaination.cpp +++ b/C++/C++_STL_Explaination.cpp @@ -1,151 +1,151 @@ -#include -#include -using namespace std; -void learnpair() -{ - pairp={1,3}; - cout<>n={1,{4,5}}; - pairarr[]={{1,2},{2,3},{3,4},{4,5}}; - cout< v; - v.push_back(10); - v.push_back(20); - v.push_back(30); - v.push_back(40); - v.push_back(50); - /*Method-1 For Iteration */ - for(vector:: iterator it=v.begin();it!=v.end();it++) - { - cout<<*(it)<<" "; - } - cout<<"\n"; - /*Deletion in a vector */ - v.erase(v.begin()+1); - /*Method-2 For Iteration*/ - for(auto it :v) - { - cout<<(it)<<" "; - } - cout<<"\n"; - /*Deletion in a vector */ - v.erase(v.begin()+0,v.begin()+2); - /*Method-3 for Iteration*/ - for(auto it=v.begin();it!=v.end();it++) - { - cout<< *(it)<<" "; - } - cout<<"\n"; - v.push_back(30); - v.push_back(40); - v.push_back(50); - v.push_back(60); - for(auto it :v) - cout<<(it)<<" "; - cout<<"\n"; - /*Insert Functions*/ - /*Supose i create a vector and i want to insert it to another vector*/ - vectorvc(2,80); - v.insert(v.begin()+1,vc.begin(),vc.end()); - for(auto it :v) - cout<<(it)<<" "; - cout<<"\n"; - /*sppose i want to insert a particular number at a particular position */ - v.insert(v.begin()+3,73); - for(vector::iterator it=v.begin();it!=v.end();it++) - cout<< *(it)<<" "; - cout << "\n"; - /*Suppose i want to insert the number in the beginning */ - v.insert(v.begin()+0,12); - for (vector::iterator it = v.begin(); it != v.end(); it++) - cout << *(it) << " "; - cout<<"\n"; - /*Suppose i want to know the size of the element */ - cout<::iterator it = v.begin(); it != v.end(); it++) - cout << *(it) << " "; - cout << "\n"; - /*How to erase the elements inside the container*/ - for(auto it :vc) - cout<<(it)<<" "; - vc.clear(); - cout<<"\nIs the above container empty ??"<ls; - ls.push_back(1); - ls.push_back(2); - ls.push_back(3); - ls.push_back(4); - ls.emplace_back(5); - ls.push_front(0); - for(auto it :ls) - cout<<(it)<<" "; - cout<<"\n"; -} -void learndeque() -{ - dequedq; - dq.push_back(10); - dq.emplace_back(20); - dq.push_front(30); - dq.emplace_front(100); - for(deque::iterator it=dq.begin();it!=dq.end();it++) - cout<<*(it)<<" "; - cout<<"\n"; - cout<::iterator it = dq.begin(); it != dq.end(); it++) - cout << *(it) << " "; - cout<<"\n"; - cout<::iterator it = dq.begin(); it != dq.end(); it++) - cout << *(it) << " "; - cout<<"\n"; -} -void learnstack() -{ - stackst; - /*Insertion in stack */ - st.push(1); - st.push(2); - st.push(3); - st.push(4); - st.push(5); - /*Operations can be done on the top of the stack */ - st.top()*=5; - /*Print what is at the top of the stack*/ - cout<st1,st2; - st1.push(1); - st2.push(2); - st2.push(3); - st2.push(4); - st1.swap(st2); - cout< +#include +using namespace std; +void learnpair() +{ + pairp={1,3}; + cout<>n={1,{4,5}}; + pairarr[]={{1,2},{2,3},{3,4},{4,5}}; + cout< v; + v.push_back(10); + v.push_back(20); + v.push_back(30); + v.push_back(40); + v.push_back(50); + /*Method-1 For Iteration */ + for(vector:: iterator it=v.begin();it!=v.end();it++) + { + cout<<*(it)<<" "; + } + cout<<"\n"; + /*Deletion in a vector */ + v.erase(v.begin()+1); + /*Method-2 For Iteration*/ + for(auto it :v) + { + cout<<(it)<<" "; + } + cout<<"\n"; + /*Deletion in a vector */ + v.erase(v.begin()+0,v.begin()+2); + /*Method-3 for Iteration*/ + for(auto it=v.begin();it!=v.end();it++) + { + cout<< *(it)<<" "; + } + cout<<"\n"; + v.push_back(30); + v.push_back(40); + v.push_back(50); + v.push_back(60); + for(auto it :v) + cout<<(it)<<" "; + cout<<"\n"; + /*Insert Functions*/ + /*Supose i create a vector and i want to insert it to another vector*/ + vectorvc(2,80); + v.insert(v.begin()+1,vc.begin(),vc.end()); + for(auto it :v) + cout<<(it)<<" "; + cout<<"\n"; + /*sppose i want to insert a particular number at a particular position */ + v.insert(v.begin()+3,73); + for(vector::iterator it=v.begin();it!=v.end();it++) + cout<< *(it)<<" "; + cout << "\n"; + /*Suppose i want to insert the number in the beginning */ + v.insert(v.begin()+0,12); + for (vector::iterator it = v.begin(); it != v.end(); it++) + cout << *(it) << " "; + cout<<"\n"; + /*Suppose i want to know the size of the element */ + cout<::iterator it = v.begin(); it != v.end(); it++) + cout << *(it) << " "; + cout << "\n"; + /*How to erase the elements inside the container*/ + for(auto it :vc) + cout<<(it)<<" "; + vc.clear(); + cout<<"\nIs the above container empty ??"<ls; + ls.push_back(1); + ls.push_back(2); + ls.push_back(3); + ls.push_back(4); + ls.emplace_back(5); + ls.push_front(0); + for(auto it :ls) + cout<<(it)<<" "; + cout<<"\n"; +} +void learndeque() +{ + dequedq; + dq.push_back(10); + dq.emplace_back(20); + dq.push_front(30); + dq.emplace_front(100); + for(deque::iterator it=dq.begin();it!=dq.end();it++) + cout<<*(it)<<" "; + cout<<"\n"; + cout<::iterator it = dq.begin(); it != dq.end(); it++) + cout << *(it) << " "; + cout<<"\n"; + cout<::iterator it = dq.begin(); it != dq.end(); it++) + cout << *(it) << " "; + cout<<"\n"; +} +void learnstack() +{ + stackst; + /*Insertion in stack */ + st.push(1); + st.push(2); + st.push(3); + st.push(4); + st.push(5); + /*Operations can be done on the top of the stack */ + st.top()*=5; + /*Print what is at the top of the stack*/ + cout<st1,st2; + st1.push(1); + st2.push(2); + st2.push(3); + st2.push(4); + st1.swap(st2); + cout< -using namespace std; - -// Define a structure for a singly-linked list node. -struct Node -{ - int data; // Data stored in the node. - struct Node *next; // Pointer to the next node in the list. -}; - -// Function to display the elements of a linked list. -void display(struct Node *ptr) -{ - while (ptr != NULL) - { - cout << ptr->data; - ptr = ptr->next; - if (ptr != NULL) - cout << "->"; - } -} - -// Function to insert a node with 'data' at a specified 'index' in the linked list. -struct Node *insert_mid(struct Node *head, int data, int index) -{ - struct Node *ptr = (struct Node *)malloc(sizeof(struct Node)); // Allocate memory for the new node. - struct Node *temp = head; - int i = 1; - while (i != index) - { - temp = temp->next; - i++; - } - ptr->data = data; - ptr->next = temp->next; - temp->next = ptr; - return head; -} - -// Function to search for a specific 'data' value in the linked list. -struct Node *search(struct Node *ptr, int data) -{ - struct Node *temp = ptr; - int location = 1; - while (ptr->next != NULL) - { - if (ptr->data == data) - { - cout << location; - break; - } - ptr = ptr->next; - location++; - } -} - -// Function to insert a node with 'data' before the last node in the linked list. -struct Node *insertBeforeLast(struct Node *head, int data) -{ - struct Node *ptr = head; - struct Node *ptr1 = head->next; - struct Node *temp = (struct Node *)malloc(sizeof(struct Node)); // Allocate memory for the new node. - temp->data = data; - - while (ptr1->next != NULL) - { - ptr = ptr->next; - ptr1 = ptr->next; - } - ptr->next = temp; - temp->next = ptr1; -} - -// Function to delete the first node in the linked list. -struct Node *delete_node(struct Node *head) -{ - if (head == NULL) - { - cout << "List is empty. Cannot delete." << endl; - return head; - } - - struct Node *temp = head; - head = head->next; // Update 'head' to point to the second node. - // free(temp); // Free the memory of the deleted node. - display(head); -} - -// Function to create and manipulate the linked list. -void create() -{ - struct Node *head; - struct Node *first; - struct Node *second; - struct Node *third; - - // Create nodes and link them to form a linked list. - head = (struct Node *)malloc(sizeof(struct Node)); - first = (struct Node *)malloc(sizeof(struct Node)); - second = (struct Node *)malloc(sizeof(struct Node)); - third = (struct Node *)malloc(sizeof(struct Node)); - - head->data = 1; - head->next = first; - - first->data = 3; - first->next = second; - - second->data = 3; - second->next = NULL; - - // Display the initial linked list. - cout << "Linked List before any operation: "; - display(head); - cout << endl; - - cout << "Linked List Desired location operation: "; - insert_mid(head, 22, 2); //(key to add=22,index=2) - display(head); - cout << endl; - - cout << "Location of node with Key=22: "; - search(head, 22); //(key to search=3) - cout << endl; - - cout << "Insert after last node: "; - insertBeforeLast(head, -4); //(key to insert=-4) - display(head); - cout << endl; - - cout << "After Deleting first node: "; - delete_node(head); - - cout << endl; -} - -int main() -{ - create(); // Call the create function to set up and manipulate the linked list. - return 0; -} +#include +using namespace std; + +// Define a structure for a singly-linked list node. +struct Node +{ + int data; // Data stored in the node. + struct Node *next; // Pointer to the next node in the list. +}; + +// Function to display the elements of a linked list. +void display(struct Node *ptr) +{ + while (ptr != NULL) + { + cout << ptr->data; + ptr = ptr->next; + if (ptr != NULL) + cout << "->"; + } +} + +// Function to insert a node with 'data' at a specified 'index' in the linked list. +struct Node *insert_mid(struct Node *head, int data, int index) +{ + struct Node *ptr = (struct Node *)malloc(sizeof(struct Node)); // Allocate memory for the new node. + struct Node *temp = head; + int i = 1; + while (i != index) + { + temp = temp->next; + i++; + } + ptr->data = data; + ptr->next = temp->next; + temp->next = ptr; + return head; +} + +// Function to search for a specific 'data' value in the linked list. +struct Node *search(struct Node *ptr, int data) +{ + struct Node *temp = ptr; + int location = 1; + while (ptr->next != NULL) + { + if (ptr->data == data) + { + cout << location; + break; + } + ptr = ptr->next; + location++; + } +} + +// Function to insert a node with 'data' before the last node in the linked list. +struct Node *insertBeforeLast(struct Node *head, int data) +{ + struct Node *ptr = head; + struct Node *ptr1 = head->next; + struct Node *temp = (struct Node *)malloc(sizeof(struct Node)); // Allocate memory for the new node. + temp->data = data; + + while (ptr1->next != NULL) + { + ptr = ptr->next; + ptr1 = ptr->next; + } + ptr->next = temp; + temp->next = ptr1; +} + +// Function to delete the first node in the linked list. +struct Node *delete_node(struct Node *head) +{ + if (head == NULL) + { + cout << "List is empty. Cannot delete." << endl; + return head; + } + + struct Node *temp = head; + head = head->next; // Update 'head' to point to the second node. + // free(temp); // Free the memory of the deleted node. + display(head); +} + +// Function to create and manipulate the linked list. +void create() +{ + struct Node *head; + struct Node *first; + struct Node *second; + struct Node *third; + + // Create nodes and link them to form a linked list. + head = (struct Node *)malloc(sizeof(struct Node)); + first = (struct Node *)malloc(sizeof(struct Node)); + second = (struct Node *)malloc(sizeof(struct Node)); + third = (struct Node *)malloc(sizeof(struct Node)); + + head->data = 1; + head->next = first; + + first->data = 3; + first->next = second; + + second->data = 3; + second->next = NULL; + + // Display the initial linked list. + cout << "Linked List before any operation: "; + display(head); + cout << endl; + + cout << "Linked List Desired location operation: "; + insert_mid(head, 22, 2); //(key to add=22,index=2) + display(head); + cout << endl; + + cout << "Location of node with Key=22: "; + search(head, 22); //(key to search=3) + cout << endl; + + cout << "Insert after last node: "; + insertBeforeLast(head, -4); //(key to insert=-4) + display(head); + cout << endl; + + cout << "After Deleting first node: "; + delete_node(head); + + cout << endl; +} + +int main() +{ + create(); // Call the create function to set up and manipulate the linked list. + return 0; +} diff --git a/C++/Min_Flips.cpp b/C++/Min_Flips.cpp index 2fe7aff..15948a6 100644 --- a/C++/Min_Flips.cpp +++ b/C++/Min_Flips.cpp @@ -1,40 +1,40 @@ -#include -#include - -using namespace std; - -int solve(string s) { - int len = s.size(), w = 0, b = 0, mul = 1, res = 0; - stack st; - for(char c : s) { - if(c == '+') { - st.push(1); - w++; - } - else { - st.push(-1); - } - } - b = len - w; - while(!st.empty() && b != 0) { - if(st.top() * mul == 1) - w--; - else { - res++; - b--; - swap(b, w); - mul *= -1; - } - st.pop(); - } - return res; -} - -int main() -{ - string s; - cin >> s; - cout << solve(s); - - return 0; -} +#include +#include + +using namespace std; + +int solve(string s) { + int len = s.size(), w = 0, b = 0, mul = 1, res = 0; + stack st; + for(char c : s) { + if(c == '+') { + st.push(1); + w++; + } + else { + st.push(-1); + } + } + b = len - w; + while(!st.empty() && b != 0) { + if(st.top() * mul == 1) + w--; + else { + res++; + b--; + swap(b, w); + mul *= -1; + } + st.pop(); + } + return res; +} + +int main() +{ + string s; + cin >> s; + cout << solve(s); + + return 0; +} diff --git a/C++/Minimum_coin_change.cpp b/C++/Minimum_coin_change.cpp index 4f64f07..3e775af 100644 --- a/C++/Minimum_coin_change.cpp +++ b/C++/Minimum_coin_change.cpp @@ -1,66 +1,66 @@ -#include -using namespace std; - -int count(vector &arr, vector &dp, int n, int m) -{ - // Base case: If the desired sum 'm' is 0, no coins are needed. - if (m == 0) - return 0; - - // If the result for this sum 'm' has already been computed, return it. - if (dp[m] != -1) - return dp[m]; - - // Initialize 'ans' to a large value as a placeholder for the minimum. - int ans = INT_MAX; - - // Iterate through each available coin to consider using it. - for (int i = 0; i < n; i++) - { - // Check if the current coin value 'arr[i]' can be subtracted from 'm'. - if (m - arr[i] >= 0) - { - // Recursively find the minimum number of coins for the reduced sum. - int val = count(arr, dp, n, m - arr[i]); - - // If 'val' is not INT_MAX (i.e., a valid solution exists) and - // 'val + 1' is smaller than the current 'ans', update 'ans'. - if (val != INT_MAX && val + 1 < ans) - ans = val + 1; - } - } - - // Store the result in 'dp' to avoid recomputation and return 'ans'. - dp[m] = ans; - return ans; -} - -int main() -{ - int n, m; - // 'n' is the number of available coins. - // 'm' is the total sum we have to achive. - cin >> n >> m; - - vector arr; - // Input the values of 'n' coins. - for (int i = 0; i < n; i++) - { - int x; - cin >> x; - arr.push_back(x); - } - - // Initialize the memoization array 'dp' with -1. - vector dp(m + 1, -1); - - // Call the 'count' function to find the minimum number of coins needed. - int val = count(arr, dp, n, m); - - // If a valid solution exists (i.e., 'val' is not INT_MAX), print the result. - if (val != INT_MAX) - cout << val; - // If it's not possible to make the desired sum, print "-1". - else - cout << "-1"; -} +#include +using namespace std; + +int count(vector &arr, vector &dp, int n, int m) +{ + // Base case: If the desired sum 'm' is 0, no coins are needed. + if (m == 0) + return 0; + + // If the result for this sum 'm' has already been computed, return it. + if (dp[m] != -1) + return dp[m]; + + // Initialize 'ans' to a large value as a placeholder for the minimum. + int ans = INT_MAX; + + // Iterate through each available coin to consider using it. + for (int i = 0; i < n; i++) + { + // Check if the current coin value 'arr[i]' can be subtracted from 'm'. + if (m - arr[i] >= 0) + { + // Recursively find the minimum number of coins for the reduced sum. + int val = count(arr, dp, n, m - arr[i]); + + // If 'val' is not INT_MAX (i.e., a valid solution exists) and + // 'val + 1' is smaller than the current 'ans', update 'ans'. + if (val != INT_MAX && val + 1 < ans) + ans = val + 1; + } + } + + // Store the result in 'dp' to avoid recomputation and return 'ans'. + dp[m] = ans; + return ans; +} + +int main() +{ + int n, m; + // 'n' is the number of available coins. + // 'm' is the total sum we have to achive. + cin >> n >> m; + + vector arr; + // Input the values of 'n' coins. + for (int i = 0; i < n; i++) + { + int x; + cin >> x; + arr.push_back(x); + } + + // Initialize the memoization array 'dp' with -1. + vector dp(m + 1, -1); + + // Call the 'count' function to find the minimum number of coins needed. + int val = count(arr, dp, n, m); + + // If a valid solution exists (i.e., 'val' is not INT_MAX), print the result. + if (val != INT_MAX) + cout << val; + // If it's not possible to make the desired sum, print "-1". + else + cout << "-1"; +} diff --git a/C++/Stack.cpp b/C++/Stack.cpp index efae994..19f7bee 100644 --- a/C++/Stack.cpp +++ b/C++/Stack.cpp @@ -1,85 +1,85 @@ -#include -using namespace std; - -// Define a structure for a stack -struct stack -{ - int size; // The size of the stack - int top; // The index of the top element - int *arr; // Pointer to an array to store the elements -}; - -// Function to check if the stack is empty -bool isEmpty(struct stack *ptr) -{ - if (ptr->top == -1) // If the top is -1, the stack is empty - return true; - return false; -} - -// Function to check if the stack is full -bool isFull(struct stack *ptr) -{ - if (ptr->top == (ptr->size - 1)) // If the top is equal to size - 1, the stack is full - return true; - return false; -} - -// Function to display the elements in the stack -void display(struct stack *ptr) -{ - for (int i = 0; i <= ptr->top; i++) - { - cout << ptr->arr[i] << " "; - } - cout << endl; -} - -// Function to push an element onto the stack -int push(struct stack *ptr, int data) -{ - if (isFull(ptr)) // Check if the stack is full - { - cout << "Overflow" << endl; // Print an overflow message if it's full - } - else - { - ptr->top++; // Increment the top index - ptr->arr[ptr->top] = data; // Store the data at the top index - display(ptr); // Display the stack after pushing the element - } -} - -// Function to pop an element from the stack -int pop(struct stack *ptr) -{ - if (isEmpty(ptr)) // Check if the stack is empty - { - cout << "Stack is empty"; // Print a message indicating the stack is empty - } - else - { - ptr->top--; // Decrement the top index to simulate popping an element - } - display(ptr); // Display the stack after popping -} - -int main() -{ - struct stack *s = new stack; // Create a stack using a pointer - s->size = 5; // Set the size of the stack - s->top = -1; // Initialize the top index to -1 to indicate an empty stack - s->arr = new int[s->size]; // Create an array to store the elements - - push(s, 1); // Push 1 onto the stack - push(s, 2); // Push 2 onto the stack - push(s, 3); // Push 3 onto the stack - pop(s); // Pop an element from the stack - pop(s); // Pop another element from the stack - pop(s); // Pop another element from the stack - - delete[] s->arr; // Deallocate the dynamically allocated array - delete s; // Deallocate the dynamically allocated stack structure - - return 0; -} +#include +using namespace std; + +// Define a structure for a stack +struct stack +{ + int size; // The size of the stack + int top; // The index of the top element + int *arr; // Pointer to an array to store the elements +}; + +// Function to check if the stack is empty +bool isEmpty(struct stack *ptr) +{ + if (ptr->top == -1) // If the top is -1, the stack is empty + return true; + return false; +} + +// Function to check if the stack is full +bool isFull(struct stack *ptr) +{ + if (ptr->top == (ptr->size - 1)) // If the top is equal to size - 1, the stack is full + return true; + return false; +} + +// Function to display the elements in the stack +void display(struct stack *ptr) +{ + for (int i = 0; i <= ptr->top; i++) + { + cout << ptr->arr[i] << " "; + } + cout << endl; +} + +// Function to push an element onto the stack +int push(struct stack *ptr, int data) +{ + if (isFull(ptr)) // Check if the stack is full + { + cout << "Overflow" << endl; // Print an overflow message if it's full + } + else + { + ptr->top++; // Increment the top index + ptr->arr[ptr->top] = data; // Store the data at the top index + display(ptr); // Display the stack after pushing the element + } +} + +// Function to pop an element from the stack +int pop(struct stack *ptr) +{ + if (isEmpty(ptr)) // Check if the stack is empty + { + cout << "Stack is empty"; // Print a message indicating the stack is empty + } + else + { + ptr->top--; // Decrement the top index to simulate popping an element + } + display(ptr); // Display the stack after popping +} + +int main() +{ + struct stack *s = new stack; // Create a stack using a pointer + s->size = 5; // Set the size of the stack + s->top = -1; // Initialize the top index to -1 to indicate an empty stack + s->arr = new int[s->size]; // Create an array to store the elements + + push(s, 1); // Push 1 onto the stack + push(s, 2); // Push 2 onto the stack + push(s, 3); // Push 3 onto the stack + pop(s); // Pop an element from the stack + pop(s); // Pop another element from the stack + pop(s); // Pop another element from the stack + + delete[] s->arr; // Deallocate the dynamically allocated array + delete s; // Deallocate the dynamically allocated stack structure + + return 0; +} diff --git a/C++/To_find_keyword.c b/C++/To_find_keyword.c index 2c35b4f..d8524bf 100644 --- a/C++/To_find_keyword.c +++ b/C++/To_find_keyword.c @@ -1,48 +1,48 @@ -#include -#include -#include -#include -void main() -{ - int i,j,count=0; - char c='\n'; - char ch; - FILE *fp; - char Keyword[32][15]={ - "extern","return","union","const","float","short", - "auto","double","int","struct","break","else","long", - "goto","sizeof","voltile","do","if","static","while", - "unsigned","continue","for","signed","void","default", - "switch","case","enum","register","typedef","char" - }; - fp=fopen("file.txt","w"); - if(fp==NULL) - { - printf("File not exist"); - exit(1); - } - for(i=0;i<32;i++) - { - for(j=0;j +#include +#include +#include +void main() +{ + int i,j,count=0; + char c='\n'; + char ch; + FILE *fp; + char Keyword[32][15]={ + "extern","return","union","const","float","short", + "auto","double","int","struct","break","else","long", + "goto","sizeof","voltile","do","if","static","while", + "unsigned","continue","for","signed","void","default", + "switch","case","enum","register","typedef","char" + }; + fp=fopen("file.txt","w"); + if(fp==NULL) + { + printf("File not exist"); + exit(1); + } + for(i=0;i<32;i++) + { + for(j=0;jsum=sum+arr[i] -// 2>maxi=maximum of sum and maxi -// 3>if sum<0 put sum=0 - -#include -using namespace std; - -int maxSubArray(vector &array) -{ - int curr_sum = 0; - int max_sum = array[0]; - for (int i = 0; i < array.size(); i++) - { - curr_sum += array[i]; - max_sum = max(max_sum, curr_sum); - if (curr_sum < 0) - curr_sum = 0; - } - - return max_sum; -} -int main() -{ - int size_array; - cin >> size_array; - vector array; - for (int i = 0; i < size_array; i++) - { - int x; - cin >> x; - array.push_back(x); - } - - cout << maxSubArray(array); - - return 0; -} +// Kadane's Algorithm is used to solve the famous problem - Maximum Subarray Sum +// maxi=arr[0] +// sum=0 +// 1>sum=sum+arr[i] +// 2>maxi=maximum of sum and maxi +// 3>if sum<0 put sum=0 + +#include +using namespace std; + +int maxSubArray(vector &array) +{ + int curr_sum = 0; + int max_sum = array[0]; + for (int i = 0; i < array.size(); i++) + { + curr_sum += array[i]; + max_sum = max(max_sum, curr_sum); + if (curr_sum < 0) + curr_sum = 0; + } + + return max_sum; +} +int main() +{ + int size_array; + cin >> size_array; + vector array; + for (int i = 0; i < size_array; i++) + { + int x; + cin >> x; + array.push_back(x); + } + + cout << maxSubArray(array); + + return 0; +} diff --git a/Contributershub b/Contributershub deleted file mode 160000 index 913ef58..0000000 --- a/Contributershub +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 913ef58a84bb2b476bb0915ce85302ca0dcc562e diff --git a/DSA projects/RSA Encryption/cipherText.txt b/DSA projects/RSA Encryption/cipherText.txt index 15a333a..314de2d 100644 --- a/DSA projects/RSA Encryption/cipherText.txt +++ b/DSA projects/RSA Encryption/cipherText.txt @@ -1,9 +1,9 @@ -MOTMSOT ALO WSO. -TKTJY SMMOLSCDFKB AOLJ KLOQD-TSPQ. -TKTJY QOLLM PFZT TPQFJSQTR QL ET 20000. -SOJTR WFQD PTFBT WTSMLKP. -TPQFJSQTR SOOFVSI 2 RSYP. - - - - +MOTMSOT ALO WSO. +TKTJY SMMOLSCDFKB AOLJ KLOQD-TSPQ. +TKTJY QOLLM PFZT TPQFJSQTR QL ET 20000. +SOJTR WFQD PTFBT WTSMLKP. +TPQFJSQTR SOOFVSI 2 RSYP. + + + + diff --git a/DSA projects/RSA Encryption/decipherText.txt b/DSA projects/RSA Encryption/decipherText.txt index ae69ab7..7619e53 100644 --- a/DSA projects/RSA Encryption/decipherText.txt +++ b/DSA projects/RSA Encryption/decipherText.txt @@ -1,9 +1,9 @@ -PREPARE FOR WAR. -ENEMY APPROACHING FROM NORTH-EAST. -ENEMY TROOP SIZE ESTIMATED TO BE 20000. -ARMED WITH SEIGE WEAPONS. -ESTIMATED ARRIVAL 2 DAYS. - - - - +PREPARE FOR WAR. +ENEMY APPROACHING FROM NORTH-EAST. +ENEMY TROOP SIZE ESTIMATED TO BE 20000. +ARMED WITH SEIGE WEAPONS. +ESTIMATED ARRIVAL 2 DAYS. + + + + diff --git a/DSA projects/RSA Encryption/main.cpp b/DSA projects/RSA Encryption/main.cpp index 7ef5e47..0863756 100644 --- a/DSA projects/RSA Encryption/main.cpp +++ b/DSA projects/RSA Encryption/main.cpp @@ -1,259 +1,259 @@ -#include -#include -#include - -using namespace std; -int arr[16],cm[16]; - -int gcd(int a, int b) //Finds the HCF of e and phi -{ - int t; - while(1) { - t= a%b; - if(t==0) - return b; - a = b; - b = t; - } -} - -int find_d(int e, int phi) //Finds d such that (d*e) % phi = 1 -{ - int d=2; - while((d*e)%phi!=1) - { - d++; - } - return d; -} - -void string_to_ascii(string a) //Converts string to ascii -{ - for(int i=0;i=32 && num<=122) - { - char ch=(char)num; - b+=ch; - num = 0; - } - } - return b; -} - -string encoder(string key) //Generates encoded string for KW Cipher -{ - string encoded = ""; - // This array represents the - // 26 letters of alphabets - bool arr1[26] = {0}; - - // This loop inserts the keyword - // at the start of the encoded string - for (int i=0; i= 'A' && key[i] <= 'Z') - { - // To check whether the character is inserted - // earlier in the encoded string or not - if (arr1[key[i]-65] == 0) - { - encoded += key[i]; - arr1[key[i]-65] = 1; - } - } - else if (key[i] >= 'a' && key[i] <= 'z') - { - if (arr1[key[i]-97] == 0) - { - encoded += key[i] - 32; - arr1[key[i]-97] = 1; - } - } - } - - // This loop inserts the remaining - // characters in the encoded string. - for (int i=0; i<26; i++) - { - if(arr1[i] == 0) - { - arr1[i]=1; - encoded += char(i + 65); - } - } - return encoded; -} - -string kwc_encrypt(string msg, string encoded) //Encryption using Keyword Cipher -{ - string cipher=""; - - // This loop ciphered the message. - // Spaces, special characters and numbers remain same. - for (int i=0; i='a' && msg[i] <='z') - { - int pos = msg[i] - 97; - cipher += encoded[pos]; - } - else if (msg[i] >='A' && msg[i] <='Z') - { - int pos = msg[i] - 65; - cipher += encoded[pos]; - } - else - { - cipher += msg[i]; - } - } - return cipher; -} - -string kwc_decrypt(string ct, string encoded) //Decryption using Keyword Cipher -{ - string decipher=""; - - for (int i=0; i='A' && ct[i] <='Z') - { - char ch = j+65; - decipher += ch; - } - else - { - decipher += ct[i]; - } - } - return decipher; -} - -int cdn( int c, int d, int n ) // works out c^d mod n -{ - int value = 1; - while( d > 0 ) - { - value *= c; - value %= n; - d--; - } - return value; -} - -int main() // Driver Code -{ - //2 random prime numbers - double p = 13; - double q = 11; - double n=p*q; - double track; - double phi= (p-1)*(q-1); - - //public key e stands for encrypt - //for checking that 1 < e < phi(n) and gcd(e, phi(n)) = 1; i.e., e and phi(n) are coprime. - - long double e=7; - while(e +#include +#include + +using namespace std; +int arr[16],cm[16]; + +int gcd(int a, int b) //Finds the HCF of e and phi +{ + int t; + while(1) { + t= a%b; + if(t==0) + return b; + a = b; + b = t; + } +} + +int find_d(int e, int phi) //Finds d such that (d*e) % phi = 1 +{ + int d=2; + while((d*e)%phi!=1) + { + d++; + } + return d; +} + +void string_to_ascii(string a) //Converts string to ascii +{ + for(int i=0;i=32 && num<=122) + { + char ch=(char)num; + b+=ch; + num = 0; + } + } + return b; +} + +string encoder(string key) //Generates encoded string for KW Cipher +{ + string encoded = ""; + // This array represents the + // 26 letters of alphabets + bool arr1[26] = {0}; + + // This loop inserts the keyword + // at the start of the encoded string + for (int i=0; i= 'A' && key[i] <= 'Z') + { + // To check whether the character is inserted + // earlier in the encoded string or not + if (arr1[key[i]-65] == 0) + { + encoded += key[i]; + arr1[key[i]-65] = 1; + } + } + else if (key[i] >= 'a' && key[i] <= 'z') + { + if (arr1[key[i]-97] == 0) + { + encoded += key[i] - 32; + arr1[key[i]-97] = 1; + } + } + } + + // This loop inserts the remaining + // characters in the encoded string. + for (int i=0; i<26; i++) + { + if(arr1[i] == 0) + { + arr1[i]=1; + encoded += char(i + 65); + } + } + return encoded; +} + +string kwc_encrypt(string msg, string encoded) //Encryption using Keyword Cipher +{ + string cipher=""; + + // This loop ciphered the message. + // Spaces, special characters and numbers remain same. + for (int i=0; i='a' && msg[i] <='z') + { + int pos = msg[i] - 97; + cipher += encoded[pos]; + } + else if (msg[i] >='A' && msg[i] <='Z') + { + int pos = msg[i] - 65; + cipher += encoded[pos]; + } + else + { + cipher += msg[i]; + } + } + return cipher; +} + +string kwc_decrypt(string ct, string encoded) //Decryption using Keyword Cipher +{ + string decipher=""; + + for (int i=0; i='A' && ct[i] <='Z') + { + char ch = j+65; + decipher += ch; + } + else + { + decipher += ct[i]; + } + } + return decipher; +} + +int cdn( int c, int d, int n ) // works out c^d mod n +{ + int value = 1; + while( d > 0 ) + { + value *= c; + value %= n; + d--; + } + return value; +} + +int main() // Driver Code +{ + //2 random prime numbers + double p = 13; + double q = 11; + double n=p*q; + double track; + double phi= (p-1)*(q-1); + + //public key e stands for encrypt + //for checking that 1 < e < phi(n) and gcd(e, phi(n)) = 1; i.e., e and phi(n) are coprime. + + long double e=7; + while(e 2 || y > 2 || x < 0 || y < 0){ - return false; - } - return board[x][y] == ' '; - } - - private static void showBoard(char[][] board) { - for (char[] chars : board) { - for (char aChar : chars) { - System.out.print(aChar + " | "); - } - System.out.println(); - } - } -} +import java.util.Arrays; +import java.util.Scanner; + +public class Main { + public static void main(String[] args) { + char[][] board = new char[3][3]; + for (char[] chars : board) { + Arrays.fill(chars, ' '); + } + Scanner scanner = new Scanner(System.in); + boolean gameOver = false; + char player = 'X'; + int x = 0; + int y = 0; + while (!gameOver){ + showBoard(board); + System.out.print(player+" enter coordinates : "); + try{ + x = scanner.nextInt(); + y = scanner.nextInt(); + }catch (Exception e){ + System.out.println("invalid input"); + return; + } + + System.out.println(); + if(isValid(board,x,y)){ + board[x][y] = player; + if(isWon(board,player)){ + System.out.println("congratulations "+player+" you won"); + showBoard(board); + gameOver = true; + } + if(movesOver(board)){ + System.out.println("Game Over"); + return; + } + if(player == 'X'){ + player = 'O'; + }else{ + player = 'X'; + } + }else{ + System.out.println("invalid move, try again"); + } + } + } + private static boolean movesOver(char[][] board){ + for (char[] chars : board) { + for (char aChar : chars) { + if (aChar == ' ') { + return false; + } + } + } + return true; + } + + private static boolean isWon(char[][] board, char player) { + + //check for row + for (char[] chars : board) { + if (chars[0] == player && chars[1] == player && chars[2] == player) { + return true; + } + } + + //check for column + for(int col = 0 ; col < board.length ; col++){ + if(board[0][col] == player && board[1][col] == player && board[2][col] == player ){ + return true; + } + } + + for(int row = 0 ; row < board.length ; row++){ + if(board[0][0] == player && board[1][1] == player && board[2][2] == player){ + return true; + } + if(board[0][2] == player && board[1][1] == player && board[2][0] == player){ + return true; + } + } + return false; + } + + private static boolean isValid(char[][] board, int x, int y) { + + if(x > 2 || y > 2 || x < 0 || y < 0){ + return false; + } + return board[x][y] == ' '; + } + + private static void showBoard(char[][] board) { + for (char[] chars : board) { + for (char aChar : chars) { + System.out.print(aChar + " | "); + } + System.out.println(); + } + } +} diff --git a/DSA projects/inorder_preorder_postorder.cpp b/DSA projects/inorder_preorder_postorder.cpp index ccb561e..4c1fbcc 100644 --- a/DSA projects/inorder_preorder_postorder.cpp +++ b/DSA projects/inorder_preorder_postorder.cpp @@ -1,96 +1,96 @@ -#include -using namespace std; - -typedef struct node { - int val; - node *left, *right; -}node; - -class bst { - public: - node *root; - bst() { - root = nullptr; - } - - void insert(int val); - void delete_bst(int val); - void print_inorder(); - void inorder(node* temp); - void print_preorder(); - void preorder(node* temp); - void print_postorder(); - void postorder(node* temp); -}; - -void bst::insert(int val) { - node *temp = root, *p; - node *new_node = new node; - new_node->val = val; - if(!root) { - root = new_node; - return ; - } - while(temp) { - p = temp; - if(temp->val > val) temp = temp->left; - else temp = temp->right; - } - p->val > val ? p->left = new_node : p->right = new_node; - return ; -} - -void bst::print_inorder() { - inorder(root); -} - -void bst::inorder(node* temp) { - if(!temp) return ; - inorder(temp->left); - cout<val<<" "; - inorder(temp->right); -} - -void bst::print_preorder() { - preorder(root); -} - -void bst::preorder(node* temp) { - if(!temp) return ; - cout<val<<" "; - preorder(temp->left); - preorder(temp->right); -} - -void bst::print_postorder() { - postorder(root); -} - -void bst::postorder(node* temp) { - if(!temp) return ; - postorder(temp->left); - postorder(temp->right); - cout<val<<" "; -} - -int main() { - bst b; - b.insert(8); - b.insert(2); - b.insert(4); - b.insert(9); - b.insert(20); - b.insert(1); - b.insert(11); - b.insert(100); - - cout<<"Inorder: "; - b.print_inorder(); - cout< +using namespace std; + +typedef struct node { + int val; + node *left, *right; +}node; + +class bst { + public: + node *root; + bst() { + root = nullptr; + } + + void insert(int val); + void delete_bst(int val); + void print_inorder(); + void inorder(node* temp); + void print_preorder(); + void preorder(node* temp); + void print_postorder(); + void postorder(node* temp); +}; + +void bst::insert(int val) { + node *temp = root, *p; + node *new_node = new node; + new_node->val = val; + if(!root) { + root = new_node; + return ; + } + while(temp) { + p = temp; + if(temp->val > val) temp = temp->left; + else temp = temp->right; + } + p->val > val ? p->left = new_node : p->right = new_node; + return ; +} + +void bst::print_inorder() { + inorder(root); +} + +void bst::inorder(node* temp) { + if(!temp) return ; + inorder(temp->left); + cout<val<<" "; + inorder(temp->right); +} + +void bst::print_preorder() { + preorder(root); +} + +void bst::preorder(node* temp) { + if(!temp) return ; + cout<val<<" "; + preorder(temp->left); + preorder(temp->right); +} + +void bst::print_postorder() { + postorder(root); +} + +void bst::postorder(node* temp) { + if(!temp) return ; + postorder(temp->left); + postorder(temp->right); + cout<val<<" "; +} + +int main() { + bst b; + b.insert(8); + b.insert(2); + b.insert(4); + b.insert(9); + b.insert(20); + b.insert(1); + b.insert(11); + b.insert(100); + + cout<<"Inorder: "; + b.print_inorder(); + cout< -#include -using namespace std; - -int maxProfit(int p[], int n) { - if(n == 0) return 0; - int best = 0; - for(int len = 1; len <= n; len++) { - int profit = p[len] + maxProfit(p, n - len); - best = max(best, profit); - } - return best; -} - -int main() -{ - int n = 4; - int profit[4] ={2, 3, 2, 5}; - cout< +#include +using namespace std; + +int maxProfit(int p[], int n) { + if(n == 0) return 0; + int best = 0; + for(int len = 1; len <= n; len++) { + int profit = p[len] + maxProfit(p, n - len); + best = max(best, profit); + } + return best; +} + +int main() +{ + int n = 4; + int profit[4] ={2, 3, 2, 5}; + cout< - - - - - Resume Builder - - - -
-

Login to your account

-
- We are your career partner - - -
-
- - -
-
- -
-
- - + + + + + + Resume Builder + + + +
+

Login to your account

+
+ We are your career partner + + +
+
+ + +
+
+ +
+
+ + \ No newline at end of file diff --git a/Java/Java/travelling_Salesman.java b/Java/Java/travelling_Salesman.java index ff7f731..3dabffe 100644 --- a/Java/Java/travelling_Salesman.java +++ b/Java/Java/travelling_Salesman.java @@ -1,62 +1,62 @@ -class travelling_Salesman{ - - static int tsp(int[][] graph, boolean[] v, - int currPos, int n, - int count, int cost, int ans) - { - - - if (count == n && graph[currPos][0] > 0) - { - ans = Math.min(ans, cost + graph[currPos][0]); - return ans; - } - - - for (int i = 0; i < n; i++) - { - if (v[i] == false && graph[currPos][i] > 0) - { - - - v[i] = true; - ans = tsp(graph, v, i, n, count + 1, - cost + graph[currPos][i], ans); - - - v[i] = false; - } - } - return ans; - } - - - public static void main(String[] args) - { - - - int n = 4; - - int[][] graph = {{0, 10, 15, 20}, - {10, 0, 35, 25}, - {15, 35, 0, 30}, - {20, 25, 30, 0}}; - - - boolean[] v = new boolean[n]; - - - v[0] = true; - int ans = Integer.MAX_VALUE; - - - ans = tsp(graph, v, 0, n, 1, 0, ans); - - - System.out.println(ans); - } - - - - +class travelling_Salesman{ + + static int tsp(int[][] graph, boolean[] v, + int currPos, int n, + int count, int cost, int ans) + { + + + if (count == n && graph[currPos][0] > 0) + { + ans = Math.min(ans, cost + graph[currPos][0]); + return ans; + } + + + for (int i = 0; i < n; i++) + { + if (v[i] == false && graph[currPos][i] > 0) + { + + + v[i] = true; + ans = tsp(graph, v, i, n, count + 1, + cost + graph[currPos][i], ans); + + + v[i] = false; + } + } + return ans; + } + + + public static void main(String[] args) + { + + + int n = 4; + + int[][] graph = {{0, 10, 15, 20}, + {10, 0, 35, 25}, + {15, 35, 0, 30}, + {20, 25, 30, 0}}; + + + boolean[] v = new boolean[n]; + + + v[0] = true; + int ans = Integer.MAX_VALUE; + + + ans = tsp(graph, v, 0, n, 1, 0, ans); + + + System.out.println(ans); + } + + + + } \ No newline at end of file diff --git a/Java/LinkedList/LL.java b/Java/LinkedList/LL.java index e06614e..a4e9d97 100644 --- a/Java/LinkedList/LL.java +++ b/Java/LinkedList/LL.java @@ -1,192 +1,192 @@ -class LL { - public Node head; - private int size; - - LL(){ - this.size = 0; - } - - public class Node{ - int data; - Node next; - - public Node(int data){ - this.data = data; - this.next = null; - size++; - } - } - - public void addLast(int data){ - Node newNode = new Node(data); - if(head == null){ - head = newNode; - size++; - return; - } - Node currNode = head; - while(currNode.next != null){ - currNode = currNode.next; - } - currNode.next = newNode; - } - - public void printList(){ - if(head == null){ - System.out.println("List is empty"); - return; - } - Node currNode = head; - while(currNode != null){ - System.out.print(currNode.data + " -> "); - currNode = currNode.next; - } - System.out.println("NULL"); - } - - public void deleteFirst(){ - if(head == null){ - System.out.println("the list is empty"); - return; - } - size--; - head = head.next; - } - - public void deleteLast(){ - if(head == null){ - System.out.println("the list is empty"); - return; - } - size--; - if(head.next == null){ - head = null; - return; - } - - Node secondLast = head; - Node lastNode = head.next; - while(lastNode.next != null){ - lastNode = lastNode.next; - secondLast = secondLast.next; - } - secondLast.next = null; - } - public void deleteByValue(int data){ - if(head == null){ - System.out.println("List is empty!"); - } - Node current = head; - while(current.next.data != data){ - current = current.next; - } - current.next = current.next.next; - } - public void addFirst(int data){ - Node newNode = new Node(data); - if(head == null){ - head = newNode; - return; - } - newNode.next = head; - head = newNode; - } - // reverses the LinkedList without the creation of a new LinkedList - public void reverse(){ - Node prev = null; - Node current = head; - Node nextNode; - - while(current != null){ - nextNode = current.next; - current.next = prev; - prev = current; - current = nextNode; - } - head = prev; - } - - - public int getSize(){ - return size; - } - - public static void main(String[] args){ - LL list = new LL(); - list.addFirst(4); - list.addFirst(3); - list.addLast(2); - list.addFirst(1); - System.out.print("Before List: "); - list.printList(); - list.reverse(); - System.out.print("After List: "); - list.printList(); - } - } - -// public int nthElementFromEnd(LL list, int i) { -// int size = list.getSize(); -// Node current = head; -// int num = 0; -// while(num <= size - i + 1){ -// current = current.next; -// num ++; -// } -// return current.data; -// } -// } - -// class nthElement{ - -// public static int nthElementFromEnd(LL list, int n){ -// int size = list.getSize(); -// LL.Node current = list.head; -// int num = 0; -// while(num <= size - n + 1){ -// current = current.next; -// num ++; -// } -// return current.data; -// } - // public static int findMiddle(LL list){ - // Node current = list.head; - // int number = 0; - // int size = list.getSize(); - // if(size % 2 == 0){ - // while(number != (size/2 + 1)){ - // current = current.next; - // number ++; - // } - // } - // else{ - // while(number != (size/2 + 2)){ - // current = current.next; - // number ++; - // } - // } - // return current.data; - // } - // public boolean detectLoop(){ - // Node current = head; - // Node newCurrent = head; - // while(newCurrent != null && newCurrent.next != null){ - // current = current.next; - // newCurrent = newCurrent.next.next; - // if(current == newCurrent){ - // return true; - // } - // } - // return false; - // } - // public void reverseLinkedList(){ - // Node current = head; - // LL newList = new LL(); - // while(current != null){ - // newList.addFirst(current.data); - // current = current.next; - // } - // newList.printList(); - // } - - +class LL { + public Node head; + private int size; + + LL(){ + this.size = 0; + } + + public class Node{ + int data; + Node next; + + public Node(int data){ + this.data = data; + this.next = null; + size++; + } + } + + public void addLast(int data){ + Node newNode = new Node(data); + if(head == null){ + head = newNode; + size++; + return; + } + Node currNode = head; + while(currNode.next != null){ + currNode = currNode.next; + } + currNode.next = newNode; + } + + public void printList(){ + if(head == null){ + System.out.println("List is empty"); + return; + } + Node currNode = head; + while(currNode != null){ + System.out.print(currNode.data + " -> "); + currNode = currNode.next; + } + System.out.println("NULL"); + } + + public void deleteFirst(){ + if(head == null){ + System.out.println("the list is empty"); + return; + } + size--; + head = head.next; + } + + public void deleteLast(){ + if(head == null){ + System.out.println("the list is empty"); + return; + } + size--; + if(head.next == null){ + head = null; + return; + } + + Node secondLast = head; + Node lastNode = head.next; + while(lastNode.next != null){ + lastNode = lastNode.next; + secondLast = secondLast.next; + } + secondLast.next = null; + } + public void deleteByValue(int data){ + if(head == null){ + System.out.println("List is empty!"); + } + Node current = head; + while(current.next.data != data){ + current = current.next; + } + current.next = current.next.next; + } + public void addFirst(int data){ + Node newNode = new Node(data); + if(head == null){ + head = newNode; + return; + } + newNode.next = head; + head = newNode; + } + // reverses the LinkedList without the creation of a new LinkedList + public void reverse(){ + Node prev = null; + Node current = head; + Node nextNode; + + while(current != null){ + nextNode = current.next; + current.next = prev; + prev = current; + current = nextNode; + } + head = prev; + } + + + public int getSize(){ + return size; + } + + public static void main(String[] args){ + LL list = new LL(); + list.addFirst(4); + list.addFirst(3); + list.addLast(2); + list.addFirst(1); + System.out.print("Before List: "); + list.printList(); + list.reverse(); + System.out.print("After List: "); + list.printList(); + } + } + +// public int nthElementFromEnd(LL list, int i) { +// int size = list.getSize(); +// Node current = head; +// int num = 0; +// while(num <= size - i + 1){ +// current = current.next; +// num ++; +// } +// return current.data; +// } +// } + +// class nthElement{ + +// public static int nthElementFromEnd(LL list, int n){ +// int size = list.getSize(); +// LL.Node current = list.head; +// int num = 0; +// while(num <= size - n + 1){ +// current = current.next; +// num ++; +// } +// return current.data; +// } + // public static int findMiddle(LL list){ + // Node current = list.head; + // int number = 0; + // int size = list.getSize(); + // if(size % 2 == 0){ + // while(number != (size/2 + 1)){ + // current = current.next; + // number ++; + // } + // } + // else{ + // while(number != (size/2 + 2)){ + // current = current.next; + // number ++; + // } + // } + // return current.data; + // } + // public boolean detectLoop(){ + // Node current = head; + // Node newCurrent = head; + // while(newCurrent != null && newCurrent.next != null){ + // current = current.next; + // newCurrent = newCurrent.next.next; + // if(current == newCurrent){ + // return true; + // } + // } + // return false; + // } + // public void reverseLinkedList(){ + // Node current = head; + // LL newList = new LL(); + // while(current != null){ + // newList.addFirst(current.data); + // current = current.next; + // } + // newList.printList(); + // } + + diff --git a/Java/LinkedList/LList.java b/Java/LinkedList/LList.java index ab6f829..265dba4 100644 --- a/Java/LinkedList/LList.java +++ b/Java/LinkedList/LList.java @@ -1,23 +1,23 @@ -import java.util.*; -public class LList { - public static void main(String[] args){ - LinkedList list = new LinkedList (); - list.addFirst("a"); - list.addFirst("is"); - list.addFirst("this"); - list.addLast("list"); - System.out.println(list); - System.out.println(list.size()); - - for(int i = 0; i < list.size(); i++){ - System.out.print(list.get(i)+ " ->"); - } - System.out.println("null"); - list.removeFirst(); - System.out.println(list); - list.removeLast(); - System.out.println(list); - list.remove(1); - System.out.println(list); - } -} +import java.util.*; +public class LList { + public static void main(String[] args){ + LinkedList list = new LinkedList (); + list.addFirst("a"); + list.addFirst("is"); + list.addFirst("this"); + list.addLast("list"); + System.out.println(list); + System.out.println(list.size()); + + for(int i = 0; i < list.size(); i++){ + System.out.print(list.get(i)+ " ->"); + } + System.out.println("null"); + list.removeFirst(); + System.out.println(list); + list.removeLast(); + System.out.println(list); + list.remove(1); + System.out.println(list); + } +} diff --git a/Java/Stack.java b/Java/Stack.java index 74be94f..ff444ab 100644 --- a/Java/Stack.java +++ b/Java/Stack.java @@ -1,134 +1,134 @@ - -//Importing Scanner class for input -import java.util.Scanner; -import java.util.InputMismatchException; - -// Stack class -class Stack { - private int top; - private int maxSize; - private int stack[]; - - // Constructor for Stack class intialize stack with given maximum size - public Stack(int maxSize) { - this.maxSize = maxSize; - this.stack = new int[maxSize]; - this.top = -1; // stack is empty - } - - // adding element to stack - public void push(int element) { - if (top == maxSize - 1) { // to check stack is full - System.out.println("-1"); - return; - } - stack[++top] = element; // increasing the top and adding element - } - - // removing element from stack - public void pop() { - if (top == -1) { // to check stack is empty - System.out.println("-1"); - return; - } - top--; // decrement top and get element at top of stack - } - - // to get top of stack - public int peek() { - if (top == -1) { // to check stack is empty - return -1; - } - return stack[top]; // get top element of stack - } - - // method to check empty stack - public boolean isEmpty() { - return top == -1; - } - - // method to check stack is Full - public boolean isFull() { - return top == maxSize - 1; - } - - // to display the stack - public void display() { - if (top == -1) { // to check stack is empty - return; - } - for (int index = top; index >= 0; index--) { - System.out.print(stack[index] + " "); - } - } - - public static void main(String[] args) { - try (Scanner input = new Scanner(System.in)) { - System.out.println("Enter size of stack you want: "); - int maxSize = input.nextInt(); // user input for max size - Stack stack = new Stack(maxSize); - int choice; - do { - System.out.println("1. Push"); - System.out.println("2. Pop"); - System.out.println("3. Peek"); - System.out.println("4. Is empty"); - System.out.println("5. Display"); - System.out.println("6. Exit"); - System.out.println("Enter your choice: "); - choice = input.nextInt(); // getting user's choice - switch (choice) { - case 1: - System.out.println("Enter element to push: "); - int element = input.nextInt(); - if (stack.isFull()) { - System.out.println("stack is full"); - break; - } - stack.push(element); - break; - case 2: - if (stack.isEmpty()) { - System.out.println("Stack is empty"); - break; - } - int top = stack.peek(); - stack.pop(); - System.out.println("Deleted element is " + top); - break; - case 3: - if (stack.isEmpty()) { - System.out.println("Stack is empty"); - break; - } - System.out.println("Top element is " + stack.peek()); - break; - case 4: - if (stack.isEmpty()) { - System.out.println("Stack is empty"); - } else { - System.out.println("Stack is not empty"); - } - break; - case 5: - if (stack.isEmpty()) { - System.out.println("stack is empty"); - break; - } - stack.display(); - System.out.println(); - break; - case 6: - System.out.println("Exit done"); - break; - default: - System.out.println("Invalid choice"); - } - } while (choice != 6); - } catch (InputMismatchException exception) { - System.out.println(exception); - } catch (Exception exception) { - System.out.println(exception); - } - } + +//Importing Scanner class for input +import java.util.Scanner; +import java.util.InputMismatchException; + +// Stack class +class Stack { + private int top; + private int maxSize; + private int stack[]; + + // Constructor for Stack class intialize stack with given maximum size + public Stack(int maxSize) { + this.maxSize = maxSize; + this.stack = new int[maxSize]; + this.top = -1; // stack is empty + } + + // adding element to stack + public void push(int element) { + if (top == maxSize - 1) { // to check stack is full + System.out.println("-1"); + return; + } + stack[++top] = element; // increasing the top and adding element + } + + // removing element from stack + public void pop() { + if (top == -1) { // to check stack is empty + System.out.println("-1"); + return; + } + top--; // decrement top and get element at top of stack + } + + // to get top of stack + public int peek() { + if (top == -1) { // to check stack is empty + return -1; + } + return stack[top]; // get top element of stack + } + + // method to check empty stack + public boolean isEmpty() { + return top == -1; + } + + // method to check stack is Full + public boolean isFull() { + return top == maxSize - 1; + } + + // to display the stack + public void display() { + if (top == -1) { // to check stack is empty + return; + } + for (int index = top; index >= 0; index--) { + System.out.print(stack[index] + " "); + } + } + + public static void main(String[] args) { + try (Scanner input = new Scanner(System.in)) { + System.out.println("Enter size of stack you want: "); + int maxSize = input.nextInt(); // user input for max size + Stack stack = new Stack(maxSize); + int choice; + do { + System.out.println("1. Push"); + System.out.println("2. Pop"); + System.out.println("3. Peek"); + System.out.println("4. Is empty"); + System.out.println("5. Display"); + System.out.println("6. Exit"); + System.out.println("Enter your choice: "); + choice = input.nextInt(); // getting user's choice + switch (choice) { + case 1: + System.out.println("Enter element to push: "); + int element = input.nextInt(); + if (stack.isFull()) { + System.out.println("stack is full"); + break; + } + stack.push(element); + break; + case 2: + if (stack.isEmpty()) { + System.out.println("Stack is empty"); + break; + } + int top = stack.peek(); + stack.pop(); + System.out.println("Deleted element is " + top); + break; + case 3: + if (stack.isEmpty()) { + System.out.println("Stack is empty"); + break; + } + System.out.println("Top element is " + stack.peek()); + break; + case 4: + if (stack.isEmpty()) { + System.out.println("Stack is empty"); + } else { + System.out.println("Stack is not empty"); + } + break; + case 5: + if (stack.isEmpty()) { + System.out.println("stack is empty"); + break; + } + stack.display(); + System.out.println(); + break; + case 6: + System.out.println("Exit done"); + break; + default: + System.out.println("Invalid choice"); + } + } while (choice != 6); + } catch (InputMismatchException exception) { + System.out.println(exception); + } catch (Exception exception) { + System.out.println(exception); + } + } } \ No newline at end of file diff --git a/Java/StackTest.java b/Java/StackTest.java index 3393adc..7ad5864 100644 --- a/Java/StackTest.java +++ b/Java/StackTest.java @@ -1,89 +1,89 @@ -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; -import org.junit.Test; -import org.junit.jupiter.api.Assertions; - -public class StackTest{ - Stack stackTest =new Stack(10); - - @Test - public void testIsEmpty(){ - Assertions.assertTrue(stackTest.isEmpty()); - } - - @Test - public void testIsEmptyFalse(){ - stackTest.push(10); - Assertions.assertFalse(stackTest.isEmpty()); - } - - @Test - public void testPush() - { - ByteArrayOutputStream out= new ByteArrayOutputStream(); - System.setOut(new PrintStream(out)); - stackTest.push(5); - stackTest.peek(); - Assertions.assertEquals(5,stackTest.peek()); - stackTest.push(4); - Assertions.assertEquals(4,stackTest.peek()); - stackTest.push(3); - Assertions.assertEquals(3,stackTest.peek()); - stackTest.push(2); - Assertions.assertEquals(2,stackTest.peek()); - stackTest.push(1); - Assertions.assertEquals(1,stackTest.peek()); - } - - @Test - public void testPeek() - { - ByteArrayOutputStream out= new ByteArrayOutputStream(); - System.setOut(new PrintStream(out)); - stackTest.push(5); - stackTest.push(4); - stackTest.push(3); - stackTest.push(2); - stackTest.push(1); - Assertions.assertEquals(1,stackTest.peek()); - stackTest.pop(); - Assertions.assertEquals(2,stackTest.peek()); - stackTest.pop(); - Assertions.assertEquals(3,stackTest.peek()); - stackTest.pop(); - Assertions.assertEquals(4,stackTest.peek()); - } - - @Test - public void testPop() - { - stackTest.push(5); - stackTest.push(4); - stackTest.push(3); - stackTest.push(2); - stackTest.push(1); - Assertions.assertEquals(1,stackTest.peek()); - stackTest.pop(); - Assertions.assertEquals(2,stackTest.peek()); - stackTest.pop(); - Assertions.assertEquals(3,stackTest.peek()); - stackTest.pop(); - Assertions.assertEquals(4,stackTest.peek()); - -} - -@Test -public void testDisplay() -{ -ByteArrayOutputStream out= new ByteArrayOutputStream(); -System.setOut(new PrintStream(out)); - - stackTest.push(5); - stackTest.push(4); - stackTest.push(3); - stackTest.push(2); - stackTest.push(1); - stackTest.display(); - Assertions.assertEquals("1 2 3 4 5".replaceAll(" ",""),out.toString().replaceAll(" ","")); - } +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import org.junit.Test; +import org.junit.jupiter.api.Assertions; + +public class StackTest{ + Stack stackTest =new Stack(10); + + @Test + public void testIsEmpty(){ + Assertions.assertTrue(stackTest.isEmpty()); + } + + @Test + public void testIsEmptyFalse(){ + stackTest.push(10); + Assertions.assertFalse(stackTest.isEmpty()); + } + + @Test + public void testPush() + { + ByteArrayOutputStream out= new ByteArrayOutputStream(); + System.setOut(new PrintStream(out)); + stackTest.push(5); + stackTest.peek(); + Assertions.assertEquals(5,stackTest.peek()); + stackTest.push(4); + Assertions.assertEquals(4,stackTest.peek()); + stackTest.push(3); + Assertions.assertEquals(3,stackTest.peek()); + stackTest.push(2); + Assertions.assertEquals(2,stackTest.peek()); + stackTest.push(1); + Assertions.assertEquals(1,stackTest.peek()); + } + + @Test + public void testPeek() + { + ByteArrayOutputStream out= new ByteArrayOutputStream(); + System.setOut(new PrintStream(out)); + stackTest.push(5); + stackTest.push(4); + stackTest.push(3); + stackTest.push(2); + stackTest.push(1); + Assertions.assertEquals(1,stackTest.peek()); + stackTest.pop(); + Assertions.assertEquals(2,stackTest.peek()); + stackTest.pop(); + Assertions.assertEquals(3,stackTest.peek()); + stackTest.pop(); + Assertions.assertEquals(4,stackTest.peek()); + } + + @Test + public void testPop() + { + stackTest.push(5); + stackTest.push(4); + stackTest.push(3); + stackTest.push(2); + stackTest.push(1); + Assertions.assertEquals(1,stackTest.peek()); + stackTest.pop(); + Assertions.assertEquals(2,stackTest.peek()); + stackTest.pop(); + Assertions.assertEquals(3,stackTest.peek()); + stackTest.pop(); + Assertions.assertEquals(4,stackTest.peek()); + +} + +@Test +public void testDisplay() +{ +ByteArrayOutputStream out= new ByteArrayOutputStream(); +System.setOut(new PrintStream(out)); + + stackTest.push(5); + stackTest.push(4); + stackTest.push(3); + stackTest.push(2); + stackTest.push(1); + stackTest.display(); + Assertions.assertEquals("1 2 3 4 5".replaceAll(" ",""),out.toString().replaceAll(" ","")); + } } \ No newline at end of file diff --git a/Java/StackTest.txt b/Java/StackTest.txt index 01a851c..67c109a 100644 --- a/Java/StackTest.txt +++ b/Java/StackTest.txt @@ -1,95 +1,95 @@ -Operations: - -1. Push -2. Pop -3. Peek -4. Is empty -5. Display -6. Exit - - -Test case-1 (Test case for push) - -size of stack - 4 - -choice- 1 - input- 10 -choice- 1 - input- 20 -choice- 1 - input- 30 -choice- 5 - -Output:- 30 20 10 - ------------------------------------------------------------------------------------------------- - -Test case-2 (Test case for pop) - -choice- 1 - input- 10 -choice- 1 - input- 20 -choice- 1 - input- 30 -choice- 2 -choice- 2 -choice- 5 - -Output:- 10 - ------------------------------------------------------------------------------------------------- - -Test case-3 (Test case for Top elements) - -choice- 1 - input- 10 -choice- 1 - input- 20 -choice- 1 - input- 30 -choice- 3 - -Output:- Top element is 30 - ------------------------------------------------------------------------------------------------- - -Test case-4 (Test case to check Empty Stack) - -choice- 4 - -Output:- Stack is Empty - -choice- 1 - input- 10 -choice- 4 - -Output:- Stack is not Empty - ------------------------------------------------------------------------------------------------- - -Test case-5 (Test case for Display Stack) - -choice- 1 - input- 10 -choice- 1 - input- 20 -choice- 1 - input- 30 -choice- 5 -Output:- 30 20 10 - ------------------------------------------------------------------------------------------------- - -Test case-6 (Test case for Invalid user choice from Menu) - -choice- 7 -Output:- Invalid choice - ------------------------------------------------------------------------------------------------- - -Test case-7 (Test case for invalid input type) - -input - hi -Output:- +Operations: + +1. Push +2. Pop +3. Peek +4. Is empty +5. Display +6. Exit + + +Test case-1 (Test case for push) + +size of stack - 4 + +choice- 1 + input- 10 +choice- 1 + input- 20 +choice- 1 + input- 30 +choice- 5 + +Output:- 30 20 10 + +------------------------------------------------------------------------------------------------ + +Test case-2 (Test case for pop) + +choice- 1 + input- 10 +choice- 1 + input- 20 +choice- 1 + input- 30 +choice- 2 +choice- 2 +choice- 5 + +Output:- 10 + +------------------------------------------------------------------------------------------------ + +Test case-3 (Test case for Top elements) + +choice- 1 + input- 10 +choice- 1 + input- 20 +choice- 1 + input- 30 +choice- 3 + +Output:- Top element is 30 + +------------------------------------------------------------------------------------------------ + +Test case-4 (Test case to check Empty Stack) + +choice- 4 + +Output:- Stack is Empty + +choice- 1 + input- 10 +choice- 4 + +Output:- Stack is not Empty + +------------------------------------------------------------------------------------------------ + +Test case-5 (Test case for Display Stack) + +choice- 1 + input- 10 +choice- 1 + input- 20 +choice- 1 + input- 30 +choice- 5 +Output:- 30 20 10 + +------------------------------------------------------------------------------------------------ + +Test case-6 (Test case for Invalid user choice from Menu) + +choice- 7 +Output:- Invalid choice + +------------------------------------------------------------------------------------------------ + +Test case-7 (Test case for invalid input type) + +input - hi +Output:- java.util.InputMismatchException \ No newline at end of file diff --git a/Java/StudentManagementApp b/Java/StudentManagementApp deleted file mode 160000 index 9644aef..0000000 --- a/Java/StudentManagementApp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9644aef397a4cdcb58893fa9833f52f8f6872ac3 diff --git a/Java/anagram.java b/Java/anagram.java index de0ec63..f10c7c5 100644 --- a/Java/anagram.java +++ b/Java/anagram.java @@ -1,28 +1,28 @@ -// anagram = two strings having the same entities -import java.util.Arrays; - -public class anagram { - public static void main(String[] args){ - String str1 = "School Master"; - String str2 = "The Classroom"; - - str1 = str1.replace(" ", ""); - str2 = str2.replace(" ", ""); - - str1 = str1.toLowerCase(); - str2 = str2.toLowerCase(); - - char arr1[] = str1.toCharArray(); - char arr2[] = str2.toCharArray(); - - Arrays.sort(arr1); - Arrays.sort(arr2); - - if(Arrays.equals(arr1, arr2)){ - System.out.println("is Anagram"); - } - else{ - System.out.println("is not Anagram"); - } - } -} +// anagram = two strings having the same entities +import java.util.Arrays; + +public class anagram { + public static void main(String[] args){ + String str1 = "School Master"; + String str2 = "The Classroom"; + + str1 = str1.replace(" ", ""); + str2 = str2.replace(" ", ""); + + str1 = str1.toLowerCase(); + str2 = str2.toLowerCase(); + + char arr1[] = str1.toCharArray(); + char arr2[] = str2.toCharArray(); + + Arrays.sort(arr1); + Arrays.sort(arr2); + + if(Arrays.equals(arr1, arr2)){ + System.out.println("is Anagram"); + } + else{ + System.out.println("is not Anagram"); + } + } +} diff --git a/Java/guesserGameLaunch.java b/Java/guesserGameLaunch.java index dcd6293..ce864fb 100644 --- a/Java/guesserGameLaunch.java +++ b/Java/guesserGameLaunch.java @@ -1,113 +1,113 @@ -package gameProject1; -import java.util.Scanner; - -class guesser{ - int guessNum; - int guessingNum(){ - try (Scanner scan = new Scanner(System.in)) { - System.out.println("Kindly guess the number!!"); - guessNum = scan.nextInt(); - } - return guessNum; - } -} - -class player{ - int guessedNum; - int decodeNum(){ - try(Scanner scan = new Scanner(System.in)){ - System.out.println("Kindly guess your number to decode the number by guess!!"); - guessedNum = scan.nextInt(); - } - return guessedNum; - } -} - -class umpire{ - int numFromGuesser; - int numFromPlayer1; - int numFromPlayer2; - int numFromPlayer3; - int numFromPlayer4; - - void collectNumFromGuesser(){ - guesser g = new guesser(); - numFromGuesser = g.guessingNum(); - } - void collectNumFromPlayers(){ - player p1 = new player(); - player p2 = new player(); - player p3 = new player(); - player p4 = new player(); - numFromPlayer1 = p1.decodeNum(); - numFromPlayer2 = p2.decodeNum(); - numFromPlayer2 = p3.decodeNum(); - numFromPlayer2 = p4.decodeNum(); - } - void compare(){ - if (numFromGuesser == numFromPlayer1){ - if(numFromGuesser == numFromPlayer2 && numFromGuesser == numFromPlayer3 && numFromGuesser == numFromPlayer4){ - System.out.println("All the players won :)"); - } - else if(numFromGuesser == numFromPlayer2 && numFromGuesser == numFromPlayer3 && numFromGuesser != numFromPlayer4 ){ - System.out.println("Player 1, 2 and 3 won :)"); - } - else if(numFromGuesser == numFromPlayer2 && numFromGuesser == numFromPlayer4 && numFromGuesser != numFromPlayer3 ){ - System.out.println("Player 1, 2 and 4 won :)"); - } - else if(numFromGuesser != numFromPlayer2 && numFromGuesser == numFromPlayer3 && numFromGuesser == numFromPlayer4 ){ - System.out.println("Player 1, 3 and 4 won :)"); - } - else if(numFromGuesser == numFromPlayer2 && numFromGuesser != numFromPlayer3 && numFromGuesser != numFromPlayer4 ){ - System.out.println("Player 1 and 2 won :)"); - } - else if(numFromGuesser != numFromPlayer2 && numFromGuesser == numFromPlayer3 && numFromGuesser != numFromPlayer4 ){ - System.out.println("Player 1 and 3 won :)"); - } - else if(numFromGuesser != numFromPlayer2 && numFromGuesser != numFromPlayer3 && numFromGuesser == numFromPlayer4 ){ - System.out.println("Player 1 and 4 won :)"); - } - else{ - System.out.println("Player 1 is the winner :)"); - } - } - else if (numFromGuesser == numFromPlayer2){ - if(numFromGuesser == numFromPlayer3 && numFromGuesser == numFromPlayer4 ){ - System.out.println("Player 2, 3 and 4 won :)"); - } - else if(numFromGuesser == numFromPlayer3 && numFromGuesser != numFromPlayer4 ){ - System.out.println("Player 2 and 3 won :)"); - } - else if(numFromGuesser != numFromPlayer3 && numFromGuesser == numFromPlayer4 ){ - System.out.println("Player 2 and 4 won :)"); - } - else{ - System.out.println("Player 2 is the winner :)"); - } - } - else if (numFromGuesser == numFromPlayer3){ - if(numFromGuesser == numFromPlayer4 ){ - System.out.println("Player 3 and 4 won :)"); - } - else{ - System.out.println("Player 3 is the winner :)"); - } - } - else if (numFromGuesser == numFromPlayer4){ - System.out.println("Player 4 is the winner :)"); - } - else { - System.out.println("No oone decoded the number, Everyone lose :( "); - } - } -} - -class guesserGameLaunch{ - public static void main(String[] args){ - System.out.println("heyy, let's start the game!!"); - umpire u = new umpire(); - u.collectNumFromGuesser(); - u.collectNumFromPlayers(); - u.compare(); - } +package gameProject1; +import java.util.Scanner; + +class guesser{ + int guessNum; + int guessingNum(){ + try (Scanner scan = new Scanner(System.in)) { + System.out.println("Kindly guess the number!!"); + guessNum = scan.nextInt(); + } + return guessNum; + } +} + +class player{ + int guessedNum; + int decodeNum(){ + try(Scanner scan = new Scanner(System.in)){ + System.out.println("Kindly guess your number to decode the number by guess!!"); + guessedNum = scan.nextInt(); + } + return guessedNum; + } +} + +class umpire{ + int numFromGuesser; + int numFromPlayer1; + int numFromPlayer2; + int numFromPlayer3; + int numFromPlayer4; + + void collectNumFromGuesser(){ + guesser g = new guesser(); + numFromGuesser = g.guessingNum(); + } + void collectNumFromPlayers(){ + player p1 = new player(); + player p2 = new player(); + player p3 = new player(); + player p4 = new player(); + numFromPlayer1 = p1.decodeNum(); + numFromPlayer2 = p2.decodeNum(); + numFromPlayer2 = p3.decodeNum(); + numFromPlayer2 = p4.decodeNum(); + } + void compare(){ + if (numFromGuesser == numFromPlayer1){ + if(numFromGuesser == numFromPlayer2 && numFromGuesser == numFromPlayer3 && numFromGuesser == numFromPlayer4){ + System.out.println("All the players won :)"); + } + else if(numFromGuesser == numFromPlayer2 && numFromGuesser == numFromPlayer3 && numFromGuesser != numFromPlayer4 ){ + System.out.println("Player 1, 2 and 3 won :)"); + } + else if(numFromGuesser == numFromPlayer2 && numFromGuesser == numFromPlayer4 && numFromGuesser != numFromPlayer3 ){ + System.out.println("Player 1, 2 and 4 won :)"); + } + else if(numFromGuesser != numFromPlayer2 && numFromGuesser == numFromPlayer3 && numFromGuesser == numFromPlayer4 ){ + System.out.println("Player 1, 3 and 4 won :)"); + } + else if(numFromGuesser == numFromPlayer2 && numFromGuesser != numFromPlayer3 && numFromGuesser != numFromPlayer4 ){ + System.out.println("Player 1 and 2 won :)"); + } + else if(numFromGuesser != numFromPlayer2 && numFromGuesser == numFromPlayer3 && numFromGuesser != numFromPlayer4 ){ + System.out.println("Player 1 and 3 won :)"); + } + else if(numFromGuesser != numFromPlayer2 && numFromGuesser != numFromPlayer3 && numFromGuesser == numFromPlayer4 ){ + System.out.println("Player 1 and 4 won :)"); + } + else{ + System.out.println("Player 1 is the winner :)"); + } + } + else if (numFromGuesser == numFromPlayer2){ + if(numFromGuesser == numFromPlayer3 && numFromGuesser == numFromPlayer4 ){ + System.out.println("Player 2, 3 and 4 won :)"); + } + else if(numFromGuesser == numFromPlayer3 && numFromGuesser != numFromPlayer4 ){ + System.out.println("Player 2 and 3 won :)"); + } + else if(numFromGuesser != numFromPlayer3 && numFromGuesser == numFromPlayer4 ){ + System.out.println("Player 2 and 4 won :)"); + } + else{ + System.out.println("Player 2 is the winner :)"); + } + } + else if (numFromGuesser == numFromPlayer3){ + if(numFromGuesser == numFromPlayer4 ){ + System.out.println("Player 3 and 4 won :)"); + } + else{ + System.out.println("Player 3 is the winner :)"); + } + } + else if (numFromGuesser == numFromPlayer4){ + System.out.println("Player 4 is the winner :)"); + } + else { + System.out.println("No oone decoded the number, Everyone lose :( "); + } + } +} + +class guesserGameLaunch{ + public static void main(String[] args){ + System.out.println("heyy, let's start the game!!"); + umpire u = new umpire(); + u.collectNumFromGuesser(); + u.collectNumFromPlayers(); + u.compare(); + } } \ No newline at end of file diff --git a/Javascript/fizzbuzz.js b/Javascript/fizzbuzz.js index 1100e95..87fb8e6 100644 --- a/Javascript/fizzbuzz.js +++ b/Javascript/fizzbuzz.js @@ -1,26 +1,26 @@ -output = []; -var count = 1; - -function fizzBuzz(){ - if(count % 3 === 0 && count % 5 !== 0){ - output.push("Fizz"); - } - else if(count % 5 === 0 && count % 3 !== 0){ - output.push("Buzz"); - } - else if(count % 3 === 0 && count % 5 === 0){ - output.push("FizzBuzz"); - } - else{ - output.push(count); - } - - console.log(output); - count++; -} -var noOfTimes = 0; -var n = 6; -while(noOfTimes < n){ - fizzBuzz(); - noOfTimes += 1; -} +output = []; +var count = 1; + +function fizzBuzz(){ + if(count % 3 === 0 && count % 5 !== 0){ + output.push("Fizz"); + } + else if(count % 5 === 0 && count % 3 !== 0){ + output.push("Buzz"); + } + else if(count % 3 === 0 && count % 5 === 0){ + output.push("FizzBuzz"); + } + else{ + output.push(count); + } + + console.log(output); + count++; +} +var noOfTimes = 0; +var n = 6; +while(noOfTimes < n){ + fizzBuzz(); + noOfTimes += 1; +} diff --git a/Javascript/tip-calculator/README.md b/Javascript/tip-calculator/README.md index dbc8bda..b75d52a 100644 --- a/Javascript/tip-calculator/README.md +++ b/Javascript/tip-calculator/README.md @@ -1,3 +1,3 @@ -# Tip Calculator - -Tip Calculator created using JavaScript, HTML5 ,and CSS3 to help determine how much to tip at restaurants or whenever the need arises. +# Tip Calculator + +Tip Calculator created using JavaScript, HTML5 ,and CSS3 to help determine how much to tip at restaurants or whenever the need arises. diff --git a/Javascript/tip-calculator/index.html b/Javascript/tip-calculator/index.html index 47593a4..874c150 100644 --- a/Javascript/tip-calculator/index.html +++ b/Javascript/tip-calculator/index.html @@ -1,57 +1,57 @@ - - - - - Tip Calculator - - - - - - - - -
-

Charles' Tip Calculator

- -
-
- -
-
- - -
- -
- -
- $0.00 - each - -
- -
- - - - - + + + + + Tip Calculator + + + + + + + + +
+

Charles' Tip Calculator

+ +
+
+ +
+
+ + +
+ +
+ +
+ $0.00 + each + +
+ +
+ + + + + \ No newline at end of file diff --git a/Javascript/tip-calculator/script.js b/Javascript/tip-calculator/script.js index 79bb152..a3bea7e 100644 --- a/Javascript/tip-calculator/script.js +++ b/Javascript/tip-calculator/script.js @@ -1,47 +1,47 @@ - - -//Custom function -function calculateTip() { - -//Store the data of the inputs -var billAmount =document.getElementById("billAmount").value; -var serviceQuality = document.getElementById("serviceQuality").value; -var numPeople = document.getElementById("totalPeople").value; - -//Quick validation -if(billAmount==="" || serviceQuality == 0){ - window.alert("Please enter some values to get this baby up and running!"); - return; // this will prevent the function from continuing -} - -//Check to see if this input is empty or less than or equal to 1 -if(numPeople ===""|| numPeople <=1) { - numPeople =1; - - document.getElementById("each").style.display = "none;" - -} else{ - - document.getElementById("each").style.display = "block"; -} - -//Do some math! -var total = (billAmount*serviceQuality)/ numPeople; -total = Math.round(total*100)/100; -total= total.toFixed(2); - -//Display the tip! -document.getElementById("totalTip").style.display = "block"; -document.getElementById("tip").innerHTML = total; - -} - - - -//Hide the tip amount on load -document.getElementById("totalTip"). style.display ="none"; -document.getElementById("each"). style.display = "none"; - -//Clicking the button calls our custom function -document.getElementById("calculate").onclick= function(){calculateTip();}; - + + +//Custom function +function calculateTip() { + +//Store the data of the inputs +var billAmount =document.getElementById("billAmount").value; +var serviceQuality = document.getElementById("serviceQuality").value; +var numPeople = document.getElementById("totalPeople").value; + +//Quick validation +if(billAmount==="" || serviceQuality == 0){ + window.alert("Please enter some values to get this baby up and running!"); + return; // this will prevent the function from continuing +} + +//Check to see if this input is empty or less than or equal to 1 +if(numPeople ===""|| numPeople <=1) { + numPeople =1; + + document.getElementById("each").style.display = "none;" + +} else{ + + document.getElementById("each").style.display = "block"; +} + +//Do some math! +var total = (billAmount*serviceQuality)/ numPeople; +total = Math.round(total*100)/100; +total= total.toFixed(2); + +//Display the tip! +document.getElementById("totalTip").style.display = "block"; +document.getElementById("tip").innerHTML = total; + +} + + + +//Hide the tip amount on load +document.getElementById("totalTip"). style.display ="none"; +document.getElementById("each"). style.display = "none"; + +//Clicking the button calls our custom function +document.getElementById("calculate").onclick= function(){calculateTip();}; + diff --git a/Javascript/tip-calculator/styles.css b/Javascript/tip-calculator/styles.css index f03e00c..b129b25 100644 --- a/Javascript/tip-calculator/styles.css +++ b/Javascript/tip-calculator/styles.css @@ -1,96 +1,96 @@ -/*styles.css*/ - -body { - background: #333 url(img/food8.jpeg) center center no-repeat; - background-size: cover; - color:#532827; -} - -#container{ - width: 400px; - margin: 40px auto 0; - padding: 50px; - box-sizing: border-box; - background: url(img/paper-pattern.jpg)top left repeat; - box-shadow: 0 10px 15px -8px #000; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - text-align: center; -} - -h1{ - margin: 0 0 20px; - padding: 0 0 20px; - border-bottom: solid 1px #ddd; - -} - -form{ - text-align: left; -} - -form label{ - display: block; - margin:25px 0; - font-weight: bold; -} - -form input, -form select{ - padding: 8px; - margin: 10px 0; -} - -form input[type="text"]{ - width: 90px; -} - -button{ - background: #6c2726; - color: white; - border-bottom:solid 4px #222; - text-transform: uppercase; - font-size: 18px; - padding: 20px 30px; - width: 100%; -} - -bottom:hover{ - background:#4c2827; - border-bottom-color: #111; -} - -button:active{ - - position: relative; - top: 3px; -} - -#totalTip{ - - font-size: 50px; - margin-top: 40px; -} - -#totalTip:before{ - - content: "Tip amount"; - font-size: 14px; - font-weight: bold; - display: block; - text-transform: uppercase; -} - -#totalTip sup{ - - font-size: 24px; - top: -18px; -} - -#totalTip small{ - - font-size: 14px; - font-weight: bold; - display: block; +/*styles.css*/ + +body { + background: #333 url(img/food8.jpeg) center center no-repeat; + background-size: cover; + color:#532827; +} + +#container{ + width: 400px; + margin: 40px auto 0; + padding: 50px; + box-sizing: border-box; + background: url(img/paper-pattern.jpg)top left repeat; + box-shadow: 0 10px 15px -8px #000; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + text-align: center; +} + +h1{ + margin: 0 0 20px; + padding: 0 0 20px; + border-bottom: solid 1px #ddd; + +} + +form{ + text-align: left; +} + +form label{ + display: block; + margin:25px 0; + font-weight: bold; +} + +form input, +form select{ + padding: 8px; + margin: 10px 0; +} + +form input[type="text"]{ + width: 90px; +} + +button{ + background: #6c2726; + color: white; + border-bottom:solid 4px #222; + text-transform: uppercase; + font-size: 18px; + padding: 20px 30px; + width: 100%; +} + +bottom:hover{ + background:#4c2827; + border-bottom-color: #111; +} + +button:active{ + + position: relative; + top: 3px; +} + +#totalTip{ + + font-size: 50px; + margin-top: 40px; +} + +#totalTip:before{ + + content: "Tip amount"; + font-size: 14px; + font-weight: bold; + display: block; + text-transform: uppercase; +} + +#totalTip sup{ + + font-size: 24px; + top: -18px; +} + +#totalTip small{ + + font-size: 14px; + font-weight: bold; + display: block; } \ No newline at end of file diff --git a/Random_codes /Chatbot.python b/Random_codes /Chatbot.python deleted file mode 100644 index b8958ec..0000000 --- a/Random_codes /Chatbot.python +++ /dev/null @@ -1,45 +0,0 @@ -import nltk -from nltk.chat.util import Chat, reflections - -nltk.download('punkt') - -# Define patterns and responses for the chatbot -pairs = [ - [ - r"hi|hello|hey", - ["Hello!", "Hi there!", "Hey!"] - ], - [ - r"how are you ?", - ["I'm good, thanks. How can I assist you?", "I'm doing well. How can I help you today?"] - ], - [ - r"what is your name ?", - ["I'm a chatbot.", "I'm just a chatbot, no specific name."] - ], - [ - r"your name", - ["You can call me Chatbot.", "I don't have a specific name."] - ], - [ - r"(.*) help (.*)", - ["I can help you with various tasks. What do you need assistance with?"] - ], - [ - r"bye|goodbye", - ["Goodbye!", "Have a great day!"] - ], -] - -# Create a chatbot using the defined patterns -chatbot = Chat(pairs, reflections) - -# Start the conversation -print("Hello! I'm a simple chatbot. You can type 'bye' to exit.") -while True: - user_input = input("You: ") - if user_input.lower() == 'bye': - print("Chatbot: Goodbye!") - break - else: - print("Chatbot:", chatbot.respond(user_input)) diff --git a/Random_codes /Contributershub.iml b/Random_codes /Contributershub.iml deleted file mode 100644 index fe6d784..0000000 --- a/Random_codes /Contributershub.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/Random_codes /Credit Card Validator.cpp b/Random_codes /Credit Card Validator.cpp deleted file mode 100644 index 58d14d8..0000000 --- a/Random_codes /Credit Card Validator.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -#include - -using namespace std; - -bool isNumberString(const string& s) { - int len = s.length(); - for (int i = 0; i < len; i++) { - if (s[i] < '0' || s[i] > '9') - return false; - } - return true; -} - -int main() { - string ccNumber; - - cout << "This program uses the Luhn Algorigthm to validate a CC number." << endl; - cout << "You can enter 'exit' anytime to quit." << endl; - - while (true) { - - cout << "Please enter a CC number to validate: "; - cin >> ccNumber; - - if (ccNumber == "exit") - break; - - else if (!isNumberString(ccNumber)) { - cout << "Bad input! "; - continue; - } - - int len = ccNumber.length(); - int doubleEvenSum = 0; - - - - for (int i = len - 2; i >= 0; i = i - 2) { - int dbl = ((ccNumber[i] - 48) * 2); - if (dbl > 9) { - dbl = (dbl / 10) + (dbl % 10); - } - doubleEvenSum += dbl; - } - - - - for (int i = len - 1; i >= 0; i = i - 2) { - doubleEvenSum += (ccNumber[i] - 48); - } - - - - cout << (doubleEvenSum % 10 == 0 ? "Valid!" : "Invalid!") << endl; - - continue; - } - - return 0; -} diff --git a/Random_codes /Digital_clock.cpp b/Random_codes /Digital_clock.cpp deleted file mode 100644 index 565c695..0000000 --- a/Random_codes /Digital_clock.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#include -#include -#include -#include -#include -using namespace std; - -int c_Code(int c_year) -{ - if (c_year % 4 == 0 && c_year % 100 != 0 || c_year % 400 == 0) - return 0; - else if (c_year == 1700 || c_year == 2100 || c_year == 2500) - return 5; - else if (c_year == 1800 || c_year == 2200) - return 3; - else if (c_year == 1900 || c_year == 2300) - return 1; -} -int dayCode(int day, int month, int year) { - int i, c_year, ccode, ycode, lyear, days = 0, dayCode; - int monthCode[] = { 31,year % 4 == 0 && year % 100 != 0 || year % 400 == 0 ? 29 : 28,31,30,31,30,31,31,30,31,30,31 }; - ycode = (year - 1) % 100; - c_year = (year - 1) - ycode; - lyear = ycode / 4; - ccode = c_Code(c_year); - for (i = 0; i < month - 1; i++) { - days += monthCode[i]; - } - days = days + day; - dayCode = (ccode + ycode % 7 + lyear % 7 + days % 7) % 7; - return dayCode; -} -void printMon(int dayc, int mon) { - int i, j, k = 1; - cout << " ---------------------------------"< 0) { - char month[][20] = { "JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER" }; - int monthCode[] = { 31,year % 4 == 0 && year % 100 != 0 || year % 400 == 0 ? 29 : 28,31,30,31,30,31,31,30,31,30,31 }; - for (int m = 0; m < 12; m++) { - cout << "\n\t ***** " << month[m] << " *****" << endl; - printMon(dayCode(1, m + 1, year), monthCode[m]); - } - } - else - cout << "Invalid year..."; -} - - - -int main() -{ - - int op; - cout << "Press 1 for calendar" << endl; - cout << "Press 2 for time- set in form of HH MM SS " << endl; - cout << "Press 3 for stopwatch" << endl; - cin >> op; - - switch (op) { - case 1: - int year; - cout << "Enter year : "; - cin >> year; - print_calendar(year); - return 0; - break; - - - case 2: - - cout << "SET YOUR TIME" << endl; - - int hr, min, sec; - - cin >> hr >> min >> sec; - - while (true) { - - - system("cls"); - cout << hr << " :" << min << " :" << sec << " pm" << endl; - sec++; - if (sec == 60) { - min++; - sec = 0; - if (min == 60) { - hr++; - min = 0; - if (hr == 12) { - hr = 0; - } - } - } - sleep(1); - } - break; - - - case 3: { - - int hour = 0; - int minute = 0; - int second = 0; - - - while (! _kbhit()) { - - - system("cls"); - //clrscr(); - cout << hour << " hr: " << minute << " min: " << second << " sec" << endl; - second++; - if (second > 59) { - minute++; - second = 0; - if (minute > 59) { - hour++; - minute = 0; - - - - } - } - _sleep(1000); - // cout << "Stopwatch stopped at " << hour << minute << second << endl; - - } - _getch(); - cout << "Stopwatch stopped at " << hour <<" :"<< minute <<": "<< second << endl; - break; - } - - default: - { - cout << "CHOOSE A NUMBER FROM 1-3" << endl; - - } - - - - - - } - - -} diff --git a/Random_codes /Guess Game.javascript b/Random_codes /Guess Game.javascript deleted file mode 100644 index a38a769..0000000 --- a/Random_codes /Guess Game.javascript +++ /dev/null @@ -1,55 +0,0 @@ - - - - Guess the Number Game - - -

Guess the Number Game

-

Try to guess the random number between 1 and 100.

- - -

- - - - diff --git a/Random_codes /Minimize Maximum of Array.cpp b/Random_codes /Minimize Maximum of Array.cpp deleted file mode 100644 index f5ee1aa..0000000 --- a/Random_codes /Minimize Maximum of Array.cpp +++ /dev/null @@ -1,46 +0,0 @@ -class Solution { -public: - - bool isValid(vector &nums, int mid_max, int n) { - - vector arr(begin(nums), end(nums)); - - for(int i = 0; i mid_max) - return false; - - long long buffer = mid_max - arr[i]; - - arr[i+1] = arr[i+1] - buffer; - - } - - return arr[n-1] <= mid_max; - - } - - int minimizeArrayValue(vector& nums) { - int n = nums.size(); - - int maxL = 0; - int maxR = *max_element(begin(nums), end(nums)); - - int result; - - while(maxL <= maxR) { - - int mid_max = maxL + (maxR-maxL)/2; - - if(isValid(nums, mid_max, n)) { - result = mid_max; - maxR = mid_max-1; - } else { - maxL = mid_max+1; - } - - } - - return result; - } -}; diff --git a/Random_codes /PasswordGenerator.html b/Random_codes /PasswordGenerator.html deleted file mode 100644 index ef103c8..0000000 --- a/Random_codes /PasswordGenerator.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - Password Generator - - - - -
Password Generator
- -
- - -
-
- The password will be displayed here - -
- -
-
- - - - - - diff --git a/Random_codes /Tic-Tac-Toe.java b/Random_codes /Tic-Tac-Toe.java deleted file mode 100644 index 250d0c2..0000000 --- a/Random_codes /Tic-Tac-Toe.java +++ /dev/null @@ -1,107 +0,0 @@ -import java.util.Scanner; - -public class TicTacToe { - private static char[][] board = new char[3][3]; - private static char currentPlayer = 'X'; - - public static void main(String[] args) { - initializeBoard(); - boolean gameEnded = false; - - while (!gameEnded) { - displayBoard(); - int[] move = getPlayerMove(); - int row = move[0]; - int col = move[1]; - - if (isValidMove(row, col)) { - makeMove(row, col); - gameEnded = isGameFinished(row, col); - currentPlayer = (currentPlayer == 'X') ? 'O' : 'X'; - } else { - System.out.println("Invalid move. Please try again."); - } - } - - displayBoard(); - char winner = getWinner(); - if (winner == ' ') - System.out.println("It's a draw!"); - else - System.out.println("Player " + winner + " wins!"); - } - - public static void initializeBoard() { - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { - board[i][j] = ' '; - } - } - } - - public static void displayBoard() { - System.out.println("-------------"); - for (int i = 0; i < 3; i++) { - System.out.print("| "); - for (int j = 0; j < 3; j++) { - System.out.print(board[i][j] + " | "); - } - System.out.println("\n-------------"); - } - } - - public static int[] getPlayerMove() { - Scanner scanner = new Scanner(System.in); - int[] move = new int[2]; - System.out.print("Player " + currentPlayer + ", enter row (0-2): "); - move[0] = scanner.nextInt(); - System.out.print("Player " + currentPlayer + ", enter column (0-2): "); - move[1] = scanner.nextInt(); - return move; - } - - public static boolean isValidMove(int row, int col) { - return (row >= 0 && row < 3 && col >= 0 && col < 3 && board[row][col] == ' '); - } - - public static void makeMove(int row, int col) { - board[row][col] = currentPlayer; - } - - public static boolean isGameFinished(int row, int col) { - return (checkRows(row) || checkColumns(col) || checkDiagonals() || checkBoardFull()); - } - - public static boolean checkRows(int row) { - return (board[row][0] == currentPlayer && board[row][1] == currentPlayer && board[row][2] == currentPlayer); - } - - public static boolean checkColumns(int col) { - return (board[0][col] == currentPlayer && board[1][col] == currentPlayer && board[2][col] == currentPlayer); - } - - public static boolean checkDiagonals() { - return ((board[0][0] == currentPlayer && board[1][1] == currentPlayer && board[2][2] == currentPlayer) || - (board[0][2] == currentPlayer && board[1][1] == currentPlayer && board[2][0] == currentPlayer)); - } - - public static boolean checkBoardFull() { - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { - if (board[i][j] == ' ') - return false; - } - } - return true; - } - - public static char getWinner() { - if (checkRows(0) || checkColumns(0) || checkDiagonals()) - return currentPlayer; - else if (checkRows(1) || checkColumns(1)) - return currentPlayer; - else if (checkRows(2) || checkColumns(2)) - return currentPlayer; - return ' '; - } -} diff --git a/Random_codes /Weather tool.python b/Random_codes /Weather tool.python deleted file mode 100644 index 245fbf1..0000000 --- a/Random_codes /Weather tool.python +++ /dev/null @@ -1,31 +0,0 @@ -import requests - -# Replace 'YOUR_API_KEY' with your OpenWeatherMap API key -API_KEY = 'YOUR_API_KEY' - -def get_weather(city_name): - base_url = 'http://api.openweathermap.org/data/2.5/weather' - params = {'q': city_name, 'appid': API_KEY, 'units': 'metric'} - - response = requests.get(base_url, params=params) - - if response.status_code == 200: - data = response.json() - weather_description = data['weather'][0]['description'] - temperature = data['main']['temp'] - humidity = data['main']['humidity'] - wind_speed = data['wind']['speed'] - - report = f"Weather in {city_name}: {weather_description}\n" - report += f"Temperature: {temperature}°C\n" - report += f"Humidity: {humidity}%\n" - report += f"Wind Speed: {wind_speed} m/s" - - return report - else: - return "Error fetching weather data. Please check the city name and try again." - -if __name__ == '__main__': - city_name = input("Enter a city name: ") - weather_report = get_weather(city_name) - print(weather_report) diff --git a/Random_codes /anagram.java b/Random_codes /anagram.java deleted file mode 100644 index de0ec63..0000000 --- a/Random_codes /anagram.java +++ /dev/null @@ -1,28 +0,0 @@ -// anagram = two strings having the same entities -import java.util.Arrays; - -public class anagram { - public static void main(String[] args){ - String str1 = "School Master"; - String str2 = "The Classroom"; - - str1 = str1.replace(" ", ""); - str2 = str2.replace(" ", ""); - - str1 = str1.toLowerCase(); - str2 = str2.toLowerCase(); - - char arr1[] = str1.toCharArray(); - char arr2[] = str2.toCharArray(); - - Arrays.sort(arr1); - Arrays.sort(arr2); - - if(Arrays.equals(arr1, arr2)){ - System.out.println("is Anagram"); - } - else{ - System.out.println("is not Anagram"); - } - } -} diff --git a/Random_codes /lru_page replacement.c b/Random_codes /lru_page replacement.c deleted file mode 100644 index 481214a..0000000 --- a/Random_codes /lru_page replacement.c +++ /dev/null @@ -1,144 +0,0 @@ -#include - -void lru(int string[20], int n, int size) -{ - //Creating array for block storage - int frames[n]; - - //Creating queue to maintain least recently accessed element - int lru_queue[n]; - - //Initializing each block with -1 - for(int i = 0; i < n; i++) - { - frames[i] = -1; - lru_queue[i] = -1; - } - - - - - - //Index to insert element - int index = 0; - int lru_page; - - - //Counters - int page_miss = 0; - int page_hits = 0; - - //Traversing each symbol in lru - for(int i = 0; i < size; i++) - { - int symbol = string[i]; - int flag = 0; - - - - - for(int j = 0; j - - - - - - - Stopwatch - - -
-

Stopwatch

-
-
-
-

-
-
- 00: - 00: - 00: - 000 -
-
-
-

Made by Supragya

-
- - - + + + + + + + + Stopwatch + + +
+

Stopwatch

+
+
+
+

+
+
+ 00: + 00: + 00: + 000 +
+
+
+

Made by Supragya

+
+ + + diff --git a/Stopwatch_Timer/script.js b/Stopwatch_Timer/script.js index 197aeaf..a7ef2fc 100644 --- a/Stopwatch_Timer/script.js +++ b/Stopwatch_Timer/script.js @@ -1,76 +1,76 @@ -let isRunning = false; -let stopwatchInterval; -let milliseconds = 0; -let clockColorChangeInterval; - -document.getElementById("stopwatch").addEventListener("click", toggleStopwatch); - -function toggleStopwatch() { - if (!isRunning) { - document.querySelector(".datetime p").textContent = ""; - startStopwatch(); - startClockColorChange(); - } else { - document.querySelector(".datetime p").textContent = "Click to Start"; - stopStopwatch(); - clearInterval(clockColorChangeInterval); - resetClockStyle(); - } -} - -function startClockColorChange() { - clockColorChangeInterval = setInterval(toggleClockStyle, 1000); -} - -function toggleClockStyle() { - const datetime = document.querySelector(".datetime"); - datetime.classList.toggle("clock-color-glow"); -} - -function resetClockStyle() { - const datetime = document.querySelector(".datetime"); - datetime.classList.remove("clock-color-glow"); -} - -function startStopwatch() { - stopwatchInterval = setInterval(function () { - milliseconds += 10; - if (milliseconds === 1000) { - milliseconds = 0; - incrementTime(); - } - updateDisplay(); - }, 10); - isRunning = true; -} - -function stopStopwatch() { - clearInterval(stopwatchInterval); - isRunning = false; -} - -function incrementTime() { - let seconds = parseInt(document.getElementById("seconds").textContent, 10); - let minutes = parseInt(document.getElementById("minutes").textContent, 10); - let hours = parseInt(document.getElementById("hour").textContent, 10); - - seconds++; - - if (seconds === 60) { - seconds = 0; - minutes++; - } - - if (minutes === 60) { - minutes = 0; - hours++; - } - - document.getElementById("hour").textContent = hours.toString().padStart(2, "0"); - document.getElementById("minutes").textContent = minutes.toString().padStart(2, "0"); - document.getElementById("seconds").textContent = seconds.toString().padStart(2, "0"); -} - -function updateDisplay() { - document.getElementById("milliseconds").textContent = milliseconds.toString().padStart(3, "0"); -} +let isRunning = false; +let stopwatchInterval; +let milliseconds = 0; +let clockColorChangeInterval; + +document.getElementById("stopwatch").addEventListener("click", toggleStopwatch); + +function toggleStopwatch() { + if (!isRunning) { + document.querySelector(".datetime p").textContent = ""; + startStopwatch(); + startClockColorChange(); + } else { + document.querySelector(".datetime p").textContent = "Click to Start"; + stopStopwatch(); + clearInterval(clockColorChangeInterval); + resetClockStyle(); + } +} + +function startClockColorChange() { + clockColorChangeInterval = setInterval(toggleClockStyle, 1000); +} + +function toggleClockStyle() { + const datetime = document.querySelector(".datetime"); + datetime.classList.toggle("clock-color-glow"); +} + +function resetClockStyle() { + const datetime = document.querySelector(".datetime"); + datetime.classList.remove("clock-color-glow"); +} + +function startStopwatch() { + stopwatchInterval = setInterval(function () { + milliseconds += 10; + if (milliseconds === 1000) { + milliseconds = 0; + incrementTime(); + } + updateDisplay(); + }, 10); + isRunning = true; +} + +function stopStopwatch() { + clearInterval(stopwatchInterval); + isRunning = false; +} + +function incrementTime() { + let seconds = parseInt(document.getElementById("seconds").textContent, 10); + let minutes = parseInt(document.getElementById("minutes").textContent, 10); + let hours = parseInt(document.getElementById("hour").textContent, 10); + + seconds++; + + if (seconds === 60) { + seconds = 0; + minutes++; + } + + if (minutes === 60) { + minutes = 0; + hours++; + } + + document.getElementById("hour").textContent = hours.toString().padStart(2, "0"); + document.getElementById("minutes").textContent = minutes.toString().padStart(2, "0"); + document.getElementById("seconds").textContent = seconds.toString().padStart(2, "0"); +} + +function updateDisplay() { + document.getElementById("milliseconds").textContent = milliseconds.toString().padStart(3, "0"); +} diff --git a/Stopwatch_Timer/style.css b/Stopwatch_Timer/style.css index e74f0bb..63f9437 100644 --- a/Stopwatch_Timer/style.css +++ b/Stopwatch_Timer/style.css @@ -1,115 +1,115 @@ -* { - margin: 0; - padding: 0; - box-sizing: border-box; - } - - header { - position: absolute; - font-size: 20px; - color: #fff; - font-family:'Times New Roman', Times, serif; - top: 0; - left: 0; - padding: 10px; - -} -footer{ - position: absolute; - bottom: 0; - right: 0; - padding: 10px; - color: #fff; - font-family:'Times New Roman', Times, serif; - font-style: italic; - font-size: 20px; -} - -#logo { - width: 100px; - height: auto; - cursor: pointer; -} - - body { - height: 100vh; - display: flex; - justify-content: center; - align-items: center; - background: #10101e; - } - .start-button { - background-color: #2e94e3; - color: #fff; - border: none; - padding: 10px 20px; - font-size: 16px; - cursor: pointer; - border-radius: 5px; - transition: background-color 0.3s ease; -} - -.start-button:hover { - background-color: #1d6fa5; -} - - .datetime { - color: #fff; - background: #10101e; - width: 370px; - padding: 15px 10px; - border: 3px solid #2e94e3; - border-radius: 5px; - -webkit-box-reflect: below 1px - linear-gradient(transparent, rgba(255, 255, 255, 0.1)); - transition: 0.5s; - } - - .datetime:hover { - background-color: #2e94e3; - box-shadow: 0 0 30px #2e94e3; - } - - .date { - font-size: 20px; - font-weight: 600; - text-align: center; - letter-spacing: 3px; - } - - .time { - font-size: 60px; - display: flex; - justify-content: center; - align-items: center; - } - - .time span:not(:last-child) { - position: relative; - margin: 0 6px; - font-weight: 600; - text-align: center; - letter-spacing: 3px; - } - - .time span:last-child { - background: #2e94e3; - font-size: 30px; - font-weight: 600; - text-transform: uppercase; - margin-top: 10px; - padding: 0 7px; - border-radius: 3px; - } -.clock-color-hover { - background-color: #1d6fa5; - transition: background-color 0.5s ease; -} - -.clock-color-glow { - background-color: #1d6fa5; - box-shadow: 0 0 10px #1d6fa5, 0 0 20px #1d6fa5, 0 0 30px #1d6fa5; - transition: background-color 0.5s ease, box-shadow 0.5s ease; -} - +* { + margin: 0; + padding: 0; + box-sizing: border-box; + } + + header { + position: absolute; + font-size: 20px; + color: #fff; + font-family:'Times New Roman', Times, serif; + top: 0; + left: 0; + padding: 10px; + +} +footer{ + position: absolute; + bottom: 0; + right: 0; + padding: 10px; + color: #fff; + font-family:'Times New Roman', Times, serif; + font-style: italic; + font-size: 20px; +} + +#logo { + width: 100px; + height: auto; + cursor: pointer; +} + + body { + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + background: #10101e; + } + .start-button { + background-color: #2e94e3; + color: #fff; + border: none; + padding: 10px 20px; + font-size: 16px; + cursor: pointer; + border-radius: 5px; + transition: background-color 0.3s ease; +} + +.start-button:hover { + background-color: #1d6fa5; +} + + .datetime { + color: #fff; + background: #10101e; + width: 370px; + padding: 15px 10px; + border: 3px solid #2e94e3; + border-radius: 5px; + -webkit-box-reflect: below 1px + linear-gradient(transparent, rgba(255, 255, 255, 0.1)); + transition: 0.5s; + } + + .datetime:hover { + background-color: #2e94e3; + box-shadow: 0 0 30px #2e94e3; + } + + .date { + font-size: 20px; + font-weight: 600; + text-align: center; + letter-spacing: 3px; + } + + .time { + font-size: 60px; + display: flex; + justify-content: center; + align-items: center; + } + + .time span:not(:last-child) { + position: relative; + margin: 0 6px; + font-weight: 600; + text-align: center; + letter-spacing: 3px; + } + + .time span:last-child { + background: #2e94e3; + font-size: 30px; + font-weight: 600; + text-transform: uppercase; + margin-top: 10px; + padding: 0 7px; + border-radius: 3px; + } +.clock-color-hover { + background-color: #1d6fa5; + transition: background-color 0.5s ease; +} + +.clock-color-glow { + background-color: #1d6fa5; + box-shadow: 0 0 10px #1d6fa5, 0 0 20px #1d6fa5, 0 0 30px #1d6fa5; + transition: background-color 0.5s ease, box-shadow 0.5s ease; +} + \ No newline at end of file diff --git a/WebD/Calculator/style.css b/WebD/Calculator/style.css index f7873bf..2a3cbcd 100644 --- a/WebD/Calculator/style.css +++ b/WebD/Calculator/style.css @@ -1,142 +1,142 @@ - -@import url('https://fonts.googleapis.com/css2?family=Yeon+Sung&display=swap'); - -* { - margin: 0; - padding: 0; - box-sizing: border-box; - font-family: consolas; -} - -body { - display: flex; - justify-content: center; - align-items: center; - flex-direction:column; - min-height: 100vh; - background-image: url("images/annie-spratt-0ZPSX_mQ3xI-unsplash.jpg"); - background-repeat: no-repeat; - background-size: cover; - margin-top:2vmin; -} - -.container { - position: relative; - min-width: 30vmin; - min-height: 40vmin; - /* background: #333; */ - padding: 6vmin 5vmin 3vmin; - border-radius: 30px; - box-shadow: 25px 25px 75px rgba(0, 0, 0, 0.25), - 10px 10px 70px rgba(0, 0, 0, 0.25), - inset -5px -5px 15px rgba(0, 0, 0, 0.5), - inset 5px 5px 15px rgba(0, 0, 0, 0.5); -} - -.calculator { - position: relative; - display: grid; -} - -.calculator .value { - position: relative; - grid-column: span 4; - height: 16vmin; - left: 8px; - width: 53vmin; - border: none; - outline: none; - background: #a7af7c; - margin-bottom: 25px; - border-radius: 10px; - box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.75); - text-align: right; - padding: 10px; - font-size: 6vmin; -} - -.calculator span { - position: relative; - display: grid; - place-items: center; - width: 10.5vmin; - height: 10.5vmin; - margin: 1.5vmin; - /* background: linear-gradient(180deg, #2f2f2f, #3f3f3f); */ - box-shadow: 10px 20px 25px rgba(0, 0, 0, 0.4), - 0 0 0 2px rgba(0, 0, 0, 0.75), - inset -8px 0 8px rgba(206, 105, 32, 0.559), - inset 0 -8px 8px rgba(45, 115, 65, 0.712); - color: rgb(6, 54, 83); - user-select: none; - cursor: pointer; - font-weight: 400; - border-radius: 10px; -} - -.calculator span::before { - content: ''; - position: absolute; - top: 3px; - left: 4px; - bottom: 14px; - right: 12px; - /* background: linear-gradient(90deg, #2d2d2d, #4d4d4d); */ - border-radius: 10px; - box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.1), - 10px 5px 10px rgba(0, 0, 0, 0.15); - border-left: 1px solid #0004; - border-bottom: 1px solid #0004; - border-top: 1px solid #0009; -} - -.calculator span:active { - filter: brightness(1.5); -} - -.calculator span i { - position: relative; - font-style: normal; - font-size:3.5vmin; - text-transform: uppercase; -} - -.calculator .clear { - grid-column: span 2; - width: 25.5vmin; - background: #f00; -} - -.calculator .clear::before { - background: linear-gradient(90deg, #d20000, #ffffff5c); - border-left: 1px solid #fff4; - border-bottom: 1px solid #fff4; - border-top: 1px solid #fff4; -} - -.calculator .plus { - grid-row: span 2; - height:24.5vmin; -} - -.calculator .equal { - background: #2196f3 -} - -.calculator .equal::before { - background: linear-gradient(90deg, #1479c9, #ffffff5c); - border-left: 1px solid #fff4; - border-bottom: 1px solid #fff4; - border-top: 1px solid #fff4; -} -#developer{ - color: #197e4c; - margin-top: 6vmin; - margin-right: 4vmin; - padding-bottom: 4vmin; - font-family: 'Yeon Sung'; - -} -#link{ - text-decoration: none; + +@import url('https://fonts.googleapis.com/css2?family=Yeon+Sung&display=swap'); + +* { + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: consolas; +} + +body { + display: flex; + justify-content: center; + align-items: center; + flex-direction:column; + min-height: 100vh; + background-image: url("images/annie-spratt-0ZPSX_mQ3xI-unsplash.jpg"); + background-repeat: no-repeat; + background-size: cover; + margin-top:2vmin; +} + +.container { + position: relative; + min-width: 30vmin; + min-height: 40vmin; + /* background: #333; */ + padding: 6vmin 5vmin 3vmin; + border-radius: 30px; + box-shadow: 25px 25px 75px rgba(0, 0, 0, 0.25), + 10px 10px 70px rgba(0, 0, 0, 0.25), + inset -5px -5px 15px rgba(0, 0, 0, 0.5), + inset 5px 5px 15px rgba(0, 0, 0, 0.5); +} + +.calculator { + position: relative; + display: grid; +} + +.calculator .value { + position: relative; + grid-column: span 4; + height: 16vmin; + left: 8px; + width: 53vmin; + border: none; + outline: none; + background: #a7af7c; + margin-bottom: 25px; + border-radius: 10px; + box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.75); + text-align: right; + padding: 10px; + font-size: 6vmin; +} + +.calculator span { + position: relative; + display: grid; + place-items: center; + width: 10.5vmin; + height: 10.5vmin; + margin: 1.5vmin; + /* background: linear-gradient(180deg, #2f2f2f, #3f3f3f); */ + box-shadow: 10px 20px 25px rgba(0, 0, 0, 0.4), + 0 0 0 2px rgba(0, 0, 0, 0.75), + inset -8px 0 8px rgba(206, 105, 32, 0.559), + inset 0 -8px 8px rgba(45, 115, 65, 0.712); + color: rgb(6, 54, 83); + user-select: none; + cursor: pointer; + font-weight: 400; + border-radius: 10px; +} + +.calculator span::before { + content: ''; + position: absolute; + top: 3px; + left: 4px; + bottom: 14px; + right: 12px; + /* background: linear-gradient(90deg, #2d2d2d, #4d4d4d); */ + border-radius: 10px; + box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.1), + 10px 5px 10px rgba(0, 0, 0, 0.15); + border-left: 1px solid #0004; + border-bottom: 1px solid #0004; + border-top: 1px solid #0009; +} + +.calculator span:active { + filter: brightness(1.5); +} + +.calculator span i { + position: relative; + font-style: normal; + font-size:3.5vmin; + text-transform: uppercase; +} + +.calculator .clear { + grid-column: span 2; + width: 25.5vmin; + background: #f00; +} + +.calculator .clear::before { + background: linear-gradient(90deg, #d20000, #ffffff5c); + border-left: 1px solid #fff4; + border-bottom: 1px solid #fff4; + border-top: 1px solid #fff4; +} + +.calculator .plus { + grid-row: span 2; + height:24.5vmin; +} + +.calculator .equal { + background: #2196f3 +} + +.calculator .equal::before { + background: linear-gradient(90deg, #1479c9, #ffffff5c); + border-left: 1px solid #fff4; + border-bottom: 1px solid #fff4; + border-top: 1px solid #fff4; +} +#developer{ + color: #197e4c; + margin-top: 6vmin; + margin-right: 4vmin; + padding-bottom: 4vmin; + font-family: 'Yeon Sung'; + +} +#link{ + text-decoration: none; } \ No newline at end of file diff --git a/WebD/Card-Slider/style.css b/WebD/Card-Slider/style.css index 15c4c51..debd2e8 100644 --- a/WebD/Card-Slider/style.css +++ b/WebD/Card-Slider/style.css @@ -1,141 +1,141 @@ - -@import url('https://fonts.googleapis.com/css2?family=poppins:wght@300;400;500;600;700&display=swap'); -*{ - font-family: 'poppins', sans-serif; - margin: 0; - padding: 0; - box-sizing: border-box; -} -body{ - height: 100vh; - display: flex; - align-items: center; - justify-content: center; - background-color: #f2f2f2; -} -.swiper{ - width: 950px; -} -section{ - position:relative; - height: 450px; - width: 1075px; - display: flex; - align-items: center; -} -section .card .image{ - height: 140px; - width: 140px; - border-radius: 50%; - padding: 3px; - background: #7d2ae8; -} -section .card .image img{ - height: 100%; - width: 100%; - object-fit: cover; - border-radius: 50%; - border: 3px solid #fff; -} -.card{ - position: relative; - background: #fff; - border-radius: 20px; - margin: 20px 0; - -} -.card::before{ - content: ''; - position: absolute; - height: 45%; - width: 100%; - background: #7d2ae8; - border-radius: 20px 20px 0 0; -} -.card .card-content{ - display: flex; - flex-direction: column; - align-items: center; - padding: 30px; - position: relative; - z-index: 100; -} -.card .media-icon{ - position: absolute; - top: 10px; - right: 20px; - display: flex; - flex-direction: column; - align-items: center; -} -.card .media-icon i{ - color: #fff; - opacity: 0.6; - margin-top: 10px; - transition: all 0.3s ease; - cursor: pointer; -} -.card .media-icon i:hover{ - opacity: 1; -} -.card .name-profession{ - display: flex; - flex-direction: column; - align-items: center; - margin-top: 10px; - color: #333; -} -.name-profession .name{ - font-size: 20px; - font-weight: 600; -} -.name-profession .profession{ - font-size: 15px; - font-weight: 500; - margin-top: 10px; -} -.card .rating{ - display: flex; - align-items: center; - margin-top: 15px; -} -.card .rating i{ - font-size: 15px; - margin: 0 2px; - color: #7d2ae8; -} -.card .button{ -display: flex; -justify-content: space-around; -width: 100%; -margin-top: 20px; -} -.card .button button{ - background: #9352e7; - outline: none; - border: none; - color: #fff; - padding: 8px 18px; - border-radius:20px; - font-size: 14px; - transition: all 0.3s ease; - cursor: pointer; -} -.button button:hover{ -background: #6c05f2; -} -.swiper-pagination-bullet{ -height: 7px; -width: 26px; -border-radius: 25px; -background:#7d2ae8; -} -.swiper-button-next, .swiper-button-prev{ - opacity: 0.7; - color: #7d2ae8; - transition: all 0.3s ease; -} -.swiper-button-next:hover, .swiper-button-prev:hover{ - opacity:1; - color: #7d2ae8; + +@import url('https://fonts.googleapis.com/css2?family=poppins:wght@300;400;500;600;700&display=swap'); +*{ + font-family: 'poppins', sans-serif; + margin: 0; + padding: 0; + box-sizing: border-box; +} +body{ + height: 100vh; + display: flex; + align-items: center; + justify-content: center; + background-color: #f2f2f2; +} +.swiper{ + width: 950px; +} +section{ + position:relative; + height: 450px; + width: 1075px; + display: flex; + align-items: center; +} +section .card .image{ + height: 140px; + width: 140px; + border-radius: 50%; + padding: 3px; + background: #7d2ae8; +} +section .card .image img{ + height: 100%; + width: 100%; + object-fit: cover; + border-radius: 50%; + border: 3px solid #fff; +} +.card{ + position: relative; + background: #fff; + border-radius: 20px; + margin: 20px 0; + +} +.card::before{ + content: ''; + position: absolute; + height: 45%; + width: 100%; + background: #7d2ae8; + border-radius: 20px 20px 0 0; +} +.card .card-content{ + display: flex; + flex-direction: column; + align-items: center; + padding: 30px; + position: relative; + z-index: 100; +} +.card .media-icon{ + position: absolute; + top: 10px; + right: 20px; + display: flex; + flex-direction: column; + align-items: center; +} +.card .media-icon i{ + color: #fff; + opacity: 0.6; + margin-top: 10px; + transition: all 0.3s ease; + cursor: pointer; +} +.card .media-icon i:hover{ + opacity: 1; +} +.card .name-profession{ + display: flex; + flex-direction: column; + align-items: center; + margin-top: 10px; + color: #333; +} +.name-profession .name{ + font-size: 20px; + font-weight: 600; +} +.name-profession .profession{ + font-size: 15px; + font-weight: 500; + margin-top: 10px; +} +.card .rating{ + display: flex; + align-items: center; + margin-top: 15px; +} +.card .rating i{ + font-size: 15px; + margin: 0 2px; + color: #7d2ae8; +} +.card .button{ +display: flex; +justify-content: space-around; +width: 100%; +margin-top: 20px; +} +.card .button button{ + background: #9352e7; + outline: none; + border: none; + color: #fff; + padding: 8px 18px; + border-radius:20px; + font-size: 14px; + transition: all 0.3s ease; + cursor: pointer; +} +.button button:hover{ +background: #6c05f2; +} +.swiper-pagination-bullet{ +height: 7px; +width: 26px; +border-radius: 25px; +background:#7d2ae8; +} +.swiper-button-next, .swiper-button-prev{ + opacity: 0.7; + color: #7d2ae8; + transition: all 0.3s ease; +} +.swiper-button-next:hover, .swiper-button-prev:hover{ + opacity:1; + color: #7d2ae8; } \ No newline at end of file diff --git a/WebD/Traveler-Landing-Page/index.html b/WebD/Traveler-Landing-Page/index.html index 7dae0af..b6d15d6 100644 --- a/WebD/Traveler-Landing-Page/index.html +++ b/WebD/Traveler-Landing-Page/index.html @@ -1,467 +1,467 @@ - - - - - - - - - Traveler - - - - - - - - -
-
-

Explore The Colourfull World

-
-

A WONDEREFUL GIFT BY NATURE

- Learn More -
-
- - -
-
-

UPCOMING EVENTS

-
-
-
-
- Everest Camp -

Everest Camp Trek

-

Lorem ipsum dolor sit amet consectetur adipisicing elit. Eum itaque consequatur error eos libero officiis - soluta velit! Voluptatum id tempora repellendus veniam?

- Explore -
-
- Everest Camp -

Night Out

-

Lorem ipsum dolor sit amet consectetur adipisicing elit. Eum itaque consequatur error eos libero officiis - soluta velit! Voluptatum id tempora repellendus veniam?

- Explore -
-
- Everest Camp -

Walking Holidays

-

Lorem ipsum dolor sit amet consectetur adipisicing elit. Eum itaque consequatur error eos libero officiis - soluta velit! Voluptatum id tempora repellendus veniam?

- Explore -
- -
-
- - - - - - - - -
-

VISITED PLACES

-
-
- - - - - -
- - - -
-
- Northern Lights -
-
- Place - Date
- Night Camping - necessitatibus velit veritatis ad. - -
- -
-
-
-
- Mountains -
-
- Place - Date
- Deseart - necessitatibus velit veritatis ad. -
- -
-
-
-
- Forest -
-
- Place - Date
- Walking Holidays - necessitatibus velit veritatis ad. -
- -
-
-
-
- Northern Light -
-
- Place - Date
- Evergreen - necessitatibus velit veritatis ad. -
- -
-
-
-
- Northern Light -
-
- Place - Date
- Picnic Days - necessitatibus velit veritatis ad. -
- -
-
-
-
- Cinque Terror -
-
- Place - Date
- Rock Climbing - necessitatibus velit veritatis -
- -
-
-
-
-
-
- - - - - -
-

TOUR  DIARY

-
- - -
- - - - -
- - - - - - - - + + + + + + + + + Traveler + + + + + + + + +
+
+

Explore The Colourfull World

+
+

A WONDEREFUL GIFT BY NATURE

+ Learn More +
+
+ + +
+
+

UPCOMING EVENTS

+
+
+
+
+ Everest Camp +

Everest Camp Trek

+

Lorem ipsum dolor sit amet consectetur adipisicing elit. Eum itaque consequatur error eos libero officiis + soluta velit! Voluptatum id tempora repellendus veniam?

+ Explore +
+
+ Everest Camp +

Night Out

+

Lorem ipsum dolor sit amet consectetur adipisicing elit. Eum itaque consequatur error eos libero officiis + soluta velit! Voluptatum id tempora repellendus veniam?

+ Explore +
+
+ Everest Camp +

Walking Holidays

+

Lorem ipsum dolor sit amet consectetur adipisicing elit. Eum itaque consequatur error eos libero officiis + soluta velit! Voluptatum id tempora repellendus veniam?

+ Explore +
+ +
+
+ + + + + + + + +
+

VISITED PLACES

+
+
+ + + + + +
+ + + +
+
+ Northern Lights +
+
+ Place + Date
+ Night Camping + necessitatibus velit veritatis ad. + +
+ +
+
+
+
+ Mountains +
+
+ Place + Date
+ Deseart + necessitatibus velit veritatis ad. +
+ +
+
+
+
+ Forest +
+
+ Place + Date
+ Walking Holidays + necessitatibus velit veritatis ad. +
+ +
+
+
+
+ Northern Light +
+
+ Place + Date
+ Evergreen + necessitatibus velit veritatis ad. +
+ +
+
+
+
+ Northern Light +
+
+ Place + Date
+ Picnic Days + necessitatibus velit veritatis ad. +
+ +
+
+
+
+ Cinque Terror +
+
+ Place + Date
+ Rock Climbing + necessitatibus velit veritatis +
+ +
+
+
+
+
+
+ + + + + +
+

TOUR  DIARY

+
+ + +
+ + + + +
+ + + + + + + + \ No newline at end of file diff --git a/WebD/Traveler-Landing-Page/post.html b/WebD/Traveler-Landing-Page/post.html index c80bbbb..d689db8 100644 --- a/WebD/Traveler-Landing-Page/post.html +++ b/WebD/Traveler-Landing-Page/post.html @@ -1,252 +1,252 @@ - - - - - - - - Write - - - - - -
- -
-
-
- -

- TAJ MAHAL (iconic monument) -
-
- - -
-

-
- - Author: - VISHAL - - 1 day ago -
-

- India is a country of vibrant culture, diverse traditions, and ancient heritage. It is home to numerous tourist destinations that attract millions of visitors every year. One of the most famous tourist places in India is the Taj Mahal, located in the northern city of Agra. -
-
-The Taj Mahal is an iconic mausoleum built by Mughal Emperor Shah Jahan in memory of his beloved wife Mumtaz Mahal. It is known as one of the world's greatest architectural masterpieces and is considered a symbol of love and devotion. The Taj Mahal is a UNESCO World Heritage Site and one of the Seven Wonders of the World. -
-
- The construction of the Taj Mahal began in 1632 and was completed in 1653. It is made entirely of white marble and adorned with intricate carvings and precious stones. The Taj Mahal's design is a fusion of Persian, Indian, and Islamic architectural styles. The mausoleum's centerpiece is the tomb of Mumtaz Mahal, which is enclosed by a white marble screen and surrounded by four minarets. -
-
- - Visitors to the Taj Mahal can explore the complex, which includes the main mausoleum, a mosque, and a guest house. The complex is situated in a large garden with fountains and reflecting pools, which provide stunning views of the monument. -
-
- The Taj Mahal is a popular tourist destination, and it is best to visit it early in the morning to avoid the crowds. The monument is open every day except Fridays, and the best time to visit is from October to March when the weather is cool and pleasant. -
-
- In addition to the Taj Mahal, visitors to Agra can also explore other historic monuments such as the Agra Fort and Fatehpur Sikri, both of which are UNESCO World Heritage Sites. -
-
- In conclusion, the Taj Mahal is an iconic monument and a must-visit destination for anyone traveling to India. Its stunning architecture and rich history make it a symbol of India's cultural heritage and a testament to the enduring power of love. It is a testament to the artistic and architectural genius of the Mughal Empire, and a remarkable example of India's past. -

- - -
- - -
-
- + + + + + + + + Write + + + + + +
+ +
+
+
+ +

+ TAJ MAHAL (iconic monument) +
+
+ + +
+

+
+ + Author: + VISHAL + + 1 day ago +
+

+ India is a country of vibrant culture, diverse traditions, and ancient heritage. It is home to numerous tourist destinations that attract millions of visitors every year. One of the most famous tourist places in India is the Taj Mahal, located in the northern city of Agra. +
+
+The Taj Mahal is an iconic mausoleum built by Mughal Emperor Shah Jahan in memory of his beloved wife Mumtaz Mahal. It is known as one of the world's greatest architectural masterpieces and is considered a symbol of love and devotion. The Taj Mahal is a UNESCO World Heritage Site and one of the Seven Wonders of the World. +
+
+ The construction of the Taj Mahal began in 1632 and was completed in 1653. It is made entirely of white marble and adorned with intricate carvings and precious stones. The Taj Mahal's design is a fusion of Persian, Indian, and Islamic architectural styles. The mausoleum's centerpiece is the tomb of Mumtaz Mahal, which is enclosed by a white marble screen and surrounded by four minarets. +
+
+ + Visitors to the Taj Mahal can explore the complex, which includes the main mausoleum, a mosque, and a guest house. The complex is situated in a large garden with fountains and reflecting pools, which provide stunning views of the monument. +
+
+ The Taj Mahal is a popular tourist destination, and it is best to visit it early in the morning to avoid the crowds. The monument is open every day except Fridays, and the best time to visit is from October to March when the weather is cool and pleasant. +
+
+ In addition to the Taj Mahal, visitors to Agra can also explore other historic monuments such as the Agra Fort and Fatehpur Sikri, both of which are UNESCO World Heritage Sites. +
+
+ In conclusion, the Taj Mahal is an iconic monument and a must-visit destination for anyone traveling to India. Its stunning architecture and rich history make it a symbol of India's cultural heritage and a testament to the enduring power of love. It is a testament to the artistic and architectural genius of the Mughal Empire, and a remarkable example of India's past. +

+ + +
+ + +
+
+ \ No newline at end of file diff --git a/WebD/Traveler-Landing-Page/style.css b/WebD/Traveler-Landing-Page/style.css index 039467e..3f35bae 100644 --- a/WebD/Traveler-Landing-Page/style.css +++ b/WebD/Traveler-Landing-Page/style.css @@ -1,1058 +1,1058 @@ -@import url('https://fonts.googleapis.com/css2?family=Poppins'); - -* { - margin: 0; - padding: 0; -} - -body, -html { - overflow-x: hidden; -} - -a { - text-decoration: none; -} - -ul { - list-style: none; -} - -.navbar { - position: absolute; - top: 0; - left: 0; - display: flex; - width: 97%; - justify-content: space-between; - padding: 20px; -} - -.logo { - font-size: 3.2vmin; - color: whitesmoke; - opacity: 0.6; -} - -.nav-links { - display: flex; - align-items: center; - float: right; -} - -.nav-links li { - margin: 0 15px; -} - -.nav-links li a { - color: whitesmoke; -} - -.nav-links .ctn { - padding: 8px 15px; - background: #fc036b; - border-radius: 30px; - color: whitesmoke; -} - -.nav-links .ctn:hover { - color: #fc036b; - background: whitesmoke; - box-shadow: 5px 7px 5px black; - -} - -header { - width: 100vw; - height: 100vh; - background-image: url(image/header-bg.png); - background-position: bottom; - background-size: cover; - display: flex; - align-items: flex-end; - justify-content: center; - -} - -.header-content { - margin-bottom: 150px; - color: whitesmoke; - text-align: center; -} - -.header-content h2 { - font-size: 5vmin; -} - -.line { - width: 85vmin; - height: 3px; - background: #fc036b; - margin: 12px auto; - border-radius: 10px; -} - -.header-content h1 { - font-size: 7vmin; - margin-top: 20px; - margin-bottom: 30px; -} - -.nav-links .active { - color: #fc036b; - font-weight: 900; -} - -.header-content .ctn { - color: whitesmoke; - padding: 7px 12px; - border-radius:30px; - font-size: 18px; - transition: all 0.3s ease; - cursor: pointer; - margin-top: 40px; - border: 1.5px solid #ccc; -} - -.header-content .ctn:hover { - background: #fc036b; - color: whitesmoke; - box-shadow: 7px 9px 5px black; -} - -.menu-btn { - position: absolute; - top: 30px; - right: 30px; - width: 35px; - cursor: pointer; - display: none; -} - - -/* Event */ - -section { - width: 85%; - margin: 80px auto; -} - -.title { - text-align: center; - font-size: 5vmin; - color: #484872; -} - -.line1 { - width: 80vmin; - height: 3px; - background: #fc036b; - margin-top: 2vmin; - margin-bottom:4vmin; - margin-left: auto; - margin-right: auto; - border-radius: 10px; -} - -.row { - display: flex; - align-items: center; - width: 100%; - justify-content: space-between; -} - -.row .col img { - width: 85%; - height: 100%; - border-radius: 5px; -} -.row .col img:hover{ - transform: scale(0.8); - -} - -.row .col { - display: flex; - flex-direction: column; - align-items: center; - margin: 2vmin; - padding: 30px 0px; - border: 1px solid #ccc; - background: #f0efef; -} -.row .col:hover{ - box-shadow: 25px 25px 50px 15px #44444464 inset; - border: 1px solid #444444; -} - -.event .row { - margin-top: 50px; -} - -h4 { - font-size: 3vmin; - color: #484872; - margin: 20px auto; -} - -p { - color: #7c7c7c; - padding: 0px 40px; - -} - -.events .ctn { - background: #fc036b; - color: whitesmoke; - padding: 8px 15px; - border-radius: 150px; - font-size: 19px; - transition: all 0.3s ease; - cursor: pointer; - margin-top: 4vmin; - border: 1px solid #ccc; -} - -.events .ctn:hover { - background: whitesmoke; - color: #fc036b; - box-shadow: 5px 4px 5px black; -} - - - - - -/* explore */ - - - -.carousel-container { - position: relative; - width: 85%; - height: 80vh; - padding: 20px 0; - overflow-x: hidden; - margin-top: 80px; - overflow: hidden; - } - .carousel { - display: flex; - width: 100%; - height: 100%; - position: relative; - margin: auto; - } - .slider { - flex: 0 0 auto; - margin-right: 30px; - position: relative; - background: rgba(0, 0, 0, 0.5); - border-radius: 5px; - width: 100%; - height: 100%; - left: 0; - transition: 1s; - overflow: hidden; - } - .slider img { - width: 100%; - min-height: 100%; - object-fit: cover; - display: block; - margin-left: auto; - } - .slide-content { - position:absolute; - width: 70%; - height: 100%; - z-index: 2; - background: linear-gradient(to right, #030b17cf 30%, #0c111b00 50%); - color: whitesmoke; - } - .movie-title { - margin-left: 7vmin; - font-size: 6vmin; - text-transform: capitalize; - margin-top:15vmin; - } - .movie-des { - width: 70%; - line-height: 30px; - padding-left: 50px; - margin-top: 30px; - opacity:1; - color: rgb(221, 221, 221); - } - .slide-content .ctn { - - background: #fc036b; - color: whitesmoke; - padding: 8px 15px; - border-radius: 150px; - font-size: 20px; - transition: all 0.3s ease; - cursor: pointer; - margin-top: 40px; - border: 1px solid #ccc; -} - -.slide-content .ctn:hover { - background: whitesmoke; - color: #fc036b; - box-shadow: 7px 9px 5px black; -} - - -/* Visited */ - - -.visited .title { - text-align: center; - font-size: 3vmin; - color: #484872; - margin-bottom: 5vmin; -} - -.line3 { - width: 80vmin; - height: 3px; - background: #fc036b; - margin-top: 10px; - margin-left: auto; - margin-right: auto; - border-radius: 20vmin; -} - -.container { - width: 94%; - align-items: center; - justify-content: center; - position: relative; - margin: 10px auto; -} -.content{ - display: flex; - position: relative; - width: 90%; - margin: 0 auto; - align-items: center; - overflow-x: auto; - overflow-y: visible; - scroll-behavior: smooth; -} -.content::-webkit-scrollbar { - display: none; - } - .card { - display: flex; - align-items: center; - justify-content: center; - flex-direction: column; - position: relative; - min-width:40vmin; - width:40vmin; - height:auto; - border-radius: 5px; - overflow: hidden; - margin-right: 10px; - transition: 0.5s; - margin: 3vmin 3vmin 3vmin 0; - background-color: #f0efef; - border: 1px solid #ccc; - padding: 0 0 1vmin 0; - } -.card .image { - padding: 4vmin; - width: 30vmin; - height: 25vmin; - padding-bottom: 0; -} - -.card .image img { - height: 100%; - width: 100%; - object-fit: cover; -} -.card .image:hover{ -transform: scale(0.8); -} -.detail{ - color:#fc036b; - font-size: 14px; - margin: 0.6vmin auto; -} -.place{ - margin-right: 0.3vmin; -} -.date{ - margin-left: 0.3vmin; -} -.card .name-profession { - display: flex; - flex-direction: column; - align-items: center; - margin-top: 10px; - color: #333; -} - -.name-profession .name { - margin-top: 1vmin; - font-size: 3vmin; - font-weight: 400; - color: #484872; -} - -.name-profession .profession { - font-size: 2.5vmin; - font-weight: 400; - margin-top: 1vmin; - color: #7c7c7c; - padding: 0px 20px; -} - -.card .button { - display: flex; - justify-content: space-around; - width: 100%; - margin-top: 20px; -} - -.card .button button { - background: #fc036b; - color: whitesmoke; - padding: 7px 12px; - border-radius: 150px; - font-size: 14px; - transition: all 0.3s ease; - cursor: pointer; - margin-bottom: 1vmin; - border: 1px solid #ccc; - width: fit-content; -} - -.button button:hover { - background: whitesmoke; - color: #fc036b; - box-shadow: 5px 4px 5px black; - - -} -.pre-btn, -.nxt-btn { - position: absolute; - top: 0; - width: 5%; - height: 100%; - z-index: 2; - border: none; - cursor: pointer; - outline: none; - color: black; -} -.pre-btn { - left: 0; - background: transparent; - -} -.nxt-btn { - right: 0; - background: transparent; - -} -.pre-btn img, -.nxt-btn img { - width: 25px; - height: 40px; - opacity: 0; -} - -.pre-btn:hover img, -.nxt-btn:hover img { - opacity: 1; - box-shadow: 0 10px 18px rgb(0, 0, 0); -} - -/* Diary */ - -.middles { - position: relative; - display: flex; - text-align: center; - justify-content: center; - width: 85%; - margin: 8vmin auto 4vmin auto ; -} - -.middles h1 { - font-size: 12vmin; - color: #484872; -} - - -/* second part */ - -.body { - width: 85%; - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; - margin: 2vmin auto 2vmin auto; - border-radius: 10px; - margin-bottom: 9vmin; - background: #f0efef 40%; - - -} -.body-container-1 { - position: relative; - display: flex; - flex-direction: row; - flex-wrap: wrap; - justify-content: center; - align-items: center; - width: 90%; - border-radius: 20px; - padding:2% 2% 15% 2%; - margin: 10vmin; - box-shadow: 15px 19px 25px black; - border: 2px solid #44444492; -} -.body-container-2 .icon-links{ - margin: 1.5vmin auto; - padding-bottom: 3vmin; -} -.body-container-2 { - position:absolute; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - border-radius:30px; - background:transparent; - margin:0; - margin-bottom: -80vmin; -} -.body-container-2 .ctn { - display: flex; - align-items: center; - justify-content: center; - width: fit-content; - margin: 1vmin auto; - background: #fc036b; - color: whitesmoke; - padding: 1.5vmin 3.5vmin; - border-radius: 150px; - font-size:3vmin; - transition: all 0.3s ease; - cursor: pointer; - border: 1px solid #ccc; -} -.body-container-2 .ctn:hover { - background: whitesmoke; - color: #fc036b; - box-shadow: 5px 4px 5px black; -} -.body .posterImg { - display: flex; - align-items: center; - justify-content: center; - width: 82%; - height: 75%; - border-radius: 10px; - margin-top: 3.7vmin; - margin-left: 25px; -} -.sec-1, .sec-2, .sec-3, .sec-4, .sec-5, .sec-6 { - width: 45vmin; - height: 31vmin; - border: 1px solid #ccc; - background:rgba(255, 255, 255, 0.801); - margin: 2.3vmin; - border-radius: 10px; - position: relative; - -} - -.posterImg { - opacity: 1; - display: block; - width: 100%; - height: auto; - transition: .5s ease; - backface-visibility: hidden; -} - -.middle { - transition: .5s ease; - opacity: 0; - position: absolute; - top: 90%; - left: 50%; - transform: translate(-50%, -50%); - -ms-transform: translate(-50%, -50%); - text-align: center; -} - - -.sec-6:hover .posterImg { - transform: translate(0%, -10%); - border-radius: 50%; -} -.sec-6:hover{ - box-shadow: 5px 8px 20px black; -} -.sec-6:hover .middle { - opacity: 1; -} - -.sec-5:hover .posterImg { - transform: translate(0%, -10%); - border-radius: 50%; -} -.sec-5:hover{ - box-shadow: 5px 8px 20px black; -} -.sec-5:hover .middle { - opacity: 1; -} - -.sec-4:hover .posterImg { - transform: translate(0%, -10%); - border-radius: 50%; -} -.sec-4:hover{ - box-shadow: 5px 8px 20px black; -} -.sec-4:hover .middle { - opacity: 1; -} - -.sec-3:hover .posterImg { - transform: translate(0%, -10%); - border-radius: 50%; -} -.sec-3:hover{ - box-shadow: 5px 8px 20px black; -} -.sec-3:hover .middle { - opacity: 1; -} - -.sec-2:hover .posterImg { - transform: translate(0%, -10%); - border-radius: 50%; - border: 1px solid #ccc; -} -.sec-2:hover{ - box-shadow: 5px 8px 20px black; -} -.sec-2:hover .middle { - opacity: 1; -} - -.sec-1:hover .posterImg { - transform: translate(0%, -10%); - border-radius: 50%; -} -.sec-1:hover{ - box-shadow: 5px 8px 20px black; -} -.sec-1:hover .middle { - opacity: 1; -} - -.text { - color: #444444; - font-family: "Lora", serif; - font-weight:bold; - font-size: 14px; - cursor: pointer; - width: fit-content; -} -.text a:hover{ - color: #fc036b; -} - -/* icon popup */ - -.icon-links{ - position:relative; - display: flex; - gap: 4vmin; -} -.icon-links li{ - position: relative; - list-style: none; - width: 8vmin; - height: 8vmin; - background: #fff; - cursor: pointer; - display: flex; - align-items: center; - justify-content: center; - border-radius: 60px; - box-shadow: 5px 10px 15px rgba(0,0,0,0.5); - transition: 0.5s; -} -.icon-links li:hover{ - width: 22vmin; - box-shadow: 0 10px 25px rgba(0,0,0,0.5); -} -.icon-links li::before{ - content: ''; - position: absolute; - inset: 0; - border-radius: 60px; - background: linear-gradient(45deg,var(--i),var(--j)); - opacity: 0; - transition: 0.5s; -} -.icon-links li:hover::before{ - opacity: 1; -} -.icon-links li::after{ - content: ''; - position: absolute; - width: 100%; - height: 100%; - border-radius: 60px; - background: linear-gradient(45deg,var(--i),var(--j)); - opacity: 0; - z-index: -1; - filter: blur(15px); - transition: 0.5s; -} -.icon-links li:hover::after{ - opacity: 0.5; -} -.icon-links li ion-icon{ -color: #777; -font-size: 4vmin; -transition: 0.5s; -transition-delay: 0.25s; -} -.icon-links li:hover ion-icon{ - transform: scale(0); - color: #fff; - transition: 0s; -} -.icon-links li span{ - position: absolute; -} -.icon-links li .title{ - color:#fff; - font-size: 2.5vmin; - text-transform: uppercase; - letter-spacing: 0.3vmin; - transform: scale(0); - transition: 0.5s; - transition-delay: 0s; -} -.icon-links li:hover .title{ - transform: scale(1); - transition-delay: 0.25s; -} - -/* footer */ -.footer { - width: 100%; - min-height: 100px; - padding: 40px auto 30px auto; - margin: 0; - background: #484872; - text-align: center; -} - -.box1 { - width: 100%; - display: flex; - flex-direction: row; - padding: 30px auto 30px auto; - color: whitesmoke; - -} - -.part { - width: 20%; - margin: 3vmin; - text-align: center; - -} - -.part h3 { - font-size: 2.5vmin; - font-weight: 600; -} - -.part-social h3 { - font-size: 2.5vmin; - font-weight: 600; -} - -.part-social h4 { - font-size: 3vmin; - color: whitesmoke; - font-weight: 500; -} - -.part-social { - width: 40%; - margin: 3vmin; - padding-top: 2vmin; - text-align: center; - /* background:#7c7c7c; */ -} - -.social-media { - display: flex; - flex-direction: row; - justify-content: center; - padding-top: 2.3vmin; -} - -.social-icon { - height: 6vmin; - width: 6vmin; - display: flex; - justify-content: center; - align-items: center; - margin: 0 0.2rem; - border-radius: 50%; - background: whitesmoke; - border: 2px solid whitesmoke; - text-decoration: none; - /* font-size: 0; */ - transition: 0.3s; -} - -.social-icon:hover { - border: 2px solid black; -} - -.part li { - padding-top: 1.5vmin; - font-size: 3vmin; -} - -.part li a { - color: whitesmoke; -} - -.underline { - margin: 5vmin 40vmin 5vmin 40vmin; -} - -.footer .box { - width: 100%; - min-height: 100px; - padding: 20px auto 20px auto; - margin: 0; - background: #484872; - text-align: center; - -} - -.footer .box p { - color: whitesmoke; - padding-top: 20px; -} - - - -/* resposive */ - -@media only screen and (max-width:1550px) { - .tours .row .col1 { - width: 40%; - - } - .image-gallery img { - width: 20vmin; - padding: 10px; - - } - .body{ - display: flex; - flex-direction: column; - border-radius: 10px; - } - .body-container-1{ - width: 88%; - border-radius: 20px; - padding:4% 4%; - padding-bottom: 25%; - margin: 2% 0; - } - .body-container-2{ - width: 100%; - margin-bottom: -78vmin; - } - .body-container-2 .ctn{ - margin: 1vmin auto; - } - .sec-1, .sec-2, .sec-3, .sec-5, .sec-4, .sec-6{ - width: 29%; - margin: 2vmin; - } -} - -@media only screen and (max-width:1100px) { - .row .col { - margin: 0; - margin-bottom: 5vmin; - } - .row{ - flex-direction: column; - } - .body { - flex-direction: column; - border-radius: 10px; - } - - .body-container-1 { - width: 88%; - border-radius:20px; - padding:10% 3%; - margin: 3% 0; - padding-bottom: 27%; - } - - .body-container-2 { - width: 70%; - flex-direction: column; - align-items: center; - justify-content: center; - padding: 2vmin; - margin-bottom: -117vmin; - - } - - .image-gallery img { - width: 75vmin; - padding-left: auto; - - } - .sec-1, .sec-2, .sec-3, .sec-5, .sec-4, .sec-6{ - width: 40%; - margin: 2vmin; - } - -} - -@media only screen and (max-width:850px) { - .menu-btn { - display: block; - } - - .navbar { - padding: 0; - width: 100%; - } - - .logo { - position: absolute; - top: 30px; - left: 30px; - } - - .nav-links { - flex-direction: column; - width: 100%; - height: 100vh; - justify-content: center; - background: #484872; - margin-top: -900px; - transition: all 0.7s ease; - } - - .mobile-menu { - margin-top: 0px; - border-bottom-right-radius: 60%; - - } - - .nav-links li { - margin: 20px auto; - } - .row{ - flex-direction: column; - } - .body { - flex-direction: column; - width: 85%; - } - - .body-container-2 { - width: 50%; - display: flex; - justify-content: center; - align-items: center; - margin-bottom: -365vmin; - - } - - .body-container-1 { - width: 85%; - margin: 0; - border-radius: 20px; - margin: 5% 0; - padding:7% 3%; - padding-bottom: 30%; - flex-direction: column; - display: flex; - justify-content: center; - align-items: center; - } - .body .posterImg{ - width: 80%; - margin: 0; - margin-left:7vmin; - } - .body-container-2 .icon-links{ - margin-left: -8vmin; - } - .sec-1, .sec-2, .sec-3, .sec-5, .sec-4, .sec-6{ - width: 90%; - height:55vmin; - margin-bottom: 3vmin; - display: flex; - align-items: center; - justify-content: center; - } -} - - - - -/* animations */ - -img { - transition: transform .3s ease; -} - -/* img:hover { - transform: scale(1.15); -} */ - -.ctn:hover { - background: whitesmoke; - color: #fc036b; - box-shadow: 7px 9px 5px black; -} - -li a:hover { - color: #fc036b; - cursor: pointer; -} - - - - - - - - - - +@import url('https://fonts.googleapis.com/css2?family=Poppins'); + +* { + margin: 0; + padding: 0; +} + +body, +html { + overflow-x: hidden; +} + +a { + text-decoration: none; +} + +ul { + list-style: none; +} + +.navbar { + position: absolute; + top: 0; + left: 0; + display: flex; + width: 97%; + justify-content: space-between; + padding: 20px; +} + +.logo { + font-size: 3.2vmin; + color: whitesmoke; + opacity: 0.6; +} + +.nav-links { + display: flex; + align-items: center; + float: right; +} + +.nav-links li { + margin: 0 15px; +} + +.nav-links li a { + color: whitesmoke; +} + +.nav-links .ctn { + padding: 8px 15px; + background: #fc036b; + border-radius: 30px; + color: whitesmoke; +} + +.nav-links .ctn:hover { + color: #fc036b; + background: whitesmoke; + box-shadow: 5px 7px 5px black; + +} + +header { + width: 100vw; + height: 100vh; + background-image: url(image/header-bg.png); + background-position: bottom; + background-size: cover; + display: flex; + align-items: flex-end; + justify-content: center; + +} + +.header-content { + margin-bottom: 150px; + color: whitesmoke; + text-align: center; +} + +.header-content h2 { + font-size: 5vmin; +} + +.line { + width: 85vmin; + height: 3px; + background: #fc036b; + margin: 12px auto; + border-radius: 10px; +} + +.header-content h1 { + font-size: 7vmin; + margin-top: 20px; + margin-bottom: 30px; +} + +.nav-links .active { + color: #fc036b; + font-weight: 900; +} + +.header-content .ctn { + color: whitesmoke; + padding: 7px 12px; + border-radius:30px; + font-size: 18px; + transition: all 0.3s ease; + cursor: pointer; + margin-top: 40px; + border: 1.5px solid #ccc; +} + +.header-content .ctn:hover { + background: #fc036b; + color: whitesmoke; + box-shadow: 7px 9px 5px black; +} + +.menu-btn { + position: absolute; + top: 30px; + right: 30px; + width: 35px; + cursor: pointer; + display: none; +} + + +/* Event */ + +section { + width: 85%; + margin: 80px auto; +} + +.title { + text-align: center; + font-size: 5vmin; + color: #484872; +} + +.line1 { + width: 80vmin; + height: 3px; + background: #fc036b; + margin-top: 2vmin; + margin-bottom:4vmin; + margin-left: auto; + margin-right: auto; + border-radius: 10px; +} + +.row { + display: flex; + align-items: center; + width: 100%; + justify-content: space-between; +} + +.row .col img { + width: 85%; + height: 100%; + border-radius: 5px; +} +.row .col img:hover{ + transform: scale(0.8); + +} + +.row .col { + display: flex; + flex-direction: column; + align-items: center; + margin: 2vmin; + padding: 30px 0px; + border: 1px solid #ccc; + background: #f0efef; +} +.row .col:hover{ + box-shadow: 25px 25px 50px 15px #44444464 inset; + border: 1px solid #444444; +} + +.event .row { + margin-top: 50px; +} + +h4 { + font-size: 3vmin; + color: #484872; + margin: 20px auto; +} + +p { + color: #7c7c7c; + padding: 0px 40px; + +} + +.events .ctn { + background: #fc036b; + color: whitesmoke; + padding: 8px 15px; + border-radius: 150px; + font-size: 19px; + transition: all 0.3s ease; + cursor: pointer; + margin-top: 4vmin; + border: 1px solid #ccc; +} + +.events .ctn:hover { + background: whitesmoke; + color: #fc036b; + box-shadow: 5px 4px 5px black; +} + + + + + +/* explore */ + + + +.carousel-container { + position: relative; + width: 85%; + height: 80vh; + padding: 20px 0; + overflow-x: hidden; + margin-top: 80px; + overflow: hidden; + } + .carousel { + display: flex; + width: 100%; + height: 100%; + position: relative; + margin: auto; + } + .slider { + flex: 0 0 auto; + margin-right: 30px; + position: relative; + background: rgba(0, 0, 0, 0.5); + border-radius: 5px; + width: 100%; + height: 100%; + left: 0; + transition: 1s; + overflow: hidden; + } + .slider img { + width: 100%; + min-height: 100%; + object-fit: cover; + display: block; + margin-left: auto; + } + .slide-content { + position:absolute; + width: 70%; + height: 100%; + z-index: 2; + background: linear-gradient(to right, #030b17cf 30%, #0c111b00 50%); + color: whitesmoke; + } + .movie-title { + margin-left: 7vmin; + font-size: 6vmin; + text-transform: capitalize; + margin-top:15vmin; + } + .movie-des { + width: 70%; + line-height: 30px; + padding-left: 50px; + margin-top: 30px; + opacity:1; + color: rgb(221, 221, 221); + } + .slide-content .ctn { + + background: #fc036b; + color: whitesmoke; + padding: 8px 15px; + border-radius: 150px; + font-size: 20px; + transition: all 0.3s ease; + cursor: pointer; + margin-top: 40px; + border: 1px solid #ccc; +} + +.slide-content .ctn:hover { + background: whitesmoke; + color: #fc036b; + box-shadow: 7px 9px 5px black; +} + + +/* Visited */ + + +.visited .title { + text-align: center; + font-size: 3vmin; + color: #484872; + margin-bottom: 5vmin; +} + +.line3 { + width: 80vmin; + height: 3px; + background: #fc036b; + margin-top: 10px; + margin-left: auto; + margin-right: auto; + border-radius: 20vmin; +} + +.container { + width: 94%; + align-items: center; + justify-content: center; + position: relative; + margin: 10px auto; +} +.content{ + display: flex; + position: relative; + width: 90%; + margin: 0 auto; + align-items: center; + overflow-x: auto; + overflow-y: visible; + scroll-behavior: smooth; +} +.content::-webkit-scrollbar { + display: none; + } + .card { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + position: relative; + min-width:40vmin; + width:40vmin; + height:auto; + border-radius: 5px; + overflow: hidden; + margin-right: 10px; + transition: 0.5s; + margin: 3vmin 3vmin 3vmin 0; + background-color: #f0efef; + border: 1px solid #ccc; + padding: 0 0 1vmin 0; + } +.card .image { + padding: 4vmin; + width: 30vmin; + height: 25vmin; + padding-bottom: 0; +} + +.card .image img { + height: 100%; + width: 100%; + object-fit: cover; +} +.card .image:hover{ +transform: scale(0.8); +} +.detail{ + color:#fc036b; + font-size: 14px; + margin: 0.6vmin auto; +} +.place{ + margin-right: 0.3vmin; +} +.date{ + margin-left: 0.3vmin; +} +.card .name-profession { + display: flex; + flex-direction: column; + align-items: center; + margin-top: 10px; + color: #333; +} + +.name-profession .name { + margin-top: 1vmin; + font-size: 3vmin; + font-weight: 400; + color: #484872; +} + +.name-profession .profession { + font-size: 2.5vmin; + font-weight: 400; + margin-top: 1vmin; + color: #7c7c7c; + padding: 0px 20px; +} + +.card .button { + display: flex; + justify-content: space-around; + width: 100%; + margin-top: 20px; +} + +.card .button button { + background: #fc036b; + color: whitesmoke; + padding: 7px 12px; + border-radius: 150px; + font-size: 14px; + transition: all 0.3s ease; + cursor: pointer; + margin-bottom: 1vmin; + border: 1px solid #ccc; + width: fit-content; +} + +.button button:hover { + background: whitesmoke; + color: #fc036b; + box-shadow: 5px 4px 5px black; + + +} +.pre-btn, +.nxt-btn { + position: absolute; + top: 0; + width: 5%; + height: 100%; + z-index: 2; + border: none; + cursor: pointer; + outline: none; + color: black; +} +.pre-btn { + left: 0; + background: transparent; + +} +.nxt-btn { + right: 0; + background: transparent; + +} +.pre-btn img, +.nxt-btn img { + width: 25px; + height: 40px; + opacity: 0; +} + +.pre-btn:hover img, +.nxt-btn:hover img { + opacity: 1; + box-shadow: 0 10px 18px rgb(0, 0, 0); +} + +/* Diary */ + +.middles { + position: relative; + display: flex; + text-align: center; + justify-content: center; + width: 85%; + margin: 8vmin auto 4vmin auto ; +} + +.middles h1 { + font-size: 12vmin; + color: #484872; +} + + +/* second part */ + +.body { + width: 85%; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + margin: 2vmin auto 2vmin auto; + border-radius: 10px; + margin-bottom: 9vmin; + background: #f0efef 40%; + + +} +.body-container-1 { + position: relative; + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + align-items: center; + width: 90%; + border-radius: 20px; + padding:2% 2% 15% 2%; + margin: 10vmin; + box-shadow: 15px 19px 25px black; + border: 2px solid #44444492; +} +.body-container-2 .icon-links{ + margin: 1.5vmin auto; + padding-bottom: 3vmin; +} +.body-container-2 { + position:absolute; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + border-radius:30px; + background:transparent; + margin:0; + margin-bottom: -80vmin; +} +.body-container-2 .ctn { + display: flex; + align-items: center; + justify-content: center; + width: fit-content; + margin: 1vmin auto; + background: #fc036b; + color: whitesmoke; + padding: 1.5vmin 3.5vmin; + border-radius: 150px; + font-size:3vmin; + transition: all 0.3s ease; + cursor: pointer; + border: 1px solid #ccc; +} +.body-container-2 .ctn:hover { + background: whitesmoke; + color: #fc036b; + box-shadow: 5px 4px 5px black; +} +.body .posterImg { + display: flex; + align-items: center; + justify-content: center; + width: 82%; + height: 75%; + border-radius: 10px; + margin-top: 3.7vmin; + margin-left: 25px; +} +.sec-1, .sec-2, .sec-3, .sec-4, .sec-5, .sec-6 { + width: 45vmin; + height: 31vmin; + border: 1px solid #ccc; + background:rgba(255, 255, 255, 0.801); + margin: 2.3vmin; + border-radius: 10px; + position: relative; + +} + +.posterImg { + opacity: 1; + display: block; + width: 100%; + height: auto; + transition: .5s ease; + backface-visibility: hidden; +} + +.middle { + transition: .5s ease; + opacity: 0; + position: absolute; + top: 90%; + left: 50%; + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + text-align: center; +} + + +.sec-6:hover .posterImg { + transform: translate(0%, -10%); + border-radius: 50%; +} +.sec-6:hover{ + box-shadow: 5px 8px 20px black; +} +.sec-6:hover .middle { + opacity: 1; +} + +.sec-5:hover .posterImg { + transform: translate(0%, -10%); + border-radius: 50%; +} +.sec-5:hover{ + box-shadow: 5px 8px 20px black; +} +.sec-5:hover .middle { + opacity: 1; +} + +.sec-4:hover .posterImg { + transform: translate(0%, -10%); + border-radius: 50%; +} +.sec-4:hover{ + box-shadow: 5px 8px 20px black; +} +.sec-4:hover .middle { + opacity: 1; +} + +.sec-3:hover .posterImg { + transform: translate(0%, -10%); + border-radius: 50%; +} +.sec-3:hover{ + box-shadow: 5px 8px 20px black; +} +.sec-3:hover .middle { + opacity: 1; +} + +.sec-2:hover .posterImg { + transform: translate(0%, -10%); + border-radius: 50%; + border: 1px solid #ccc; +} +.sec-2:hover{ + box-shadow: 5px 8px 20px black; +} +.sec-2:hover .middle { + opacity: 1; +} + +.sec-1:hover .posterImg { + transform: translate(0%, -10%); + border-radius: 50%; +} +.sec-1:hover{ + box-shadow: 5px 8px 20px black; +} +.sec-1:hover .middle { + opacity: 1; +} + +.text { + color: #444444; + font-family: "Lora", serif; + font-weight:bold; + font-size: 14px; + cursor: pointer; + width: fit-content; +} +.text a:hover{ + color: #fc036b; +} + +/* icon popup */ + +.icon-links{ + position:relative; + display: flex; + gap: 4vmin; +} +.icon-links li{ + position: relative; + list-style: none; + width: 8vmin; + height: 8vmin; + background: #fff; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + border-radius: 60px; + box-shadow: 5px 10px 15px rgba(0,0,0,0.5); + transition: 0.5s; +} +.icon-links li:hover{ + width: 22vmin; + box-shadow: 0 10px 25px rgba(0,0,0,0.5); +} +.icon-links li::before{ + content: ''; + position: absolute; + inset: 0; + border-radius: 60px; + background: linear-gradient(45deg,var(--i),var(--j)); + opacity: 0; + transition: 0.5s; +} +.icon-links li:hover::before{ + opacity: 1; +} +.icon-links li::after{ + content: ''; + position: absolute; + width: 100%; + height: 100%; + border-radius: 60px; + background: linear-gradient(45deg,var(--i),var(--j)); + opacity: 0; + z-index: -1; + filter: blur(15px); + transition: 0.5s; +} +.icon-links li:hover::after{ + opacity: 0.5; +} +.icon-links li ion-icon{ +color: #777; +font-size: 4vmin; +transition: 0.5s; +transition-delay: 0.25s; +} +.icon-links li:hover ion-icon{ + transform: scale(0); + color: #fff; + transition: 0s; +} +.icon-links li span{ + position: absolute; +} +.icon-links li .title{ + color:#fff; + font-size: 2.5vmin; + text-transform: uppercase; + letter-spacing: 0.3vmin; + transform: scale(0); + transition: 0.5s; + transition-delay: 0s; +} +.icon-links li:hover .title{ + transform: scale(1); + transition-delay: 0.25s; +} + +/* footer */ +.footer { + width: 100%; + min-height: 100px; + padding: 40px auto 30px auto; + margin: 0; + background: #484872; + text-align: center; +} + +.box1 { + width: 100%; + display: flex; + flex-direction: row; + padding: 30px auto 30px auto; + color: whitesmoke; + +} + +.part { + width: 20%; + margin: 3vmin; + text-align: center; + +} + +.part h3 { + font-size: 2.5vmin; + font-weight: 600; +} + +.part-social h3 { + font-size: 2.5vmin; + font-weight: 600; +} + +.part-social h4 { + font-size: 3vmin; + color: whitesmoke; + font-weight: 500; +} + +.part-social { + width: 40%; + margin: 3vmin; + padding-top: 2vmin; + text-align: center; + /* background:#7c7c7c; */ +} + +.social-media { + display: flex; + flex-direction: row; + justify-content: center; + padding-top: 2.3vmin; +} + +.social-icon { + height: 6vmin; + width: 6vmin; + display: flex; + justify-content: center; + align-items: center; + margin: 0 0.2rem; + border-radius: 50%; + background: whitesmoke; + border: 2px solid whitesmoke; + text-decoration: none; + /* font-size: 0; */ + transition: 0.3s; +} + +.social-icon:hover { + border: 2px solid black; +} + +.part li { + padding-top: 1.5vmin; + font-size: 3vmin; +} + +.part li a { + color: whitesmoke; +} + +.underline { + margin: 5vmin 40vmin 5vmin 40vmin; +} + +.footer .box { + width: 100%; + min-height: 100px; + padding: 20px auto 20px auto; + margin: 0; + background: #484872; + text-align: center; + +} + +.footer .box p { + color: whitesmoke; + padding-top: 20px; +} + + + +/* resposive */ + +@media only screen and (max-width:1550px) { + .tours .row .col1 { + width: 40%; + + } + .image-gallery img { + width: 20vmin; + padding: 10px; + + } + .body{ + display: flex; + flex-direction: column; + border-radius: 10px; + } + .body-container-1{ + width: 88%; + border-radius: 20px; + padding:4% 4%; + padding-bottom: 25%; + margin: 2% 0; + } + .body-container-2{ + width: 100%; + margin-bottom: -78vmin; + } + .body-container-2 .ctn{ + margin: 1vmin auto; + } + .sec-1, .sec-2, .sec-3, .sec-5, .sec-4, .sec-6{ + width: 29%; + margin: 2vmin; + } +} + +@media only screen and (max-width:1100px) { + .row .col { + margin: 0; + margin-bottom: 5vmin; + } + .row{ + flex-direction: column; + } + .body { + flex-direction: column; + border-radius: 10px; + } + + .body-container-1 { + width: 88%; + border-radius:20px; + padding:10% 3%; + margin: 3% 0; + padding-bottom: 27%; + } + + .body-container-2 { + width: 70%; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 2vmin; + margin-bottom: -117vmin; + + } + + .image-gallery img { + width: 75vmin; + padding-left: auto; + + } + .sec-1, .sec-2, .sec-3, .sec-5, .sec-4, .sec-6{ + width: 40%; + margin: 2vmin; + } + +} + +@media only screen and (max-width:850px) { + .menu-btn { + display: block; + } + + .navbar { + padding: 0; + width: 100%; + } + + .logo { + position: absolute; + top: 30px; + left: 30px; + } + + .nav-links { + flex-direction: column; + width: 100%; + height: 100vh; + justify-content: center; + background: #484872; + margin-top: -900px; + transition: all 0.7s ease; + } + + .mobile-menu { + margin-top: 0px; + border-bottom-right-radius: 60%; + + } + + .nav-links li { + margin: 20px auto; + } + .row{ + flex-direction: column; + } + .body { + flex-direction: column; + width: 85%; + } + + .body-container-2 { + width: 50%; + display: flex; + justify-content: center; + align-items: center; + margin-bottom: -365vmin; + + } + + .body-container-1 { + width: 85%; + margin: 0; + border-radius: 20px; + margin: 5% 0; + padding:7% 3%; + padding-bottom: 30%; + flex-direction: column; + display: flex; + justify-content: center; + align-items: center; + } + .body .posterImg{ + width: 80%; + margin: 0; + margin-left:7vmin; + } + .body-container-2 .icon-links{ + margin-left: -8vmin; + } + .sec-1, .sec-2, .sec-3, .sec-5, .sec-4, .sec-6{ + width: 90%; + height:55vmin; + margin-bottom: 3vmin; + display: flex; + align-items: center; + justify-content: center; + } +} + + + + +/* animations */ + +img { + transition: transform .3s ease; +} + +/* img:hover { + transform: scale(1.15); +} */ + +.ctn:hover { + background: whitesmoke; + color: #fc036b; + box-shadow: 7px 9px 5px black; +} + +li a:hover { + color: #fc036b; + cursor: pointer; +} + + + + + + + + + + diff --git a/WebD/Traveler-Landing-Page/write.html b/WebD/Traveler-Landing-Page/write.html index 0a6200e..9050392 100644 --- a/WebD/Traveler-Landing-Page/write.html +++ b/WebD/Traveler-Landing-Page/write.html @@ -1,134 +1,134 @@ - - - - - - - - Write - - - -
- - -
-
- - - -
-
- - -
- -
-
- + + + + + + + + Write + + + +
+ + +
+
+ + + +
+
+ + +
+ +
+
+ \ No newline at end of file diff --git a/WebD/todo_app b/WebD/todo_app deleted file mode 160000 index 26d6756..0000000 --- a/WebD/todo_app +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 26d67565edc2a8e8c7b0de641c5bdf2925b3490b diff --git a/python/Deepminer/deepminer.py b/python/Deepminer/deepminer.py index b800c96..6c41202 100644 --- a/python/Deepminer/deepminer.py +++ b/python/Deepminer/deepminer.py @@ -1,75 +1,75 @@ -from modules.deephelpers import * -from modules.deepsqlite import * -import os -import random - -inputList = inputList() -titlePrinter() -check = rootcheck() -masterList = [] -while len(inputList) > 0: - if not os.path.exists("../output/deepminer.db"): - deepminerDB = createDB() - deepminerCon = connectDB() - tables = createTables(deepminerCon) - connectedOnions = [] - url = random.choice(inputList) - torstatus() - extensions = ('.jpg', 'jpeg', '.mp4', '.png', '.gif') - blacklist = ('http://76qugh5bey5gum7l.onion') #This is for any site that makes the program hang excessively long - if url not in masterList and not url.endswith(extensions) and not url.startswith(blacklist): - print("New iteration:") - print("Currently scanning " + url) - status = onionStatus(url) - print(status) - if status != 404: - html = onionHTML(url) - if html == "None": - inputList.remove(url) - print("Returned TraceError. Moving to next URL") - else: - res = [] - onions = onionExtractor(html,url) - atag = aTag(url,html) - allonions = onions + atag - onionResults = list(set(allonions)) - for site in onionResults: - if site not in res: - res.append(site) - newList = inputAdder(onions,inputList) - masterList.append(url) - if url in newList: - newList.remove(url) - inputList = newList - print("Found this many sites " + str(len(res))) - print(res) - url,urlDir = urlSplitter(url) - if urlDir == "": - urlDir = "/" - data = addDeepData(url,urlDir,html,deepminerCon) - for connection in res: - site,siteDir = urlSplitter(connection) - if siteDir == "": - siteDir = "/" - connections = addDeepConnections(url,urlDir,site,siteDir,deepminerCon) - else: - inputList.remove(url) - print("URL gave bad response...not scanning") - elif url in masterList: - inputList.remove(url) - print(url) - print("URL already scanned") - elif url.startswith(blacklist): - inputList.remove(url) - print(url) - print("URL in blacklist") - elif url.endswith(extensions): - inputList.remove(url) - print(url) - print("URL ends with extension not compatible") -''' -#Keeps the program running indefinitely - while True: - python = sys.executable - os.execl(python, python, *sys.argv) -''' +from modules.deephelpers import * +from modules.deepsqlite import * +import os +import random + +inputList = inputList() +titlePrinter() +check = rootcheck() +masterList = [] +while len(inputList) > 0: + if not os.path.exists("../output/deepminer.db"): + deepminerDB = createDB() + deepminerCon = connectDB() + tables = createTables(deepminerCon) + connectedOnions = [] + url = random.choice(inputList) + torstatus() + extensions = ('.jpg', 'jpeg', '.mp4', '.png', '.gif') + blacklist = ('http://76qugh5bey5gum7l.onion') #This is for any site that makes the program hang excessively long + if url not in masterList and not url.endswith(extensions) and not url.startswith(blacklist): + print("New iteration:") + print("Currently scanning " + url) + status = onionStatus(url) + print(status) + if status != 404: + html = onionHTML(url) + if html == "None": + inputList.remove(url) + print("Returned TraceError. Moving to next URL") + else: + res = [] + onions = onionExtractor(html,url) + atag = aTag(url,html) + allonions = onions + atag + onionResults = list(set(allonions)) + for site in onionResults: + if site not in res: + res.append(site) + newList = inputAdder(onions,inputList) + masterList.append(url) + if url in newList: + newList.remove(url) + inputList = newList + print("Found this many sites " + str(len(res))) + print(res) + url,urlDir = urlSplitter(url) + if urlDir == "": + urlDir = "/" + data = addDeepData(url,urlDir,html,deepminerCon) + for connection in res: + site,siteDir = urlSplitter(connection) + if siteDir == "": + siteDir = "/" + connections = addDeepConnections(url,urlDir,site,siteDir,deepminerCon) + else: + inputList.remove(url) + print("URL gave bad response...not scanning") + elif url in masterList: + inputList.remove(url) + print(url) + print("URL already scanned") + elif url.startswith(blacklist): + inputList.remove(url) + print(url) + print("URL in blacklist") + elif url.endswith(extensions): + inputList.remove(url) + print(url) + print("URL ends with extension not compatible") +''' +#Keeps the program running indefinitely + while True: + python = sys.executable + os.execl(python, python, *sys.argv) +''' diff --git a/python/Deepminer/deepsearch.py b/python/Deepminer/deepsearch.py index 2b029e3..c1c63fa 100644 --- a/python/Deepminer/deepsearch.py +++ b/python/Deepminer/deepsearch.py @@ -1,18 +1,18 @@ -from modules.deepsqlite import * -from modules.deephelpers import * - -con = connectDB() -createFTStable(con) -populateFTS(con) - -deepSearchTitle() -term = input("Enter search term: ") - -results = searchFTS(term,con) -print("Found " + str(len(results)) + " results.") - -for i in results: - string = "" - for j in i: - string += j - print(string) +from modules.deepsqlite import * +from modules.deephelpers import * + +con = connectDB() +createFTStable(con) +populateFTS(con) + +deepSearchTitle() +term = input("Enter search term: ") + +results = searchFTS(term,con) +print("Found " + str(len(results)) + " results.") + +for i in results: + string = "" + for j in i: + string += j + print(string) diff --git a/python/Deepminer/modules/deephelpers.py b/python/Deepminer/modules/deephelpers.py index 68043b3..ef01f90 100644 --- a/python/Deepminer/modules/deephelpers.py +++ b/python/Deepminer/modules/deephelpers.py @@ -1,203 +1,203 @@ -from subprocess import PIPE, run -import os, csv, re, sys, json, subprocess, socks, httplib2 -import urllib.request as request - -#https://howtodoinjava.com/python/httplib2-http-get-post-requests/ -def onionStatus(url): - try: - proxy = httplib2.ProxyInfo(proxy_type=socks.PROXY_TYPE_SOCKS5, proxy_host='localhost', proxy_port=9050) - http = httplib2.Http(proxy_info=proxy, timeout=30) - resp = http.request(url, headers={'Connection': 'close', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'})[0] - return resp.status - except: - return 404 - -#https://howtodoinjava.com/python/httplib2-http-get-post-requests/ -def onionHTML(url): - try: - proxy = httplib2.ProxyInfo(proxy_type=socks.PROXY_TYPE_SOCKS5, proxy_host='localhost', proxy_port=9050) - http = httplib2.Http(proxy_info=proxy, timeout=30) - content = http.request(url, headers={'Connection': 'close', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'})[1] - html = str(content,'utf-8').replace('\t',' ').replace('\n',' ').replace('\r',' ').replace('\"','') - return html - except: - return "None" - -def onionExtractor(html,inputUrl): - results,onions = [],[] - regex = r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.onion\/?[-a-zA-Z0-9@:%._\/+~#=]{1,256}" - inputRegex = r"\"" + inputUrl + "?[-a-zA-Z0-9@:%._\/+~#=]{1,256}" - inputMatches = re.finditer(inputRegex, html, re.MULTILINE) - matches = re.finditer(regex, html, re.MULTILINE) - for matchNum, match in enumerate(matches, start=1): - url = (match.group()) - results.append(url) - onions = list(set(results)) - for matchNum, match in enumerate(inputMatches,start=1): - url = (match.group()) - results.append(url) - onions = list(set(results)) - return onions - -def ahmia(): - results = [] - regex = r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.onion\/?[-a-zA-Z0-9@:%._\/+~#=]{1,256}" - url = "https://ahmia.fi/address/" - req = request.Request(url, data=None, headers={'Connection': 'close', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'}) - - with request.urlopen(req) as response: - source = response.read() - dataString = str(source) - matches = re.finditer(regex, dataString, re.MULTILINE) - for matchNum, match in enumerate(matches, start=1): - url = (match.group()) - results.append(url) - ahmia = list(set(results)) - return ahmia - -def redditOnions(): - results = [] - regex = r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.onion\/?[-a-zA-Z0-9@:%._\/+~#=]{1,256}" - url = "https://www.reddit.com/r/onions/new.json?limit=10000000000000000000000000000000" - req = request.Request(url, data=None, headers={'Connection': 'close', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'}) - - with request.urlopen(req) as response: - source = response.read() - data = json.loads(source) - dataString = json.dumps(data) - if "Traceback (most recent call last):" in dataString: - redditOnions() - else: - matches = re.finditer(regex, dataString, re.MULTILINE) - for matchNum, match in enumerate(matches, start=1): - url = (match.group()) - results.append(url) - reddit = list(set(results)) - return reddit - -def torstatus(): - torstatus = subprocess.getoutput("service tor status | grep Active") - torstatus = str(torstatus.split()[1]) - if torstatus == "inactive": - os.system('service tor restart') - return torstatus - -def rootcheck(): - check = subprocess.run(['whoami'],stdout=subprocess.PIPE) - check = str(check.stdout.decode("utf-8").replace('\n','').strip()) - if check != "root": - exit() - return check - -def urlSplitter(url): - if ".onion" in url: - directory = str(url.split(".onion")[1]) - url = str(url.split(".onion")[0]) + ".onion" - elif ".com" in url: - directory = str(url.split(".com")[1]) - url = str(url.split(".com")[0]) + ".com" - elif ".org" in url: - directory = str(url.split(".org")[1]) - url = str(url.split(".org")[0]) + ".org" - else: - print("Unknown URL " + str(url)) - exit() - if directory == "": - directory = "/" - if directory[0] == ":": - split = directory.split("/") - url = url+split[0] - directory = split[1] - return url,directory - - -def removeDuplicates(listOne, listTwo): - results = listOne + list(set(listTwo) - set(listOne)) - return results - -def aTag(inputURL,html): - if inputURL[-1] == "/": - inputURL= inputURL[:-1] - temp,temp2,results,onions = [],[],[],[] - regex = r'' - matches = re.finditer(regex, html, re.MULTILINE) - for matchNum, match in enumerate(matches, start=1): - url = (match.group()) - results.append(url) - onions = list(set(results)) - for i in onions: - temp.append((i.replace("",""))) - for i in temp: - if "http" in i: - if ".onion" not in i: - pass - else: - temp2.append(i) - elif "mailto:" in i: - pass - elif i.startswith("../"): - i = i.replace("../",inputURL+"/") - temp2.append(i) - elif i.startswith("/"): - temp2.append(inputURL+i) - else: - temp2.append(inputURL + "/" + i) - aTag = list(set(temp2)) - return aTag - -def inputAdder(newInput, input): - for i in input: - if i not in newInput: - newInput.append(i) - return newInput - -def inputList(): - ahmiaLinks = ahmia() - inputList = ['https://thehiddenwiki.com/','https://hiddenwiki.com','https://thehiddenwiki.org'] - reddit = redditOnions() - results = removeDuplicates(inputList,ahmiaLinks) - results = removeDuplicates(inputList,reddit) - return results - -def titlePrinter(): - os.system('clear') - - print(''' - - ██████╗ ███████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗███████╗██████╗ - ██╔══██╗██╔════╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔════╝██╔══██╗ - ██║ ██║█████╗ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║█████╗ ██████╔╝ - ██║ ██║██╔══╝ ██╔══╝ ██╔═══╝ ██║╚██╔╝██║██║██║╚██╗██║██╔══╝ ██╔══██╗ - ██████╔╝███████╗███████╗██║ ██║ ╚═╝ ██║██║██║ ╚████║███████╗██║ ██║ - ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ - ------------------------------------------------------------------------ - | Start the program with a screen session and log the results: | - | screen -S deepminer -L -Logfile output/log/deepminer.txt | - | Start deepminer | - | python3 deepminer.py | - | Disconnect from the screen session | - | Ctrl+A D to disconnect screen session | - | Program will run in the background | - | To check results view the logfile or attach to screen | - | Reattach to the screen session if checks or changes are needed | - | screen -r deepminer to reattach to the screen | - | To exit the program press Ctrl+Shift+\ | - ------------------------------------------------------------------------ - - - ''') - -def deepSearchTitle(): - os.system('clear') - print(''' - - ██████╗ ███████╗███████╗██████╗ ███████╗███████╗ █████╗ ██████╗ ██████╗██╗ ██╗ - ██╔══██╗██╔════╝██╔════╝██╔══██╗██╔════╝██╔════╝██╔══██╗██╔══██╗██╔════╝██║ ██║ - ██║ ██║█████╗ █████╗ ██████╔╝███████╗█████╗ ███████║██████╔╝██║ ███████║ - ██║ ██║██╔══╝ ██╔══╝ ██╔═══╝ ╚════██║██╔══╝ ██╔══██║██╔══██╗██║ ██╔══██║ - ██████╔╝███████╗███████╗██║ ███████║███████╗██║ ██║██║ ██║╚██████╗██║ ██║ - ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ - - This tool uses FTS5 SQLite search queries. - For a full list of input syntax, please see https://www.sqlite.org/fts5.html - ''') +from subprocess import PIPE, run +import os, csv, re, sys, json, subprocess, socks, httplib2 +import urllib.request as request + +#https://howtodoinjava.com/python/httplib2-http-get-post-requests/ +def onionStatus(url): + try: + proxy = httplib2.ProxyInfo(proxy_type=socks.PROXY_TYPE_SOCKS5, proxy_host='localhost', proxy_port=9050) + http = httplib2.Http(proxy_info=proxy, timeout=30) + resp = http.request(url, headers={'Connection': 'close', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'})[0] + return resp.status + except: + return 404 + +#https://howtodoinjava.com/python/httplib2-http-get-post-requests/ +def onionHTML(url): + try: + proxy = httplib2.ProxyInfo(proxy_type=socks.PROXY_TYPE_SOCKS5, proxy_host='localhost', proxy_port=9050) + http = httplib2.Http(proxy_info=proxy, timeout=30) + content = http.request(url, headers={'Connection': 'close', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'})[1] + html = str(content,'utf-8').replace('\t',' ').replace('\n',' ').replace('\r',' ').replace('\"','') + return html + except: + return "None" + +def onionExtractor(html,inputUrl): + results,onions = [],[] + regex = r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.onion\/?[-a-zA-Z0-9@:%._\/+~#=]{1,256}" + inputRegex = r"\"" + inputUrl + "?[-a-zA-Z0-9@:%._\/+~#=]{1,256}" + inputMatches = re.finditer(inputRegex, html, re.MULTILINE) + matches = re.finditer(regex, html, re.MULTILINE) + for matchNum, match in enumerate(matches, start=1): + url = (match.group()) + results.append(url) + onions = list(set(results)) + for matchNum, match in enumerate(inputMatches,start=1): + url = (match.group()) + results.append(url) + onions = list(set(results)) + return onions + +def ahmia(): + results = [] + regex = r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.onion\/?[-a-zA-Z0-9@:%._\/+~#=]{1,256}" + url = "https://ahmia.fi/address/" + req = request.Request(url, data=None, headers={'Connection': 'close', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'}) + + with request.urlopen(req) as response: + source = response.read() + dataString = str(source) + matches = re.finditer(regex, dataString, re.MULTILINE) + for matchNum, match in enumerate(matches, start=1): + url = (match.group()) + results.append(url) + ahmia = list(set(results)) + return ahmia + +def redditOnions(): + results = [] + regex = r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.onion\/?[-a-zA-Z0-9@:%._\/+~#=]{1,256}" + url = "https://www.reddit.com/r/onions/new.json?limit=10000000000000000000000000000000" + req = request.Request(url, data=None, headers={'Connection': 'close', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'}) + + with request.urlopen(req) as response: + source = response.read() + data = json.loads(source) + dataString = json.dumps(data) + if "Traceback (most recent call last):" in dataString: + redditOnions() + else: + matches = re.finditer(regex, dataString, re.MULTILINE) + for matchNum, match in enumerate(matches, start=1): + url = (match.group()) + results.append(url) + reddit = list(set(results)) + return reddit + +def torstatus(): + torstatus = subprocess.getoutput("service tor status | grep Active") + torstatus = str(torstatus.split()[1]) + if torstatus == "inactive": + os.system('service tor restart') + return torstatus + +def rootcheck(): + check = subprocess.run(['whoami'],stdout=subprocess.PIPE) + check = str(check.stdout.decode("utf-8").replace('\n','').strip()) + if check != "root": + exit() + return check + +def urlSplitter(url): + if ".onion" in url: + directory = str(url.split(".onion")[1]) + url = str(url.split(".onion")[0]) + ".onion" + elif ".com" in url: + directory = str(url.split(".com")[1]) + url = str(url.split(".com")[0]) + ".com" + elif ".org" in url: + directory = str(url.split(".org")[1]) + url = str(url.split(".org")[0]) + ".org" + else: + print("Unknown URL " + str(url)) + exit() + if directory == "": + directory = "/" + if directory[0] == ":": + split = directory.split("/") + url = url+split[0] + directory = split[1] + return url,directory + + +def removeDuplicates(listOne, listTwo): + results = listOne + list(set(listTwo) - set(listOne)) + return results + +def aTag(inputURL,html): + if inputURL[-1] == "/": + inputURL= inputURL[:-1] + temp,temp2,results,onions = [],[],[],[] + regex = r'' + matches = re.finditer(regex, html, re.MULTILINE) + for matchNum, match in enumerate(matches, start=1): + url = (match.group()) + results.append(url) + onions = list(set(results)) + for i in onions: + temp.append((i.replace("",""))) + for i in temp: + if "http" in i: + if ".onion" not in i: + pass + else: + temp2.append(i) + elif "mailto:" in i: + pass + elif i.startswith("../"): + i = i.replace("../",inputURL+"/") + temp2.append(i) + elif i.startswith("/"): + temp2.append(inputURL+i) + else: + temp2.append(inputURL + "/" + i) + aTag = list(set(temp2)) + return aTag + +def inputAdder(newInput, input): + for i in input: + if i not in newInput: + newInput.append(i) + return newInput + +def inputList(): + ahmiaLinks = ahmia() + inputList = ['https://thehiddenwiki.com/','https://hiddenwiki.com','https://thehiddenwiki.org'] + reddit = redditOnions() + results = removeDuplicates(inputList,ahmiaLinks) + results = removeDuplicates(inputList,reddit) + return results + +def titlePrinter(): + os.system('clear') + + print(''' + + ██████╗ ███████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗███████╗██████╗ + ██╔══██╗██╔════╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔════╝██╔══██╗ + ██║ ██║█████╗ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║█████╗ ██████╔╝ + ██║ ██║██╔══╝ ██╔══╝ ██╔═══╝ ██║╚██╔╝██║██║██║╚██╗██║██╔══╝ ██╔══██╗ + ██████╔╝███████╗███████╗██║ ██║ ╚═╝ ██║██║██║ ╚████║███████╗██║ ██║ + ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ + ------------------------------------------------------------------------ + | Start the program with a screen session and log the results: | + | screen -S deepminer -L -Logfile output/log/deepminer.txt | + | Start deepminer | + | python3 deepminer.py | + | Disconnect from the screen session | + | Ctrl+A D to disconnect screen session | + | Program will run in the background | + | To check results view the logfile or attach to screen | + | Reattach to the screen session if checks or changes are needed | + | screen -r deepminer to reattach to the screen | + | To exit the program press Ctrl+Shift+\ | + ------------------------------------------------------------------------ + + + ''') + +def deepSearchTitle(): + os.system('clear') + print(''' + + ██████╗ ███████╗███████╗██████╗ ███████╗███████╗ █████╗ ██████╗ ██████╗██╗ ██╗ + ██╔══██╗██╔════╝██╔════╝██╔══██╗██╔════╝██╔════╝██╔══██╗██╔══██╗██╔════╝██║ ██║ + ██║ ██║█████╗ █████╗ ██████╔╝███████╗█████╗ ███████║██████╔╝██║ ███████║ + ██║ ██║██╔══╝ ██╔══╝ ██╔═══╝ ╚════██║██╔══╝ ██╔══██║██╔══██╗██║ ██╔══██║ + ██████╔╝███████╗███████╗██║ ███████║███████╗██║ ██║██║ ██║╚██████╗██║ ██║ + ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ + + This tool uses FTS5 SQLite search queries. + For a full list of input syntax, please see https://www.sqlite.org/fts5.html + ''') diff --git a/python/Deepminer/modules/deepsqlite.py b/python/Deepminer/modules/deepsqlite.py index 0f74220..fc35525 100644 --- a/python/Deepminer/modules/deepsqlite.py +++ b/python/Deepminer/modules/deepsqlite.py @@ -1,87 +1,87 @@ -import os -import sqlite3 - -def createDB(): - con = sqlite3.connect('output/deepminer.db') - return con - -def connectDB(): - con = sqlite3.connect('output/deepminer.db', timeout=30) - return con - -def createTables(con): - cur = con.cursor() - deepdata = """ - CREATE TABLE IF NOT EXISTS "Deepdata" ( - "URL" TEXT, - "Directory" TEXT, - "HTML" TEXT, - PRIMARY KEY('URL', 'Directory') - );""" - cur.execute(deepdata) - - deepconnections = """ - CREATE TABLE IF NOT EXISTS "Deepconnections" ( - "URL" TEXT, - "URLDIR" TEXT, - "SITE" TEXT, - "SITEDIR" TEXT, - PRIMARY KEY("URL","SITE","URLDIR","SITEDIR") - ); - """ - cur.execute(deepconnections) - -def addDeepData(url,directory,html,con): - cur = con.cursor() - addData = "INSERT OR REPLACE INTO Deepdata (URL, Directory, HTML) VALUES (?, ?, ?)" - cur.execute(addData,(url, directory, html)) - con.commit() - -def addDeepConnections(url, urlDir, site, siteDir,con): - cur = con.cursor() - addConnections = "INSERT OR REPLACE INTO Deepconnections (URL, URLDIR, SITE,SITEDIR) VALUES (?, ?, ?, ?)" - cur.execute(addConnections,(url,urlDir,site,siteDir)) - con.commit() - -def queryTables(con): - cur = con.cursor() - cur.execute("SELECT URL, Directory, HTML FROM Deepdata") - results = cur.fetchall() - for row in results: - print(row) - - cur.execute("SELECT URL,URLDIR,SITE,SITEDIR FROM Deepconnections") - results = cur.fetchall() - for row in results: - print(row) - -def commitDB(con): - try: - con.commit() - except: - con.rollback() - raise RuntimeError("Error occurred. Rolling back database.") - -def searchDB(term,con): - cur = con.cursor() - query = "SELECT URL,Directory FROM Deepdata WHERE HTML LIKE \'%" + term + "%\' ORDER BY URL;" - cur.execute(query) - results = cur.fetchall() - return results - -def createFTStable(con): - cur = con.cursor() - query = "CREATE VIRTUAL TABLE IF NOT EXISTS Deepsearch USING fts5(URL, Directory, HTML);" - cur.execute(query) - -def populateFTS(con): - cur = con.cursor() - query = "INSERT INTO Deepsearch SELECT URL, Directory, HTML FROM Deepdata;" - cur.execute(query) - -def searchFTS(term,con): - cur = con.cursor() - query = "SELECT URL,Directory FROM Deepsearch WHERE HTML MATCH \'" + term + "\' ORDER BY rank;" - cur.execute(query) - results = cur.fetchall() - return results +import os +import sqlite3 + +def createDB(): + con = sqlite3.connect('output/deepminer.db') + return con + +def connectDB(): + con = sqlite3.connect('output/deepminer.db', timeout=30) + return con + +def createTables(con): + cur = con.cursor() + deepdata = """ + CREATE TABLE IF NOT EXISTS "Deepdata" ( + "URL" TEXT, + "Directory" TEXT, + "HTML" TEXT, + PRIMARY KEY('URL', 'Directory') + );""" + cur.execute(deepdata) + + deepconnections = """ + CREATE TABLE IF NOT EXISTS "Deepconnections" ( + "URL" TEXT, + "URLDIR" TEXT, + "SITE" TEXT, + "SITEDIR" TEXT, + PRIMARY KEY("URL","SITE","URLDIR","SITEDIR") + ); + """ + cur.execute(deepconnections) + +def addDeepData(url,directory,html,con): + cur = con.cursor() + addData = "INSERT OR REPLACE INTO Deepdata (URL, Directory, HTML) VALUES (?, ?, ?)" + cur.execute(addData,(url, directory, html)) + con.commit() + +def addDeepConnections(url, urlDir, site, siteDir,con): + cur = con.cursor() + addConnections = "INSERT OR REPLACE INTO Deepconnections (URL, URLDIR, SITE,SITEDIR) VALUES (?, ?, ?, ?)" + cur.execute(addConnections,(url,urlDir,site,siteDir)) + con.commit() + +def queryTables(con): + cur = con.cursor() + cur.execute("SELECT URL, Directory, HTML FROM Deepdata") + results = cur.fetchall() + for row in results: + print(row) + + cur.execute("SELECT URL,URLDIR,SITE,SITEDIR FROM Deepconnections") + results = cur.fetchall() + for row in results: + print(row) + +def commitDB(con): + try: + con.commit() + except: + con.rollback() + raise RuntimeError("Error occurred. Rolling back database.") + +def searchDB(term,con): + cur = con.cursor() + query = "SELECT URL,Directory FROM Deepdata WHERE HTML LIKE \'%" + term + "%\' ORDER BY URL;" + cur.execute(query) + results = cur.fetchall() + return results + +def createFTStable(con): + cur = con.cursor() + query = "CREATE VIRTUAL TABLE IF NOT EXISTS Deepsearch USING fts5(URL, Directory, HTML);" + cur.execute(query) + +def populateFTS(con): + cur = con.cursor() + query = "INSERT INTO Deepsearch SELECT URL, Directory, HTML FROM Deepdata;" + cur.execute(query) + +def searchFTS(term,con): + cur = con.cursor() + query = "SELECT URL,Directory FROM Deepsearch WHERE HTML MATCH \'" + term + "\' ORDER BY rank;" + cur.execute(query) + results = cur.fetchall() + return results diff --git a/python/Deepminer/output/log/deepminer.txt b/python/Deepminer/output/log/deepminer.txt index 00880d5..029f9b5 100644 --- a/python/Deepminer/output/log/deepminer.txt +++ b/python/Deepminer/output/log/deepminer.txt @@ -1,46 +1,46 @@ -Example log file - -root@deepminer:/opt/deepminer# root@deepminer:/opt/deepminer# python3 deepminer.py - - - ██████╗ ███████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗███████╗██████╗ - ██╔══██╗██╔════╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔════╝██╔══██╗ - ██║ ██║█████╗ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║█████╗ ██████╔╝ - ██║ ██║██╔══╝ ██╔══╝ ██╔═══╝ ██║╚██╔╝██║██║██║╚██╗██║██╔══╝ ██╔══██╗ - ██████╔╝███████╗███████╗██║ ██║ ╚═╝ ██║██║██║ ╚████║███████╗██║ ██║ - ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ - ------------------------------------------------------------------------ - | Start the program with a screen session and log the results: | - | screen -S deepminer -L -Logfile output/log/deepminer.txt | - | Start deepminer | - | python3 deepminer.py | - | Disconnect from the screen session | - | Ctrl+A D to disconnect screen session | - | Program will run in the background | - | To check results view the logfile or attach to screen | - | Reattach to the screen session if checks or changes are needed | - | screen -r deepmine to reattach to the screen | - | To exit the program press Ctrl+Shift+\ | - ------------------------------------------------------------------------ - - - -New iteration: -Currently scanning http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/index.php -200 -Found this many sites 33 -['http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Watch-Series-5-GPS-40mm---Gold-Aluminum-Case-with-Pink-Sport-Band-MWV72LLA-8617-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Watch-Series-5-GPS-44mm---Space-Gray-Aluminum-Case-with-Black-Sport-Band-MWVF2LLA-4550-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-iPad-Pro-11-inch-Wi-Fi-256GB---Silver2nd-Generation-MXDD2LLA-4810-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/logoblue.PNG', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/New-Apple-MacBook-Pro-13-inch-16GB-RAM-1TB-SSD-Storage-Magic-Keyboard---Space-Gray-MWP52LLA-9873-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Mac-Pro-Desktop-Computer-35GHz-8-Core-Intel-Xeon-W-32GB-Memory-256GB-SSD-Radeon-Pro-580X-8GB-M-MacPro', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-iPad-Pro-11-inch-Wi-Fi-256GB---Silver2nd-Generation-MXDD2LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/about_us', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/index.php', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/iphone11pro', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Mac-Pro-Desktop-Computer-35GHz-8-Core-Intel-Xeon-W-32GB-Memory-256GB-SSD-Radeon-Pro-580X-8GB-M-MacPro-4692-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/apples', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/NEW-APPLE-IPHONE-11-PRO-64GB-256GB-512GB-GRAY-GREEN-GOLD-SILVER-FACTORY-UNLOCKED-AppleiPhone11Pro-2478-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-iPad-Pro-129-inch-Wi-Fi-256GB---Silver-4th-Generation-MXAU2LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-iPad-Pro-129-inch-Wi-Fi-256GB---Silver-4th-Generation-MXAU2LLA-8388-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Watch-Series-5-GPS-44mm---Space-Gray-Aluminum-Case-with-Black-Sport-Band-MWVF2LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/New-Apple-MacBook-Pro-13-inch-16GB-RAM-1TB-SSD-Storage-Magic-Keyboard---Space-Gray-MWP52LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/websitelogoe-Recoveredf.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-8283-190x190.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/Bitcoin-Accepted-4x1.5-2.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-MacBook-Air-13-inch-8GB-RAM-512GB-SSD-Storage---Gold-Latest-Model-MVH52LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-MacBook-Air-13-inch-8GB-RAM-512GB-SSD-Storage---Gold-Latest-Model-MVH52LLA-3270-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Watch-Series-5-GPSCellular-44mm---Space-Gray-Aluminum-Case-with-Black-Sport-Band-MWW12LLA-1062-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple---iPhone-11-256GB---White-Unlocked-AppleiPhone11-596-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Watch-Series-5-GPS-40mm---Gold-Aluminum-Case-with-Pink-Sport-Band-MWV72LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-16quot-MacBook-Pro-with-Touch-Bar-9th-Gen-8-Core-Intel-i9-24GHz-64GB-RAM-2TB-SSD-AMD-Radeon-Pr-B083745LCX-2857-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Watch-Series-5-GPSCellular-44mm---Space-Gray-Aluminum-Case-with-Black-Sport-Band-MWW12LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/New-Apple-iMac-215-inch-8GB-RAM-1TB-Storage-MRT32LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-16quot-MacBook-Pro-with-Touch-Bar-9th-Gen-8-Core-Intel-i9-24GHz-64GB-RAM-2TB-SSD-AMD-Radeon-Pr-B083745LCX', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/New-Apple-iMac-215-inch-8GB-RAM-1TB-Storage-MRT32LLA-1662-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/iphone11'] -^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[Ahttp://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion -http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-8283-190x190.png -URL ends with extension not compatible -http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-iPad-Pro-11-inch-Wi-Fi-256GB---Silver2nd-Generation-MXDD2LLA-4810-190x190.jpeg -URL ends with extension not compatible -New iteration: -Currently scanning http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/logoblue.PNG -200 -Returned TraceError. Moving to next URL -New iteration: -Currently scanning http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701 -200 -Found this many sites 18 -['http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-1-500x500.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/about_us', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/logoblue.PNG', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/apples', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-2-308x308.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-2-500x500.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/index.php', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-0-500x500.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-0-308x308.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/Bitcoin-Accepted-4x1.5-2.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-8283-308x308.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-1-308x308.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/websitelogoe-Recoveredf.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701/#tab-review', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701/#tab-description', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-8283-500x500.png'] +Example log file + +root@deepminer:/opt/deepminer# root@deepminer:/opt/deepminer# python3 deepminer.py + + + ██████╗ ███████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗███████╗██████╗ + ██╔══██╗██╔════╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔════╝██╔══██╗ + ██║ ██║█████╗ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║█████╗ ██████╔╝ + ██║ ██║██╔══╝ ██╔══╝ ██╔═══╝ ██║╚██╔╝██║██║██║╚██╗██║██╔══╝ ██╔══██╗ + ██████╔╝███████╗███████╗██║ ██║ ╚═╝ ██║██║██║ ╚████║███████╗██║ ██║ + ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ + ------------------------------------------------------------------------ + | Start the program with a screen session and log the results: | + | screen -S deepminer -L -Logfile output/log/deepminer.txt | + | Start deepminer | + | python3 deepminer.py | + | Disconnect from the screen session | + | Ctrl+A D to disconnect screen session | + | Program will run in the background | + | To check results view the logfile or attach to screen | + | Reattach to the screen session if checks or changes are needed | + | screen -r deepmine to reattach to the screen | + | To exit the program press Ctrl+Shift+\ | + ------------------------------------------------------------------------ + + + +New iteration: +Currently scanning http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/index.php +200 +Found this many sites 33 +['http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Watch-Series-5-GPS-40mm---Gold-Aluminum-Case-with-Pink-Sport-Band-MWV72LLA-8617-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Watch-Series-5-GPS-44mm---Space-Gray-Aluminum-Case-with-Black-Sport-Band-MWVF2LLA-4550-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-iPad-Pro-11-inch-Wi-Fi-256GB---Silver2nd-Generation-MXDD2LLA-4810-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/logoblue.PNG', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/New-Apple-MacBook-Pro-13-inch-16GB-RAM-1TB-SSD-Storage-Magic-Keyboard---Space-Gray-MWP52LLA-9873-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Mac-Pro-Desktop-Computer-35GHz-8-Core-Intel-Xeon-W-32GB-Memory-256GB-SSD-Radeon-Pro-580X-8GB-M-MacPro', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-iPad-Pro-11-inch-Wi-Fi-256GB---Silver2nd-Generation-MXDD2LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/about_us', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/index.php', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/iphone11pro', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Mac-Pro-Desktop-Computer-35GHz-8-Core-Intel-Xeon-W-32GB-Memory-256GB-SSD-Radeon-Pro-580X-8GB-M-MacPro-4692-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/apples', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/NEW-APPLE-IPHONE-11-PRO-64GB-256GB-512GB-GRAY-GREEN-GOLD-SILVER-FACTORY-UNLOCKED-AppleiPhone11Pro-2478-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-iPad-Pro-129-inch-Wi-Fi-256GB---Silver-4th-Generation-MXAU2LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-iPad-Pro-129-inch-Wi-Fi-256GB---Silver-4th-Generation-MXAU2LLA-8388-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Watch-Series-5-GPS-44mm---Space-Gray-Aluminum-Case-with-Black-Sport-Band-MWVF2LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/New-Apple-MacBook-Pro-13-inch-16GB-RAM-1TB-SSD-Storage-Magic-Keyboard---Space-Gray-MWP52LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/websitelogoe-Recoveredf.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-8283-190x190.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/Bitcoin-Accepted-4x1.5-2.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-MacBook-Air-13-inch-8GB-RAM-512GB-SSD-Storage---Gold-Latest-Model-MVH52LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-MacBook-Air-13-inch-8GB-RAM-512GB-SSD-Storage---Gold-Latest-Model-MVH52LLA-3270-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Watch-Series-5-GPSCellular-44mm---Space-Gray-Aluminum-Case-with-Black-Sport-Band-MWW12LLA-1062-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple---iPhone-11-256GB---White-Unlocked-AppleiPhone11-596-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Watch-Series-5-GPS-40mm---Gold-Aluminum-Case-with-Pink-Sport-Band-MWV72LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-16quot-MacBook-Pro-with-Touch-Bar-9th-Gen-8-Core-Intel-i9-24GHz-64GB-RAM-2TB-SSD-AMD-Radeon-Pr-B083745LCX-2857-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Watch-Series-5-GPSCellular-44mm---Space-Gray-Aluminum-Case-with-Black-Sport-Band-MWW12LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/New-Apple-iMac-215-inch-8GB-RAM-1TB-Storage-MRT32LLA', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-16quot-MacBook-Pro-with-Touch-Bar-9th-Gen-8-Core-Intel-i9-24GHz-64GB-RAM-2TB-SSD-AMD-Radeon-Pr-B083745LCX', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/New-Apple-iMac-215-inch-8GB-RAM-1TB-Storage-MRT32LLA-1662-190x190.jpeg', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/iphone11'] +^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[Ahttp://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion +http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-8283-190x190.png +URL ends with extension not compatible +http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-iPad-Pro-11-inch-Wi-Fi-256GB---Silver2nd-Generation-MXDD2LLA-4810-190x190.jpeg +URL ends with extension not compatible +New iteration: +Currently scanning http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/logoblue.PNG +200 +Returned TraceError. Moving to next URL +New iteration: +Currently scanning http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701 +200 +Found this many sites 18 +['http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-1-500x500.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/about_us', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/logoblue.PNG', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/apples', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-2-308x308.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-2-500x500.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/index.php', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-0-500x500.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-0-308x308.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/Bitcoin-Accepted-4x1.5-2.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-8283-308x308.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-1-308x308.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/data/websitelogoe-Recoveredf.png', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701/#tab-review', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701/#tab-description', 'http://ghxnewdtctepl2zjabpn7j5wtshmuegrpoqu5usnofktgmbcz6byceid.onion/image/cache/data/Apple-Macbook-Pro-13quot-Intel-Core-i5-16GB-512GB-SSD-Space-Gray-MWP42LLA-143639255701-8283-500x500.png'] diff --git a/python/Library Management Sysytem/borrowed.txt b/python/Library Management Sysytem/borrowed.txt new file mode 100644 index 0000000..c12bff4 --- /dev/null +++ b/python/Library Management Sysytem/borrowed.txt @@ -0,0 +1 @@ +Alice,Harry Potter,J.K. Rowling diff --git a/python/Library Management Sysytem/data.txt b/python/Library Management Sysytem/data.txt new file mode 100644 index 0000000..98b08dd --- /dev/null +++ b/python/Library Management Sysytem/data.txt @@ -0,0 +1,4 @@ +The Alchemist,Paulo Coelho,False +Harry Potter,J.K. Rowling,False +Rich Dad Poor Dad,Robert Kiyosaki,False +To Kill a Mockingbird,Harper Lee,False diff --git a/python/Library Management Sysytem/library.py b/python/Library Management Sysytem/library.py new file mode 100644 index 0000000..9091d41 --- /dev/null +++ b/python/Library Management Sysytem/library.py @@ -0,0 +1,133 @@ +import os + +class Book: + def __init__(self, title, author): + self.title = title + self.author = author + self.is_borrowed = False + + def __str__(self): + return f"{self.title} by {self.author}" + +class User: + def __init__(self, name): + self.name = name + self.borrowed_books = [] + + def borrow_book(self, library, title): + book = library.get_book_by_title(title) + if book and not book.is_borrowed: + book.is_borrowed = True + self.borrowed_books.append(book) + library.record_borrowed_book(self.name, book) + print(f"You have successfully borrowed '{book.title}'") + else: + print(f"Sorry, '{title}' is not available.") + + def return_book(self, library, title): + for book in self.borrowed_books: + if book.title == title: + book.is_borrowed = False + self.borrowed_books.remove(book) + library.update_returned_book(self.name, book) + print(f"You have returned '{book.title}'") + return + print(f"You don't have '{title}' to return.") + +class Library: + def __init__(self, book_file, borrowed_file): + self.books = [] + self.book_file = book_file + self.borrowed_file = borrowed_file + self.load_books() + + def load_books(self): + if os.path.exists(self.book_file): + with open(self.book_file, 'r') as f: + for line in f: + title, author, is_borrowed = line.strip().split(',') + book = Book(title, author) + book.is_borrowed = True if is_borrowed == 'True' else False + self.books.append(book) + + def save_books(self): + with open(self.book_file, 'w') as f: + for book in self.books: + f.write(f"{book.title},{book.author},{book.is_borrowed}\n") + + def display_books(self): + print("\nAvailable Books:") + available_books = [book for book in self.books if not book.is_borrowed] + if not available_books: + print("No books available.") + for book in available_books: + print(book) + + def get_book_by_title(self, title): + for book in self.books: + if book.title.lower() == title.lower(): + return book + return None + + def add_book(self, title, author): + book = Book(title, author) + self.books.append(book) + self.save_books() + print(f"'{title}' by {author} has been added to the library.") + + def record_borrowed_book(self, user_name, book): + with open(self.borrowed_file, 'a') as f: + f.write(f"{user_name},{book.title},{book.author}\n") + + def update_returned_book(self, user_name, book): + with open(self.borrowed_file, 'r') as f: + lines = f.readlines() + + with open(self.borrowed_file, 'w') as f: + for line in lines: + if not (user_name in line and book.title in line): + f.write(line) + +def main(): + library = Library('data.txt', 'borrowed.txt') + + while True: + print("\n--- Library Menu ---") + print("1. View Available Books") + print("2. Borrow a Book") + print("3. Return a Book") + print("4. Donate a Book") + print("5. Exit") + + choice = input("Enter your choice: ") + + if choice == '1': + library.display_books() + + elif choice == '2': + user_name = input("Enter your name: ") + user = User(user_name) + title = input("Enter the book title you want to borrow: ") + user.borrow_book(library, title) + + elif choice == '3': + user_name = input("Enter your name: ") + user = User(user_name) + title = input("Enter the book title you want to return: ") + user.return_book(library, title) + + elif choice == '4': + title = input("Enter the book title you want to donate: ") + author = input("Enter the book's author: ") + library.add_book(title, author) + + elif choice == '5': + print("Goodbye!") + library.save_books() + break + + else: + print("Invalid choice. Please try again.") + +if __name__ == "__main__": + main() diff --git a/python/Weather_Forecast.py b/python/Weather_Forecast.py index 3ce6e3b..01089e5 100644 --- a/python/Weather_Forecast.py +++ b/python/Weather_Forecast.py @@ -1,52 +1,52 @@ -import requests -import json -import tkinter as tk -from tkinter import Entry, Label, Button - -# Replace 'YOUR_API_KEY' with your actual OpenWeatherMap API key -api_key = 'YOUR_API_KEY' -base_url = 'http://api.openweathermap.org/data/2.5/weather?' - -def get_weather(city_name): - complete_url = base_url + 'q=' + city_name + '&appid=' + api_key - response = requests.get(complete_url) - data = response.json() - - if data["cod"] != "404": - main_data = data["main"] - temperature = main_data["temp"] - pressure = main_data["pressure"] - humidity = main_data["humidity"] - - weather_data = data["weather"] - weather_description = weather_data[0]["description"] - - result_label.config(text=f"Weather in {city_name}:\nTemperature: {temperature} K\nPressure: {pressure} hPa\nHumidity: {humidity}%\nDescription: {weather_description}") - else: - result_label.config(text="City not found") - -def get_weather_from_input(): - city = city_entry.get() - get_weather(city) - -# Create the main window -root = tk.Tk() -root.geometry("500x200") - -root.title("Weather Forecast App") - -# Create and configure widgets -city_label = Label(root, text="Enter city name:") -city_label.pack() - -city_entry = Entry(root) -city_entry.pack() - -search_button = Button(root, text="Search", command=get_weather_from_input) -search_button.pack() - -result_label = Label(root, text="") -result_label.pack() - -# Start the GUI event loop -root.mainloop() +import requests +import json +import tkinter as tk +from tkinter import Entry, Label, Button + +# Replace 'YOUR_API_KEY' with your actual OpenWeatherMap API key +api_key = 'YOUR_API_KEY' +base_url = 'http://api.openweathermap.org/data/2.5/weather?' + +def get_weather(city_name): + complete_url = base_url + 'q=' + city_name + '&appid=' + api_key + response = requests.get(complete_url) + data = response.json() + + if data["cod"] != "404": + main_data = data["main"] + temperature = main_data["temp"] + pressure = main_data["pressure"] + humidity = main_data["humidity"] + + weather_data = data["weather"] + weather_description = weather_data[0]["description"] + + result_label.config(text=f"Weather in {city_name}:\nTemperature: {temperature} K\nPressure: {pressure} hPa\nHumidity: {humidity}%\nDescription: {weather_description}") + else: + result_label.config(text="City not found") + +def get_weather_from_input(): + city = city_entry.get() + get_weather(city) + +# Create the main window +root = tk.Tk() +root.geometry("500x200") + +root.title("Weather Forecast App") + +# Create and configure widgets +city_label = Label(root, text="Enter city name:") +city_label.pack() + +city_entry = Entry(root) +city_entry.pack() + +search_button = Button(root, text="Search", command=get_weather_from_input) +search_button.pack() + +result_label = Label(root, text="") +result_label.pack() + +# Start the GUI event loop +root.mainloop() diff --git a/python/rock_paper_scissors.py b/python/rock_paper_scissors.py index 13b4e17..1f1900b 100644 --- a/python/rock_paper_scissors.py +++ b/python/rock_paper_scissors.py @@ -1,88 +1,88 @@ -import random - -print("WELCOME TO THE GAME OF STONE, PAPER, SCISSORS!!") - -round = int(input("How many rounds you would like to play? ")) -user_point = 0 -comp_point = 0 - -rock = ''' - _______ ----' ____) - (_____) - (_____) - (____) ----.__(___) -''' - -paper = ''' - _______ ----' ____)____ - ______) - _______) - _______) ----.__________) -''' - -scissors = ''' - _______ ----' ____)____ - ______) - __________) - (____) ----.__(___) -''' - -images = [rock,paper,scissors] - -for i in range(round): - - user_choice = int(input("""What is your play? - Type 0 for Rock - Type 1 for Paper - Type 2 for Scissors\n""")) - - if user_choice >= 3 or user_choice < 0: - print("You should either choose Rock, Paper or Scissor") - else: - print(images[user_choice]) - - computer_choice = random.randint(0, 2) - print("Computer chose:") - print(images[computer_choice]) - - if user_choice == 0 and computer_choice == 2: - print("Yes! You WON") - user_point+=1 - - elif computer_choice == 0 and user_choice == 2: - print("Oh No! You LOSE") - comp_point+=1 - - elif computer_choice > user_choice: - print("Oh No! You LOSE") - comp_point+=1 - - elif user_choice > computer_choice: - print("Yes! You WON") - user_point+=1 - - elif computer_choice == user_choice: - print("Toit! It's a DRAW") -print("-----------------------------------------------") -print() - -if user_point > comp_point: - print("CONGRATULATIONS!! YOU WON THE GAME ") - -elif comp_point > user_point: - print("SORRY, YOU LOST THE GAME") - -elif user_point == comp_point: - print("GOOD GAME! ITS A DRAW") - - - - - - +import random + +print("WELCOME TO THE GAME OF STONE, PAPER, SCISSORS!!") + +round = int(input("How many rounds you would like to play? ")) +user_point = 0 +comp_point = 0 + +rock = ''' + _______ +---' ____) + (_____) + (_____) + (____) +---.__(___) +''' + +paper = ''' + _______ +---' ____)____ + ______) + _______) + _______) +---.__________) +''' + +scissors = ''' + _______ +---' ____)____ + ______) + __________) + (____) +---.__(___) +''' + +images = [rock,paper,scissors] + +for i in range(round): + + user_choice = int(input("""What is your play? + Type 0 for Rock + Type 1 for Paper + Type 2 for Scissors\n""")) + + if user_choice >= 3 or user_choice < 0: + print("You should either choose Rock, Paper or Scissor") + else: + print(images[user_choice]) + + computer_choice = random.randint(0, 2) + print("Computer chose:") + print(images[computer_choice]) + + if user_choice == 0 and computer_choice == 2: + print("Yes! You WON") + user_point+=1 + + elif computer_choice == 0 and user_choice == 2: + print("Oh No! You LOSE") + comp_point+=1 + + elif computer_choice > user_choice: + print("Oh No! You LOSE") + comp_point+=1 + + elif user_choice > computer_choice: + print("Yes! You WON") + user_point+=1 + + elif computer_choice == user_choice: + print("Toit! It's a DRAW") +print("-----------------------------------------------") +print() + +if user_point > comp_point: + print("CONGRATULATIONS!! YOU WON THE GAME ") + +elif comp_point > user_point: + print("SORRY, YOU LOST THE GAME") + +elif user_point == comp_point: + print("GOOD GAME! ITS A DRAW") + + + + + + diff --git a/python/snake_game.py b/python/snake_game.py index 4e85879..83f9782 100644 --- a/python/snake_game.py +++ b/python/snake_game.py @@ -1,96 +1,96 @@ -import pygame -import time -import random -snake_speed = 20 -window_x = 720 -window_y = 480 -black = pygame.Color(0, 0, 0) -white = pygame.Color(255, 255, 255) -red = pygame.Color(255, 0, 0) -green = pygame.Color(0, 255, 0) -blue = pygame.Color(0, 0, 255) -golden_brown = pygame.Color(150, 105, 25) -pygame.init() -pygame.display.set_caption('snakes') -game_window = pygame.display.set_mode((window_x, window_y)) -fps = pygame.time.Clock() -snake_position = [100, 50] -snake_body = [ [100, 50], - [90, 50], - [80, 50], - [70, 50] - ] -fruit_position = [random.randrange(1, (window_x//10)) * 10, - random.randrange(1, (window_y//10)) * 10] -fruit_spawn = True -direction = 'RIGHT' -change_to = direction -score = 0 -def show_score(choice, color, font, size): - score_font = pygame.font.SysFont(font, size) - score_surface = score_font.render('Score : ' + str(score), True, color) - score_rect = score_surface.get_rect() - game_window.blit(score_surface, score_rect) -def game_over(): - my_font = pygame.font.SysFont('times new roman', 50) - game_over_surface = my_font.render('Your Score is : ' + str(score), True, red) - game_over_rect = game_over_surface.get_rect() - game_over_rect.midtop = (window_x/2, window_y/4) - game_window.blit(game_over_surface, game_over_rect) - pygame.display.flip() - time.sleep(2) - pygame.quit() - quit() -while True: - for event in pygame.event.get(): - if event.type == pygame.KEYDOWN: - if event.key == pygame.K_UP: - change_to = 'UP' - if event.key == pygame.K_DOWN: - change_to = 'DOWN' - if event.key == pygame.K_LEFT: - change_to = 'LEFT' - if event.key == pygame.K_RIGHT: - change_to = 'RIGHT' - if change_to == 'UP' and direction != 'DOWN': - direction = 'UP' - if change_to == 'DOWN' and direction != 'UP': - direction = 'DOWN' - if change_to == 'LEFT' and direction != 'RIGHT': - direction = 'LEFT' - if change_to == 'RIGHT' and direction != 'LEFT': - direction = 'RIGHT' - if direction == 'UP': - snake_position[1] -= 10 - if direction == 'DOWN': - snake_position[1] += 10 - if direction == 'LEFT': - snake_position[0] -= 10 - if direction == 'RIGHT': - snake_position[0] += 10 - snake_body.insert(0, list(snake_position)) - if snake_position[0] == fruit_position[0] and snake_position[1] == fruit_position[1]: - score += 10 - fruit_spawn = False - else: - snake_body.pop() - if not fruit_spawn: - fruit_position = [random.randrange(1, (window_x//10)) * 10, - random.randrange(1, (window_y//10)) * 10] - fruit_spawn = True - game_window.fill(black) - for pos in snake_body: - pygame.draw.rect(game_window, golden_brown, pygame.Rect( - pos[0], pos[1], 10, 10)) - pygame.draw.rect(game_window, white, pygame.Rect( - fruit_position[0], fruit_position[1], 10, 10)) - if snake_position[0] < 0 or snake_position[0] > window_x-10: - game_over() - if snake_position[1] < 0 or snake_position[1] > window_y-10: - game_over() - for block in snake_body[1:]: - if snake_position[0] == block[0] and snake_position[1] == block[1]: - game_over() - show_score(1, white, 'times new roman', 20) - pygame.display.update() +import pygame +import time +import random +snake_speed = 20 +window_x = 720 +window_y = 480 +black = pygame.Color(0, 0, 0) +white = pygame.Color(255, 255, 255) +red = pygame.Color(255, 0, 0) +green = pygame.Color(0, 255, 0) +blue = pygame.Color(0, 0, 255) +golden_brown = pygame.Color(150, 105, 25) +pygame.init() +pygame.display.set_caption('snakes') +game_window = pygame.display.set_mode((window_x, window_y)) +fps = pygame.time.Clock() +snake_position = [100, 50] +snake_body = [ [100, 50], + [90, 50], + [80, 50], + [70, 50] + ] +fruit_position = [random.randrange(1, (window_x//10)) * 10, + random.randrange(1, (window_y//10)) * 10] +fruit_spawn = True +direction = 'RIGHT' +change_to = direction +score = 0 +def show_score(choice, color, font, size): + score_font = pygame.font.SysFont(font, size) + score_surface = score_font.render('Score : ' + str(score), True, color) + score_rect = score_surface.get_rect() + game_window.blit(score_surface, score_rect) +def game_over(): + my_font = pygame.font.SysFont('times new roman', 50) + game_over_surface = my_font.render('Your Score is : ' + str(score), True, red) + game_over_rect = game_over_surface.get_rect() + game_over_rect.midtop = (window_x/2, window_y/4) + game_window.blit(game_over_surface, game_over_rect) + pygame.display.flip() + time.sleep(2) + pygame.quit() + quit() +while True: + for event in pygame.event.get(): + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_UP: + change_to = 'UP' + if event.key == pygame.K_DOWN: + change_to = 'DOWN' + if event.key == pygame.K_LEFT: + change_to = 'LEFT' + if event.key == pygame.K_RIGHT: + change_to = 'RIGHT' + if change_to == 'UP' and direction != 'DOWN': + direction = 'UP' + if change_to == 'DOWN' and direction != 'UP': + direction = 'DOWN' + if change_to == 'LEFT' and direction != 'RIGHT': + direction = 'LEFT' + if change_to == 'RIGHT' and direction != 'LEFT': + direction = 'RIGHT' + if direction == 'UP': + snake_position[1] -= 10 + if direction == 'DOWN': + snake_position[1] += 10 + if direction == 'LEFT': + snake_position[0] -= 10 + if direction == 'RIGHT': + snake_position[0] += 10 + snake_body.insert(0, list(snake_position)) + if snake_position[0] == fruit_position[0] and snake_position[1] == fruit_position[1]: + score += 10 + fruit_spawn = False + else: + snake_body.pop() + if not fruit_spawn: + fruit_position = [random.randrange(1, (window_x//10)) * 10, + random.randrange(1, (window_y//10)) * 10] + fruit_spawn = True + game_window.fill(black) + for pos in snake_body: + pygame.draw.rect(game_window, golden_brown, pygame.Rect( + pos[0], pos[1], 10, 10)) + pygame.draw.rect(game_window, white, pygame.Rect( + fruit_position[0], fruit_position[1], 10, 10)) + if snake_position[0] < 0 or snake_position[0] > window_x-10: + game_over() + if snake_position[1] < 0 or snake_position[1] > window_y-10: + game_over() + for block in snake_body[1:]: + if snake_position[0] == block[0] and snake_position[1] == block[1]: + game_over() + show_score(1, white, 'times new roman', 20) + pygame.display.update() fps.tick(snake_speed) \ No newline at end of file