diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..14d30483 Binary files /dev/null and b/.DS_Store differ diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..bbcbbe7d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/name_ASCII_Banner/README.md b/.github/ISSUE_TEMPLATE/name_ASCII_Banner/README.md new file mode 100644 index 00000000..196645a6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/name_ASCII_Banner/README.md @@ -0,0 +1,8 @@ +# ASCII Banner 🌸 + +This is my fun Hacktoberfest contribution — a script that prints my name **“Gopika 🚀”** in beautiful ASCII art using random fonts each time you run it! + +## 🚀 How to Run +1. Install requirements: + ```bash + pip install pyfiglet diff --git a/.github/ISSUE_TEMPLATE/name_ASCII_Banner/banner.py b/.github/ISSUE_TEMPLATE/name_ASCII_Banner/banner.py new file mode 100644 index 00000000..47b7d5fb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/name_ASCII_Banner/banner.py @@ -0,0 +1,13 @@ +import pyfiglet +import random + +# Some cool fonts you can experiment with +fonts = ["slant", "block", "digital", "bubble", "starwars", "doom", "big"] + +print("\n✨ Welcome to Gopika's Hacktoberfest Contribution ✨\n") + +# Generate ASCII art with random font +banner = pyfiglet.figlet_format("Gopika 🚀", font=random.choice(fonts)) + +print(banner) +print("💜 Made with love by Gopika 💜") diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 00000000..f9128470 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "windows-gcc-x86", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "C:/MinGW/bin/gcc.exe", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "windows-gcc-x86", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..2f014ea6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": true, + "cwd": ".", + "program": "build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..2b67dc19 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,60 @@ +{ + "liveServer.settings.port": 5501, + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..4632a0eb --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: gcc.exe build active file", + "command": "C:/MinGW/bin/gcc.exe", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe", + "" + ], + "options": { + "cwd": "C:/MinGW/bin" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/2048/app.js b/2048/app.js new file mode 100644 index 00000000..94a724be --- /dev/null +++ b/2048/app.js @@ -0,0 +1,191 @@ +```javascript +let arr = []; +let hasCombine = []; +let hasMove = true; +let score = 0; + +function initializeGrid() { + arr = Array(4).fill(null).map(() => Array(4).fill(0)); + hasCombine = Array(4).fill(null).map(() => Array(4).fill(false)); + let x = Math.floor(Math.random() * 4); + let y = Math.floor(Math.random() * 4); + arr[x][y] = 2; +} + +initializeGrid(); +fill(); + +document.addEventListener("keydown", keyPush); + +document.addEventListener("click", (event) => { + const validButtons = ['up','down','left','right']; + if(validButtons.includes(event.target.name)) { + let keyCode; + switch(event.target.name) { + case 'up': keyCode = 38; break; + case 'down': keyCode = 40; break; + case 'left': keyCode = 37; break; + case 'right': keyCode = 39; break; + } + + document.dispatchEvent(new KeyboardEvent("keydown", { keyCode })); + } +}); + + +function keyPush(evt) { + hasMove = false; + switch (evt.keyCode) { + case 37: // Left + moveTiles(0, 1, (i, j, c) => arr[i][j - c - 1] == 0, (i, j, c) => arr[i][j - c - 1] == arr[i][j - c], (i, j, c) => swap(i, j - c, i, j - c - 1), (i, j, c) => combine(i, j - c, i, j - c - 1)); + break; + case 38: // Up + moveTiles(1, 0, (i, j, c) => arr[i - c - 1][j] == 0, (i, j, c) => arr[i - c - 1][j] == arr[i - c][j], (i, j, c) => swap(i - c, j, i - c - 1, j), (i, j, c) => combine(i - c, j, i - c - 1, j)); + break; + case 39: // Right + moveTiles(0, -1, (i, j, c) => arr[i][j + c + 1] == 0, (i, j, c) => arr[i][j + c + 1] == arr[i][j + c], (i, j, c) => swap(i, j + c, i, j + c + 1), (i, j, c) => combine(i, j + c, i, j + c + 1)); + break; + case 40: // Down + moveTiles(-1, 0, (i, j, c) => arr[i + c + 1][j] == 0, (i, j, c) => arr[i + c + 1][j] == arr[i + c][j], (i, j, c) => swap(i + c, j, i + c + 1, j), (i, j, c) => combine(i + c, j, i + c + 1, j)); + break; + } + fill(); +} + +function moveTiles(iDirection, jDirection, isEmpty, canCombine, doSwap, doCombine) { + const startI = iDirection === -1 ? 3 : 0; + const startJ = jDirection === -1 ? 3 : 0; + const iIncrement = iDirection === 0 ? 1 : -1; + const jIncrement = jDirection === 0 ? 1 : -1; + + for (let i = startI; i >= 0 && i < 4; i += iIncrement) { + for (let j = startJ; j >= 0 && j < 4; j += jIncrement) { + let c = 0; + while ((iDirection === 0 && j + c >= 0 && j + c < 3) || (jDirection === 0 && i + c >= 0 && i + c < 3)) { + if (isEmpty(i, j, c)) { + doSwap(i, j + c * jDirection, i, j + (c + 1) * jDirection || i + c * iDirection, i + (c + 1) * iDirection); + } else if (canCombine(i, j, c)) { + doCombine(i, j + c * jDirection, i, j + (c + 1) * jDirection || i + c * iDirection, i + (c + 1) * iDirection); + } + c++; + } + } + } +} + +function fill() { + if (!isFull()) { + if (hasMove) { + randomXY(); + } + } else if (isGameOver()) { + document.getElementById("gameOver").style.display = "block"; + } + + for (let i = 0; i < 4; i++) { + for (let j = 0; j < 4; j++) { + const temp = document.getElementById(i + "" + j); + temp.innerHTML = arr[i][j] !== 0 ? arr[i][j] : ''; + } + } + resetHasCombine(); +} + +function randomXY() { + let x, y; + do { + x = Math.floor(Math.random() * 4); + y = Math.floor(Math.random() * 4); + } while (arr[x][y] !== 0); + + const z = Math.ceil(Math.random() * 10); + arr[x][y] = z >= 7 ? 4 : 2; +} + +function swap(a, b, x, y) { + if (arr[a][b] !== 0 || arr[x][y] !== 0) { + [arr[a][b], arr[x][y]] = [arr[x][y], arr[a][b]]; + hasMove = true; + } +} + +function combine(a, b, x, y) { + if (!hasCombine[x][y] && !hasCombine[a][b]) { + arr[x][y] *= 2; + arr[a][b] = 0; + hasCombine[x][y] = true; + hasMove = true; + score += arr[x][y]; + document.getElementById('num-score').innerHTML = score; + } +} + +function resetHasCombine() { + for (let i = 0; i < 4; i++) { + for (let j = 0; j < 4; j++) { + hasCombine[i][j] = false; + } + } +} + +function isFull() { + return !arr.some(row => row.includes(0)); +} + +function isGameOver() { + for (let i = 0; i < 4; i++) { + for (let j = 0; j < 4; j++) { + if (i > 0 && arr[i - 1][j] === arr[i][j]) return false; + if (j > 0 && arr[i][j - 1] === arr[i][j]) return false; + if (i < 3 && arr[i + 1][j] === arr[i][j]) return false; + if (j < 3 && arr[i][j + 1] === arr[i][j]) return false; + } + } + return true; +} + +function restart() { + initializeGrid(); + document.getElementById('gameOver').style.display = 'none'; + document.getElementById('num-score').innerHTML = score = 0; + fill(); +} + +// btn-translate +let btnTranslate = document.getElementsByClassName("btn-translate")[0]; + +btnTranslate.onclick = () => { + let body = document.getElementsByTagName("body")[0]; + + if(body.className != "id"){ + // ID + body.classList.add("id"); + + // .how -> span + document.querySelector('.how span').textContent = "Bagaimana cara Bermain?"; + // .how -> p + document.querySelector('.how p').innerHTML = "Gunakan tombol panah Anda untuk memindahkan ubin. Ubin dengan nomor yang sama bergabung menjadi satu ketika mereka menyentuh. Tambahkan hingga mencapai 2048!"; + // #text-score + document.querySelector('#text-score').textContent = "Skor : "; + // #gameOver -> span + document.querySelector('#gameOver span').textContent = "Permainan Selesai !!"; + // #gameOver -> #reset + document.querySelector('#gameOver #reset').textContent = "Coba Lagi"; + + } else { + // EN + body.classList.remove("id"); + + // how -> span + document.querySelector('.how span').textContent = "How to Play?" + // how -> p + document.querySelector('.how p').innerHTML = "Use your arrow keys to move the tiles. Tiles with the same number merge into one when they touch. Add them up to reach 2048!" + // #text-score + document.querySelector('#text-score').textContent = "Score : "; + // #gameOver -> span + document.querySelector('#gameOver span').textContent = "Game Over !!"; + // #gameOver -> #reset + document.querySelector('#gameOver #reset').textContent = "Try Again"; + } +} +``` diff --git a/2048/arrow.png b/2048/arrow.png new file mode 100644 index 00000000..ebcc46b8 Binary files /dev/null and b/2048/arrow.png differ diff --git a/2048/index.html b/2048/index.html new file mode 100644 index 00000000..719d1994 --- /dev/null +++ b/2048/index.html @@ -0,0 +1,96 @@ + + + +
+

Score : 0

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ Game Over !!
+ +
+ +
+ + + + + + + + diff --git a/2048/style.css b/2048/style.css new file mode 100644 index 00000000..f5946fbd --- /dev/null +++ b/2048/style.css @@ -0,0 +1,157 @@ +body { + background: linear-gradient(45deg, #f6ffcb, #d693f0); +} + +table { + margin-top: 50px; + border-radius: 10px; + background: linear-gradient(45deg, #80c1ff, #3c72d6); + box-shadow: 0px 0px 54px 21px rgb(171, 177, 140); +} + +tr, +td { + height: 100px; + width: 100px; + text-align: center; + font-size: 32px; + border-radius: 10px; + background: linear-gradient(45deg, #e0d7d9, #e6f5e2); +} + +.how { + position: absolute; + top: 20%; + left: 4%; + width: 20%; + background: linear-gradient(45deg, #f890aa, #94ff79); + padding: 30px; + box-shadow: 0px 0px 54px 1px rgb(171, 177, 140); + border-radius: 20px; + text-align: center +} + +.how span { + font-size: 28px; + font-family: arial; + font-weight: bold; +} + +.how p { + font-size: 23px; + font-family: arial; + font-weight: normal; +} + +.how img { + width: 80%; +} + +.game-container { + position: absolute; + left: 50%; + transform: translateX(-50%); +} + +#score { + width: 100%; + text-align: center; + font-size: 38px; + font-family: monospace; + background: linear-gradient(45deg, #0cf73f, #79ff80); + border-radius: 20px; + box-shadow: 0px 0px 54px 11px rgb(171, 177, 140); +} + +#gameOver { + background: linear-gradient(45deg, #fc4c4c, #cf3c3c); + border-radius: 20px; + display: none; + padding: 20px; + position: absolute; + top: 40%; + right: 5%; + text-align: center; + box-shadow: 0px 0px 54px 11px rgb(171, 177, 140); +} + +#gameOver span { + font-size: 38px; + font-family: monospace; +} + +#gameOver button { + margin: 15px; + font-size: 28px; + font-family: monospace; + border-radius: 10px; + padding: 10px; + outline: 0; + transition: all 0.3s ease; +} + +#gameOver button:hover { + transform: scale(1.1); +} + +table { + margin-top: 24px; +} + +tr, +td { + height: 100px; + width: 100px; + text-align: center; + font-size: 32px; +} + +#gameOver, +#newGame { + display: none; +} + +#newGame { + padding: 12px 16px; + background-color: #fff; + border: 2px solid #000; + font-size: 18px; + font-weight: bold; + cursor: pointer; + transition: 0.3s; +} + +#newGame:hover { + transform: scale(1.05); + background-color: #000; + color: #fff; +} + +.buttons { + margin-top: 40px; +} + +.buttons button { + height: 60px; + width: 60px; +} + +.btn-translate{ + position: fixed; + top: 25px; + right: 25px; + display: flex; + align-items: center; + justify-content: center; + height: 50px; + width: 50px; + border: none; + cursor: pointer; + border-radius: 100%; + background-color: #0cf73f; +} + +.btn-translate svg{ + height: auto; + width: 25px; +} \ No newline at end of file diff --git a/A real time rock paper scissor game ML/.gitignore b/A real time rock paper scissor game ML/.gitignore new file mode 100644 index 00000000..cafd5983 --- /dev/null +++ b/A real time rock paper scissor game ML/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +.venv/ \ No newline at end of file diff --git a/A real time rock paper scissor game ML/.vscode/settings.json b/A real time rock paper scissor game ML/.vscode/settings.json new file mode 100644 index 00000000..e0e0236a --- /dev/null +++ b/A real time rock paper scissor game ML/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "workbench.colorTheme": "freeCodeCamp Dark Theme" +} diff --git a/A real time rock paper scissor game ML/Approach.md b/A real time rock paper scissor game ML/Approach.md new file mode 100644 index 00000000..843d4fed --- /dev/null +++ b/A real time rock paper scissor game ML/Approach.md @@ -0,0 +1,45 @@ +Certainly! Here's an analysis and approach for coding the rock, paper, scissors project: + +1. Understanding the problem: + +- We need to create a player function that can win against four different opponents (quincy, abbey, kris, and mrugesh) at least 60% of the time. +- The player function should take the opponent's previous play as an input and return the next move. +- We need to implement different strategies to counter various playing styles. + +2. Analyzing the opponents: + +- Quincy: Follows a fixed pattern (R, R, P, P, S) +- Mrugesh: Plays the move that would have beaten the most frequent move in the last 10 rounds +- Kris: Plays the move that would have beaten the opponent's last move +- Abbey: Uses a more complex strategy based on play order and frequency + +3. Approach to implement the player function: + +- Use the opponent_history to keep track of all previous plays +- Implement multiple strategies and switch between them based on the opponent's behavior +- Use pattern recognition to identify and exploit predictable sequences +- Implement a counter-strategy for each known opponent + +4. Strategies to consider: + +- Pattern matching: Look for repeating sequences in the opponent's moves +- Frequency analysis: Track the frequency of each move and counter the most common one +- Adaptive play: Adjust strategy based on the success rate of different moves +- Meta-strategy: Detect which opponent we're playing against and use a specific counter-strategy + +5. Implementation steps: + +- Initialize variables to track opponent history, move frequencies, and strategy performance +- Implement functions for each strategy (e.g., pattern matching, frequency analysis) +- Create a main logic that selects the best strategy based on performance +- Add logic to detect specific opponents and apply tailored counter-strategies +- Continuously update and refine the strategy selection based on win rates + +6. Testing and refinement: + +- Use the play function in main.py to test against each opponent +- Analyze the results and identify weaknesses in the current strategy +- Refine and adjust the strategies to improve win rates +- Ensure the player function passes all unit tests in test_module.py + +By implementing this approach, we can create a robust player function that adapts to different opponents and achieves a high win rate across all matchups. diff --git a/A real time rock paper scissor game ML/LICENCE b/A real time rock paper scissor game ML/LICENCE new file mode 100644 index 00000000..9c5bb78b --- /dev/null +++ b/A real time rock paper scissor game ML/LICENCE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 David Mickelson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/A real time rock paper scissor game ML/README.md b/A real time rock paper scissor game ML/README.md new file mode 100644 index 00000000..514b6e9c --- /dev/null +++ b/A real time rock paper scissor game ML/README.md @@ -0,0 +1,63 @@ +# Rock Paper Scissors AI + +This project implements an advanced AI player for the classic game of Rock Paper Scissors using machine learning techniques and adaptive strategies. The goal is to create a player that can defeat various opponents with a win rate of at least 60%. + +## Project Overview + +The AI player utilizes a combination of machine learning models, statistical analysis, and strategic decision-making to predict and counter opponent moves. The system is designed to adapt to different playing styles and exploit patterns in opponent behavior. + +## Key Features + +1. **LSTM Neural Network**: Implements a Long Short-Term Memory (LSTM) neural network to predict opponent moves based on historical data. + +2. **Adaptive Learning**: Utilizes online learning techniques to continuously update the model with new game data, allowing real-time adaptation to changing strategies. + +3. **Opponent Modeling**: Implements algorithms to detect and classify opponent types, enabling tailored counter-strategies. + +4. **Feature Engineering**: Extracts meaningful features from game history, including move frequencies and previous results, to enhance prediction accuracy. + +5. **Dynamic Learning Rate**: Implements a decaying learning rate strategy to optimize model convergence over time. + +6. **Ensemble Decision Making**: Combines multiple strategies, including pattern matching, frequency analysis, and neural network predictions, to make robust move decisions. + +## Machine Learning Techniques + +- Sequence Prediction: Uses LSTM for time series forecasting of opponent moves. +- Classification: Implements multi-class classification to predict the next move (Rock, Paper, or Scissors). +- Online Learning: Continuously updates the model with each new move, allowing for real-time adaptation. +- Feature Extraction: Derives relevant features from raw game data to improve model performance. + +## Data Science Aspects + +- Exploratory Data Analysis: Analyzes opponent move distributions and patterns. +- Time Series Analysis: Examines temporal patterns in opponent behavior. +- Statistical Hypothesis Testing: Evaluates the effectiveness of different strategies. +- Performance Metrics: Tracks win rates, accuracy, and other relevant metrics to assess and improve AI performance. + +## Project Structure + +- `RPS.py`: Contains the main AI player implementation. +- `RPS_game.py`: Implements the game logic and opponent strategies. +- `test_module.py`: Includes unit tests to validate the AI player's performance. + +## Getting Started + +To run the project: + +1. Ensure you have Python and the required libraries (TensorFlow, Keras, NumPy) installed. +2. Run `python RPS.py` to start a game session. +3. Use `test_module.py` to run performance tests against various opponents. + +## Future Improvements + +- Implement more advanced neural network architectures (e.g., Transformer models). +- Explore reinforcement learning techniques for strategy optimization. +- Develop a more sophisticated opponent modeling system using clustering algorithms. + +This project demonstrates the application of machine learning and data science techniques to solve a classic game theory problem, showcasing adaptive learning and strategic decision-making in an adversarial environment. + +## Run the tests + +# Uncomment line below to run unit tests automatically + +# main(module='test_module', exit=False) diff --git a/A real time rock paper scissor game ML/RPS.py b/A real time rock paper scissor game ML/RPS.py new file mode 100644 index 00000000..4dd1c217 --- /dev/null +++ b/A real time rock paper scissor game ML/RPS.py @@ -0,0 +1,466 @@ +# The code implements a rock, paper, scissors player using a machine learning approach. It uses a Long Short-Term Memory(LSTM) neural network to predict the opponent's next move based on their history of moves. The main components of the code are: +# Data preparation functions +# Model building and training functions +# Move prediction and counter-move selection +# The main player function that combines all these elements + +import random +import tensorflow as tf +import keras +from keras import layers +from keras import optimizers +import numpy as np + +tf.keras.utils.disable_interactive_logging() + +model = None +UPDATE_FREQUENCY = 30 # Frequency of Updating the model with new data +SEQUENCE_LENGTH = 20 # Number of moves to consider for prediction +TRAINING_ITERATIONS = 0 + +is_quincy = False +is_kris = False +is_mrugesh = False +is_abbey = False + +my_moves = [] + +assert UPDATE_FREQUENCY > SEQUENCE_LENGTH, f"UPDATE_FREQUENCY ({UPDATE_FREQUENCY}) must be greater than SEQUENCE_LENGTH ({SEQUENCE_LENGTH})" + + +def calculate_move_frequency(history, window_size=50): + """ + calculate the frequency of each move in the recent history + """ + recent_history = history[-window_size:] + total_moves = len(recent_history) + frequency = { + 'R': recent_history.count('R') / total_moves, + 'P': recent_history.count('P') / total_moves, + 'S': recent_history.count('S') / total_moves + } + return frequency + + +def get_previous_results(history, window_size=10): + """ + track the results of previous games + """ + results = [] + for i in range(1, min(window_size, len(history))): + prev_move = history[-i-1] + current_move = history[-i] + if prev_move == current_move: + results.append(0) # Tie + elif (prev_move == 'R' and current_move == 'P') or \ + (prev_move == 'P' and current_move == 'S') or \ + (prev_move == 'S' and current_move == 'R'): + results.append(1) # Win + else: + results.append(-1) # Loss + return results + + +def prepare_data(history, sequence_length=SEQUENCE_LENGTH): + """ + Prepares the data for training the RPS model by converting the move history into a sequence of integers and adding additional features. + + Args: + history (list): The history of moves played. + sequence_length (int): The number of previous moves to consider for prediction. + + Returns: + Tuple[np.ndarray, np.ndarray]: The input sequences (X) and the corresponding target moves (y). + """ + X, y = [], [] + if len(history) > sequence_length: + for i in range(len(history) - sequence_length): + sequence = [move_to_int(m) + for m in history[i:i+sequence_length] if m] + if len(sequence) == sequence_length: + # Add move frequency + freq = calculate_move_frequency(history[:i+sequence_length]) + sequence.extend([freq['R'], freq['P'], freq['S']]) + + # Add previous results + results = get_previous_results(history[:i+sequence_length]) + sequence.extend(results) + + X.append(sequence) + y.append(move_to_int(history[i+sequence_length])) + return np.array(X), np.array(y) + + +def move_to_int(move): + valid_moves = {'R': 0, 'P': 1, 'S': 2} + if move in valid_moves: + return valid_moves[move] + else: + raise ValueError(f"Invalid move_to_int {move}") + + +def int_to_move(int_move): + if 0 <= int_move <= 2: + return {0: 'R', 1: 'P', 2: 'S'}[int_move] + else: + raise ValueError(f"Invalid int_to_move {int_move}") + +# This approach uses a Sequential model with an LSTM layer to learn patterns in the opponent's moves. +# It trains on the entire history each time, which might be computationally expensive for long games. +# For better performance, you could train the model periodically or use online learning techniques. + + +def build_model(learning_rate=0.001): + """ + Builds and compiles a Sequential model with LSTM layers for predicting RPS moves. + The LSTM layer is followed by a dense layer with ReLU activation, which can help capture more complex patterns. + + Args: + sequence_length (int): The number of previous moves to consider for prediction. + + Returns: + keras.models.Sequential: The compiled model. + """ + input_shape = SEQUENCE_LENGTH + 3 + \ + 10 # Sequence + 3 frequencies + 10 previous results + model = keras.Sequential([ + layers.Input(shape=(input_shape, 1)), + layers.LSTM(32), + layers.Dense(16, activation='relu'), + layers.Dense(3, activation='softmax') + ]) + model.compile(optimizer=optimizers.Adam(learning_rate=0.001), + loss='sparse_categorical_crossentropy', metrics=['accuracy']) + return model + + +def get_dynamic_learning_rate(initial_rate=0, decay_factor=0, min_rate=0): + # initial_rate=0.001, decay_factor=0.95, min_rate=0.0001 + """ + Dynamic Learning Rate + The get_dynamic_learning_rate function implements a decaying learning rate strategy + This can help the model converge more effectively as training progresses. + """ + global TRAINING_ITERATIONS + learning_rate = max(initial_rate * (decay_factor ** + TRAINING_ITERATIONS), min_rate) + TRAINING_ITERATIONS += 1 + return learning_rate + + +@tf.function(input_signature=[tf.TensorSpec(shape=(1, SEQUENCE_LENGTH, 1), dtype=tf.float32), + tf.TensorSpec(shape=(1,), dtype=tf.int32)]) +def train_step(x, y): + with tf.GradientTape() as tape: + logits = model(x, training=True) + loss_value = tf.keras.losses.sparse_categorical_crossentropy(y, logits) + grads = tape.gradient(loss_value, model.trainable_weights) + model.optimizer.apply_gradients(zip(grads, model.trainable_weights)) + return loss_value + + +def train_model(history): + """ + Trains the model on the provided game history. + + Args: + history (list): A list of the opponent's previous moves, represented as strings ('R', 'P', 'S'). + + Returns: + keras.models.Sequential: The trained model. + """ + X, y = prepare_data(history) + if len(X) > 0 and len(y) > 0: + learning_rate = get_dynamic_learning_rate() + model = build_model(learning_rate) + model.fit(X, y, epochs=20, verbose=0) + return model + return None + + +def check_if_quincy(opponent_history): + """ + Checks if the opponent's move history matches the known pattern of Quincy's play. + + Args: + opponent_history (list): A list of the opponent's previous moves, represented as strings ('R', 'P', 'S'). + + Returns: + bool: True if the opponent's move history matches Quincy's pattern, False otherwise. + """ + if len(opponent_history) >= 5: + quincy_pattern = ["R", "R", "P", "P", "S"] + start_index = (len(opponent_history) + 1) % 5 + expected_pattern = quincy_pattern[start_index:] + \ + quincy_pattern[:start_index] + last_five = opponent_history[-5:] + + # print( + # f"Checking pattern {expected_pattern} starting at index {start_index}") + # print(f"Last five moves: {last_five}") + # print(f"Expected pattern: {expected_pattern}") + + if all(a == b for a, b in zip(last_five, expected_pattern)): + print(f"Playing Against Quincy") + return True + else: + print( + f"Expected pattern {expected_pattern} not equal to {last_five}") + print(f"Not playing against Quincy") + return False + return True + + +def quincy_counter(round_number): + quincy_sequence = ['R', 'R', 'P', 'P', 'S'] + predicted_move = quincy_sequence[(round_number + 1) % 5] + print(f"Quincy prediction {predicted_move}") + my_counter = counter_move(predicted_move) + print(f"I played {my_counter}") + return my_counter + + +def check_if_mrugesh(opponent_history, my_moves): + if len(my_moves) >= 10: + # last_ten = my_moves[-10:] + last_ten = my_moves[-11:-1] + most_frequent = max(set(last_ten), key=last_ten.count) + if most_frequent == '': + most_frequent = "S" + ideal_response = {'P': 'S', 'R': 'P', 'S': 'R'} + expected_move = ideal_response[most_frequent] + if opponent_history[-1] == expected_move: + print("Playing Against Mrugesh") + return True + else: + print("Not playing against Mrugesh") + print( + f"Expected move {expected_move} but got {opponent_history[-1]}") + return False + return True + + +def mrugesh_counter(my_moves): + last_ten = my_moves[-10:] + most_frequent = max(set(last_ten), key=last_ten.count) + predicted_move = counter_move(most_frequent) + print(f"Mrugesh prediction {predicted_move}") + my_counter = counter_move(predicted_move) + print(f"I played {my_counter}") + return my_counter + + +def check_if_kris(opponent_history, my_moves): + if len(opponent_history) >= 3 and len(my_moves) >= 2: + prev_my_play = my_moves[-2] + # print(f"prev_my_play {prev_my_play}") + kris_planned_move = counter_move(prev_my_play) + # print(f"kris_planned_move {kris_planned_move} opponent_history[-1] {opponent_history[-1]}") + if opponent_history[-1] == kris_planned_move: + print("Playing Against Kris") + return True + else: + print("Not playing against Kris") + return False + return True + + +def kris_counter(prev_play, my_moves): + predicted_move = counter_move(my_moves[-1]) + # print(f"Kris prediction {predicted_move}") + my_counter = counter_move(predicted_move) + # print(f"I played {my_counter}") + return my_counter + + +def check_if_abbey(opponent_history, my_moves, confidence_threshold=0.6): + if len(my_moves) < 10: # Increased minimum history for better accuracy + return True + + play_order = { + "RR": 0, "RP": 0, "RS": 0, + "PR": 0, "PP": 0, "PS": 0, + "SR": 0, "SP": 0, "SS": 0, + } + + for i in range(len(my_moves) - 2): + key = my_moves[i] + my_moves[i+1] + if key in play_order: + play_order[key] += 1 + + correct_predictions = 0 + total_predictions = 0 + + for i in range(2, len(my_moves)): + last_two = "".join(my_moves[i-2:i]) + potential_plays = [last_two[1] + "R", + last_two[1] + "P", last_two[1] + "S"] + sub_order = {k: play_order[k] + for k in potential_plays if k in play_order} + + if sub_order: + prediction = max(sub_order, key=sub_order.get)[-1:] + expected_move = counter_move(prediction) + if opponent_history[i] == expected_move: + correct_predictions += 1 + total_predictions += 1 + + if total_predictions > 0: + accuracy = correct_predictions / total_predictions + if accuracy >= confidence_threshold: + print(f"Playing Against Abbey (Confidence: {accuracy:.2f})") + return True + else: + print(f"Not playing against Abbey (Confidence: {accuracy:.2f})") + return False + else: + return True # Continue checking if not enough predictions + + +def abbey_counter(my_moves): + play_order = { + "RR": 0, "RP": 0, "RS": 0, + "PR": 0, "PP": 0, "PS": 0, + "SR": 0, "SP": 0, "SS": 0, + } + + for i in range(len(my_moves) - 2): + key = my_moves[i] + my_moves[i+1] + if key in play_order: + play_order[key] += 1 + + last_two = "".join(my_moves[-2:]) + potential_plays = [last_two[1] + "R", last_two[1] + "P", last_two[1] + "S"] + + sub_order = {k: play_order[k] for k in potential_plays if k in play_order} + if not sub_order: + return random.choice(['R', 'P', 'S']) + + prediction = max(sub_order, key=sub_order.get)[-1:] + abbey_move = counter_move(prediction) + + # Implement a mixed strategy + if random.random() < 0.8: # 80% of the time, use the counter strategy + my_counter = counter_move(abbey_move) + else: # 20% of the time, play randomly to avoid being too predictable + my_counter = random.choice(['R', 'P', 'S']) + + print(f"Abbey prediction {abbey_move}") + print(f"I played {my_counter}") + return my_counter + + +def counter_move(move): + return {'R': 'P', 'P': 'S', 'S': 'R'}[move] + + +def track_my_moves(move, my_moves=[]) -> list: + my_moves.append(move) + return my_moves + +# Initialize the model at the start of the game and update it periodically + +# Implement online learning to update the model with each new move +# This code segment does the following: +# 1. It checks if we have enough history(more than 10 moves). +# 2. If so, it prepares a single training example: +# - X is the sequence of the last 10 moves(excluding the most recent one). +# - y is the most recent move(which we're trying to predict). +# 3. It then calls model.train_on_batch(X, y), which updates the model's weights based on this single example. +# This approach is called online learning because it updates the model incrementally with each new piece of data, +# rather than training on the entire dataset at once. This allows the model to adapt quickly to changes in the opponent's strategy +# while being computationally efficient. + + +def player(prev_play, opponent_history=[]): + """ + Determines the next move based on the opponent's history and model predictions. + This function implements both incremental training and periodic batch retraining. + + Args: + prev_play (str): The opponent's previous move. + opponent_history (list): A list of the opponent's moves so far. + + Returns: + str: The next move to play ('R', 'P', or 'S'). + """ + global model, my_moves, is_quincy, is_mrugesh, is_kris, is_abbey + + my_next_move = None + + if not prev_play: + opponent_history.clear() + my_moves = [] + # Build the model at start of the game and update it periodically + model = build_model() + is_quincy = is_mrugesh = is_kris = is_abbey = True + else: + opponent_history.append(prev_play) + if len(opponent_history) > SEQUENCE_LENGTH: + X, y = prepare_data(opponent_history[-SEQUENCE_LENGTH:]) + if len(X) > 0 and len(y) > 0: + # Incremental update for online learning + model.train_on_batch(X, y) + + if len(opponent_history) <= 2: + # Random outputs until we have enough history + my_next_move = random.choice(['R', 'P', 'S']) + my_moves = track_my_moves(my_next_move) + return my_next_move + + # Need to keep checking who the opponent is + if is_kris: + if check_if_kris(opponent_history, my_moves): + my_next_move = kris_counter(prev_play, my_moves) + else: + is_kris = False + + if not is_kris and is_quincy: + if check_if_quincy(opponent_history): + my_next_move = quincy_counter(len(opponent_history)) + else: + is_quincy = False + + if not is_kris and not is_quincy and is_mrugesh: + if check_if_mrugesh(opponent_history, my_moves): + my_next_move = mrugesh_counter(my_moves) + else: + is_mrugesh = False + + if not is_kris and not is_quincy and not is_mrugesh and is_abbey: + # if check_if_abbey(opponent_history, my_moves): + # my_next_move = abbey_counter(my_moves) + # else: + # is_abbey = False + my_next_move = abbey_counter(my_moves) + + if not is_kris and not is_quincy and not is_abbey and not is_mrugesh: + # Periodic batch retraining + if len(opponent_history) % UPDATE_FREQUENCY == 0: + # print(f"Retraining model with {len(opponent_history)} moves...") + try: + learning_rate = get_dynamic_learning_rate() + new_model = train_model(opponent_history) + if new_model is not None: + model = new_model + # print(f"Current learning rate: {learning_rate}") + except Exception as e: + print(f"Error during model training: {e}") + + try: + sequence = [move_to_int(m) + for m in opponent_history[-SEQUENCE_LENGTH:]] + freq = calculate_move_frequency(opponent_history) + sequence.extend([freq['R'], freq['P'], freq['S']]) + results = get_previous_results(opponent_history) + sequence.extend(results) + + X = np.array([sequence]) + prediction = model.predict(X) + predicted_move = int_to_move(np.argmax(prediction[0])) + my_next_move = counter_move(predicted_move) + except Exception as e: + print(f"Error during prediction: {e}") + my_next_move = random.choice(['R', 'P', 'S']) + my_moves = track_my_moves(my_next_move) + return my_next_move diff --git a/A real time rock paper scissor game ML/RPS_game.py b/A real time rock paper scissor game ML/RPS_game.py new file mode 100644 index 00000000..147a982d --- /dev/null +++ b/A real time rock paper scissor game ML/RPS_game.py @@ -0,0 +1,122 @@ +# DO NOT MODIFY THIS FILE + +import random + + +def play(player1, player2, num_games, verbose=False): + p1_prev_play = "" + p2_prev_play = "" + results = {"p1": 0, "p2": 0, "tie": 0} + + for _ in range(num_games): + p1_play = player1(p2_prev_play) + p2_play = player2(p1_prev_play) + + if p1_play == p2_play: + results["tie"] += 1 + winner = "Tie." + elif (p1_play == "P" and p2_play == "R") or ( + p1_play == "R" and p2_play == "S") or (p1_play == "S" + and p2_play == "P"): + results["p1"] += 1 + winner = "Player 1 wins." + elif p2_play == "P" and p1_play == "R" or p2_play == "R" and p1_play == "S" or p2_play == "S" and p1_play == "P": + results["p2"] += 1 + winner = "Player 2 wins." + + if verbose: + print("Player 1:", p1_play, "| Player 2:", p2_play) + print(winner) + print() + + p1_prev_play = p1_play + p2_prev_play = p2_play + + games_won = results['p2'] + results['p1'] + + if games_won == 0: + win_rate = 0 + else: + win_rate = results['p1'] / games_won * 100 + + print("Final results:", results) + print(f"Player 1 win rate: {win_rate}%") + + return (win_rate) + + +def quincy(prev_play, counter=[0]): + + counter[0] += 1 + choices = ["R", "R", "P", "P", "S"] + return choices[counter[0] % len(choices)] + + +def mrugesh(prev_opponent_play, opponent_history=[]): + opponent_history.append(prev_opponent_play) + last_ten = opponent_history[-10:] + most_frequent = max(set(last_ten), key=last_ten.count) + + if most_frequent == '': + most_frequent = "S" + + ideal_response = {'P': 'S', 'R': 'P', 'S': 'R'} + return ideal_response[most_frequent] + + +def kris(prev_opponent_play): + if prev_opponent_play == '': + prev_opponent_play = "R" + ideal_response = {'P': 'S', 'R': 'P', 'S': 'R'} + return ideal_response[prev_opponent_play] + + +def abbey(prev_opponent_play, + opponent_history=[], + play_order=[{ + "RR": 0, + "RP": 0, + "RS": 0, + "PR": 0, + "PP": 0, + "PS": 0, + "SR": 0, + "SP": 0, + "SS": 0, + }]): + + if not prev_opponent_play: + prev_opponent_play = 'R' + opponent_history.append(prev_opponent_play) + + last_two = "".join(opponent_history[-2:]) + if len(last_two) == 2: + play_order[0][last_two] += 1 + + potential_plays = [ + prev_opponent_play + "R", + prev_opponent_play + "P", + prev_opponent_play + "S", + ] + + sub_order = { + k: play_order[0][k] + for k in potential_plays if k in play_order[0] + } + + prediction = max(sub_order, key=sub_order.get)[-1:] + + ideal_response = {'P': 'S', 'R': 'P', 'S': 'R'} + return ideal_response[prediction] + + +def human(prev_opponent_play): + play = "" + while play not in ['R', 'P', 'S']: + play = input("[R]ock, [P]aper, [S]cissors? ") + print(play) + return play + + +def random_player(prev_opponent_play): + return random.choice(['R', 'P', 'S']) diff --git a/A real time rock paper scissor game ML/Rock-paper-scissors.code-workspace b/A real time rock paper scissor game ML/Rock-paper-scissors.code-workspace new file mode 100644 index 00000000..fdfd37ed --- /dev/null +++ b/A real time rock paper scissor game ML/Rock-paper-scissors.code-workspace @@ -0,0 +1,10 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "workbench.colorTheme": "freeCodeCamp Dark Theme" + } +} \ No newline at end of file diff --git a/A real time rock paper scissor game ML/gitpod.yml b/A real time rock paper scissor game ML/gitpod.yml new file mode 100644 index 00000000..9ccdca7d --- /dev/null +++ b/A real time rock paper scissor game ML/gitpod.yml @@ -0,0 +1,8 @@ +image: gitpod/workspace-python-3.12 + +tasks: + - command: python main.py + +vscode: + extensions: + - https://github.com/freeCodeCamp/freecodecamp-dark-vscode-theme/releases/download/v1.0.0/freecodecamp-dark-vscode-theme-1.0.0.vsix diff --git a/A real time rock paper scissor game ML/main.py b/A real time rock paper scissor game ML/main.py new file mode 100644 index 00000000..e6a1fa29 --- /dev/null +++ b/A real time rock paper scissor game ML/main.py @@ -0,0 +1,19 @@ +# This entrypoint file to be used in development. Start by reading README.md +from RPS_game import play, mrugesh, abbey, quincy, kris, human, random_player +from RPS import player +from unittest import main + +# play(player, quincy, 1000) +# play(player, abbey, 1000, verbose=True) +# play(player, kris, 1000) +# play(player, mrugesh, 500) + +# Uncomment line below to play interactively against a bot: +# play(human, abbey, 20, verbose=True) + +# Uncomment line below to play against a bot that plays randomly: +# play(human, random_player, num_games=1, verbose=True) + + +# Uncomment line below to run unit tests automatically +main(module='test_module', exit=False) diff --git a/A real time rock paper scissor game ML/pyproject.toml b/A real time rock paper scissor game ML/pyproject.toml new file mode 100644 index 00000000..9e66def7 --- /dev/null +++ b/A real time rock paper scissor game ML/pyproject.toml @@ -0,0 +1,98 @@ +# pyproject.toml + +[build-system] +# Specify the build system requirements +# These are the minimum requirements for building the project +requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "Rock-Paper-Scissors" +dynamic = ["version"] +# A short description of your project (required) +description = "A machine learning project to play Rock Paper Scissors using different strategies" +# Longer description, can be the same as README content +readme = "README.md" +# Project license +license = {file = "LICENSE"} +# Minimum Python version required +requires-python = ">=3.7" +authors = [ + {name = "David Mickelson", email = "davidpmickelson@gmail.com"}, +] +keywords = ["rock-paper-scissors", "machine-learning", "ai", "game"] +# Project classifiers (see https://pypi.org/classifiers/) +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", +] +# Dependencies +dependencies = [ + "pydantic_settings>=2.0.0", + "pytest>=6.2.5", + "python-dotenv>=0.19.0", + "keras>=2.6.0,<3.0.0", + "tensorflow>=2.6.0,<3.0.0", + "numpy>=1.19.0,<2.0.0" +] + +# Optional dependencies +# These can be installed using pip install your-project[dev] +[project.optional-dependencies] +dev = [ + "pytest>=6.2.5", + "black>=21.12b0" + "flake8>=4.0.1", + # Add more development dependencies as needed +] + +# Entry points for your project (if it's a command-line tool) +[project.scripts] +rps = "RPS:player" + +# URLs associated with the project +[project.urls] +Homepage = "https://github.com/dmickelson/rock-paper-scissor" +Repository = "https://github.com/dmickelson/rock-paper-scissor.git" + + +# Tool configurations +[tool.setuptools] +packages = ["RPS"] + +[tool.setuptools_scm] +# Configuration for setuptools_scm (automatic versioning) +write_to = "rps/_version.py" + +[tool.flake8] +max-line-length = 88 +extend-ignore = ["E203"] +max-complexity = 10 +exclude = [ + "venv", + "test/data/" +] + +[tool.isort] +# Configuration for isort import sorter +profile = "black" +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +ensure_newline_before_comments = true +line_length = 88 + +[tool.pytest.ini_options] +# Configuration for pytest +minversion = "6.0" +addopts = "-ra -q" +testpaths = [ + "tests", +] diff --git a/A real time rock paper scissor game ML/test_module.py b/A real time rock paper scissor game ML/test_module.py new file mode 100644 index 00000000..6e59fa0d --- /dev/null +++ b/A real time rock paper scissor game ML/test_module.py @@ -0,0 +1,38 @@ +import unittest +from RPS_game import play, mrugesh, abbey, quincy, kris +from RPS import player + + +class UnitTests(unittest.TestCase): + print() + + def test_player_vs_quincy(self): + print("Testing game against quincy...") + actual = play(player, quincy, 1000) >= 60 + self.assertTrue( + actual, + 'Expected player to defeat quincy at least 60% of the time.') + + def test_player_vs_abbey(self): + print("Testing game against abbey...") + actual = play(player, abbey, 1000) >= 60 + self.assertTrue( + actual, + 'Expected player to defeat abbey at least 60% of the time.') + + def test_player_vs_kris(self): + print("Testing game against kris...") + actual = play(player, kris, 1000) >= 60 + self.assertTrue( + actual, 'Expected player to defeat kris at least 60% of the time.') + + def test_player_vs_mrugesh(self): + print("Testing game against mrugesh...") + actual = play(player, mrugesh, 1000) >= 60 + self.assertTrue( + actual, + 'Expected player to defeat mrugesh at least 60% of the time.') + + +if __name__ == "__main__": + unittest.main() diff --git a/AIRLINE SYSTEM USING JAVA/.gitignore b/AIRLINE SYSTEM USING JAVA/.gitignore new file mode 100644 index 00000000..26679621 --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/.gitignore @@ -0,0 +1,17 @@ + +# NetBeans specific # +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +nbactions.xml +nb-configuration.xml + +# Class Files # +*.class + +# Package Files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/AIRLINE SYSTEM USING JAVA/build.xml b/AIRLINE SYSTEM USING JAVA/build.xml new file mode 100644 index 00000000..09076ed1 --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/build.xml @@ -0,0 +1,30 @@ + + + + Another way to customize the build is by overriding existing main targets. + The targets of interest are: + + -init-macrodef-javac: defines macro for javac compilation + -init-macrodef-junit: defines macro for junit execution + -init-macrodef-debug: defines macro for class debugging + -init-macrodef-java: defines macro for class execution + -do-jar: JAR building + run: execution of project + -javadoc-build: Javadoc generation + test-report: JUnit report generation + + An example of overriding the target for project execution could look like this: + + + + + + + + Notice that the overridden target depends on the jar target and not only on + the compile target as the regular run target does. Again, for a list of available + properties which you can use, check the target you are overriding in the + nbproject/build-impl.xml file. + + --> + diff --git a/AIRLINE SYSTEM USING JAVA/manifest.mf b/AIRLINE SYSTEM USING JAVA/manifest.mf new file mode 100644 index 00000000..328e8e5b --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/AIRLINE SYSTEM USING JAVA/nbproject/build-impl.xml b/AIRLINE SYSTEM USING JAVA/nbproject/build-impl.xml new file mode 100644 index 00000000..fbf356f3 --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/nbproject/build-impl.xml @@ -0,0 +1,1771 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AIRLINE SYSTEM USING JAVA/nbproject/genfiles.properties b/AIRLINE SYSTEM USING JAVA/nbproject/genfiles.properties new file mode 100644 index 00000000..68feceb1 --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=d812957c +build.xml.script.CRC32=3e40db39 +build.xml.stylesheet.CRC32=f85dc8f2@1.102.0.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=d812957c +nbproject/build-impl.xml.script.CRC32=76ac2947 +nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.102.0.48 diff --git a/AIRLINE SYSTEM USING JAVA/nbproject/project.properties b/AIRLINE SYSTEM USING JAVA/nbproject/project.properties new file mode 100644 index 00000000..787874a7 --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/nbproject/project.properties @@ -0,0 +1,99 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.modulepath=\ + ${run.modulepath} +debug.test.classpath=\ + ${run.test.classpath} +debug.test.modulepath=\ + ${run.test.modulepath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/Airlines-Management-System.jar +dist.javadoc.dir=${dist.dir}/javadoc +dist.jlink.dir=${dist.dir}/jlink +dist.jlink.output=${dist.jlink.dir}/Airlines-Management-System +excludes= +file.reference.mysql-connector-java-8.0.17.jar=/Users/adrianadewunmi/Downloads/jar_files/mysql-connector-java-8.0.17.jar +file.reference.rs2xml.jar=/Users/adrianadewunmi/Downloads/jar_files/rs2xml.jar +includes=** +jar.compress=false +javac.classpath=\ + ${file.reference.mysql-connector-java-8.0.17.jar}:\ + ${file.reference.rs2xml.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.modulepath= +javac.processormodulepath= +javac.processorpath=\ + ${javac.classpath} +javac.source=11 +javac.target=11 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.modulepath=\ + ${javac.modulepath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.html5=false +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +# The jlink additional root modules to resolve +jlink.additionalmodules= +# The jlink additional command line parameters +jlink.additionalparam= +jlink.launcher=true +jlink.launcher.name=Airlines-Management-System +main.class= +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.modulepath=\ + ${javac.modulepath} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +run.test.modulepath=\ + ${javac.test.modulepath} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/AIRLINE SYSTEM USING JAVA/nbproject/project.xml b/AIRLINE SYSTEM USING JAVA/nbproject/project.xml new file mode 100644 index 00000000..be9b8a6d --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + Airlines-Management-System + + + + + + + + + diff --git a/AIRLINE SYSTEM USING JAVA/src/airline/AddCustomer.java b/AIRLINE SYSTEM USING JAVA/src/airline/AddCustomer.java new file mode 100644 index 00000000..e7307cfe --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/src/airline/AddCustomer.java @@ -0,0 +1,141 @@ +package airline; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.sql.*; + +public class AddCustomer extends JFrame { + + private JTextField textField, textField_1, textField_2, textField_3, textField_4, textField_5, textField_6; + private JRadioButton maleRadioButton, femaleRadioButton; + + public AddCustomer() { + getContentPane().setBackground(Color.WHITE); + setTitle("ADD CUSTOMER DETAILS"); + setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); + setSize(900, 600); + setLocationRelativeTo(null); // Center the frame on the screen + getContentPane().setLayout(null); + + // Labels and TextFields + JLabel passportNoLabel = new JLabel("PASSPORT NO"); + setupLabel(passportNoLabel, 60, 80); + textField = createTextField(200, 80); + + JLabel pnrNoLabel = new JLabel("PNR NO"); + setupLabel(pnrNoLabel, 60, 120); + textField_1 = createTextField(200, 120); + + JLabel addressLabel = new JLabel("ADDRESS"); + setupLabel(addressLabel, 60, 170); + textField_2 = createTextField(200, 170); + + JLabel nationalityLabel = new JLabel("NATIONALITY"); + setupLabel(nationalityLabel, 60, 220); + textField_3 = createTextField(200, 220); + + JLabel nameLabel = new JLabel("NAME"); + setupLabel(nameLabel, 60, 270); + textField_4 = createTextField(200, 270); + + JLabel genderLabel = new JLabel("GENDER"); + setupLabel(genderLabel, 60, 320); + maleRadioButton = createRadioButton("MALE", 200, 320); + femaleRadioButton = createRadioButton("FEMALE", 280, 320); + + JLabel phNoLabel = new JLabel("PH NO"); + setupLabel(phNoLabel, 60, 370); + textField_5 = createTextField(200, 370); + + JLabel flightCodeLabel = new JLabel("FLIGHT CODE"); + setupLabel(flightCodeLabel, 60, 30); + textField_6 = createTextField(200, 30); + + // Button + JButton saveButton = new JButton("SAVE"); + saveButton.setBounds(200, 420, 150, 30); + saveButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + saveCustomer(); + } + }); + add(saveButton); + + // Title + JLabel addCustomerTitle = new JLabel("ADD CUSTOMER DETAILS"); + addCustomerTitle.setForeground(Color.BLUE); + addCustomerTitle.setFont(new Font("Tahoma", Font.PLAIN, 31)); + addCustomerTitle.setBounds(420, 24, 442, 35); + add(addCustomerTitle); + + // Image + ImageIcon imageIcon = new ImageIcon(ClassLoader.getSystemResource("icon/emp.png")); + JLabel imageLabel = new JLabel(imageIcon); + imageLabel.setBounds(450, 80, 280, 410); + add(imageLabel); + + setVisible(true); + } + + private void setupLabel(JLabel label, int x, int y) { + label.setFont(new Font("Tahoma", Font.PLAIN, 17)); + label.setBounds(x, y, 150, 27); + add(label); + } + + private JTextField createTextField(int x, int y) { + JTextField textField = new JTextField(); + textField.setBounds(x, y, 150, 27); + add(textField); + return textField; + } + + private JRadioButton createRadioButton(String text, int x, int y) { + JRadioButton radioButton = new JRadioButton(text); + radioButton.setBackground(Color.WHITE); + radioButton.setBounds(x, y, 70, 27); + add(radioButton); + return radioButton; + } + + private void saveCustomer() { + String passportNo = textField.getText(); + String pnrNo = textField_1.getText(); + String address = textField_2.getText(); + String nationality = textField_3.getText(); + String name = textField_4.getText(); + String flightCode = textField_6.getText(); + String gender = maleRadioButton.isSelected() ? "male" : "female"; + String phNo = textField_5.getText(); + + try { + // Assuming 'conn' is a class handling database connection + conn c = new conn(); + String query = "INSERT INTO passenger VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; + PreparedStatement pstmt = c.prepareStatement(query); + pstmt.setString(1, pnrNo); + pstmt.setString(2, address); + pstmt.setString(3, nationality); + pstmt.setString(4, name); + pstmt.setString(5, gender); + pstmt.setString(6, phNo); + pstmt.setString(7, passportNo); + pstmt.setString(8, flightCode); + + pstmt.executeUpdate(); + JOptionPane.showMessageDialog(null, "Customer Added"); + setVisible(false); + + } catch (SQLException e) { + e.printStackTrace(); + JOptionPane.showMessageDialog(null, "Error: Failed to add customer"); + } + } + + public static void main(String[] args) { + EventQueue.invokeLater(() -> { + new AddCustomer(); + }); + } +} diff --git a/AIRLINE SYSTEM USING JAVA/src/airline/Cancel.java b/AIRLINE SYSTEM USING JAVA/src/airline/Cancel.java new file mode 100644 index 00000000..519a42b2 --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/src/airline/Cancel.java @@ -0,0 +1,119 @@ +package airline; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.sql.*; + +public class Cancel extends JFrame { + + // Text fields for input + private JTextField passengerNoField, cancellationNoField, cancellationDateField, flightCodeField; + + public static void main(String[] args) { + new Cancel(); + } + + // Constructor to initialize the frame + public Cancel() { + initialize(); + } + + // Method to set up the frame components + private void initialize() { + setTitle("CANCELLATION"); + getContentPane().setBackground(Color.WHITE); + setBounds(100, 100, 860, 500); + setLayout(null); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + // Title label + JLabel cancellationLabel = new JLabel("CANCELLATION"); + cancellationLabel.setFont(new Font("Tahoma", Font.PLAIN, 31)); + cancellationLabel.setBounds(185, 24, 259, 38); + add(cancellationLabel); + + // Image for cancellation + ImageIcon cancelIcon = new ImageIcon(ClassLoader.getSystemResource("icon/cancel.png")); + Image scaledImage = cancelIcon.getImage().getScaledInstance(250, 250, Image.SCALE_DEFAULT); + JLabel cancelImageLabel = new JLabel(new ImageIcon(scaledImage)); + cancelImageLabel.setBounds(470, 100, 250, 250); + add(cancelImageLabel); + + // Labels and text fields for cancellation information + setupLabel("PASSENGER NO", 60, 100, 132, 26); + passengerNoField = createTextField(250, 100); + + setupLabel("CANCELLATION NO", 60, 150, 150, 27); + cancellationNoField = createTextField(250, 150); + + setupLabel("CANCELLATION DATE", 60, 200, 180, 27); + cancellationDateField = createTextField(250, 200); + + setupLabel("FLIGHT CODE", 60, 300, 150, 27); + flightCodeField = createTextField(250, 300); + + // Cancel button + JButton cancelButton = new JButton("CANCEL"); + cancelButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); + cancelButton.setBackground(Color.BLACK); + cancelButton.setForeground(Color.BLACK); + cancelButton.setBounds(250, 350, 150, 30); + add(cancelButton); + + // Action listener for the cancel button + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + handleCancellation(); + } + }); + + // Frame settings + setVisible(true); + setLocation(400, 200); + } + + // Helper method to set up labels + private void setupLabel(String text, int x, int y, int width, int height) { + JLabel label = new JLabel(text); + label.setFont(new Font("Tahoma", Font.PLAIN, 17)); + label.setBounds(x, y, width, height); + add(label); + } + + // Helper method to create text fields + private JTextField createTextField(int x, int y) { + JTextField textField = new JTextField(); + textField.setBounds(x, y, 150, 27); + add(textField); + return textField; + } + + // Method to handle ticket cancellation logic + private void handleCancellation() { + String passengerNo = passengerNoField.getText(); + String cancellationNo = cancellationNoField.getText(); + String cancellationDate = cancellationDateField.getText(); + String flightCode = flightCodeField.getText(); + + try { + // Assuming 'conn' is a class handling database connection + conn connection = new conn(); + String query = "INSERT INTO cancellation (passenger_no, cancellation_no, cancellation_date, flight_code) " + + "VALUES (?, ?, ?, ?)"; + PreparedStatement pstmt = ((Object) connection).prepareStatement(query); + pstmt.setString(1, passengerNo); + pstmt.setString(2, cancellationNo); + pstmt.setString(3, cancellationDate); + pstmt.setString(4, flightCode); + + pstmt.executeUpdate(); + JOptionPane.showMessageDialog(null, "Ticket Canceled"); + setVisible(false); + + } catch (SQLException e) { + e.printStackTrace(); + JOptionPane.showMessageDialog(null, "Error: Failed to cancel the ticket"); + } + } +} diff --git a/AIRLINE SYSTEM USING JAVA/src/airline/Flight_Info.java b/AIRLINE SYSTEM USING JAVA/src/airline/Flight_Info.java new file mode 100644 index 00000000..2ea6e97a --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/src/airline/Flight_Info.java @@ -0,0 +1,128 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package airline; + +/** + * + * @author adrianadewunmi + */ +import net.proteanit.sql.DbUtils; +import java.awt.*; +import java.awt.event.*; +import java.sql.*; +import javax.swing.*; + +public class Flight_Info extends JFrame{ //Second Frame + + private JTable table; + private JTextField textField; + + public static void main(String[] args){ + new Flight_Info().setVisible(true); + } + + public Flight_Info(){ + + getContentPane().setBackground(Color.WHITE); + getContentPane().setFont(new Font("Tahoma", Font.PLAIN, 13)); + + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setSize(860,523); + setLayout(null); + setVisible(true); + + JLabel Fcode = new JLabel("FLIGHT CODE"); + Fcode.setFont(new Font("Tahoma", Font.PLAIN, 17)); + Fcode.setBounds(50, 100, 200, 30); + add(Fcode); + + + JLabel FlightDetails = new JLabel("FLIGHT INFORMATION"); + FlightDetails.setFont(new Font("Tahoma", Font.PLAIN, 31)); + FlightDetails.setForeground(new Color(100, 149, 237)); + FlightDetails.setBounds(50, 20, 570, 35); + add(FlightDetails); + + JButton btnShow = new JButton("SHOW"); + btnShow.setFont(new Font("Tahoma", Font.PLAIN, 20)); + + btnShow.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + + String code = textField.getText(); + + try { + conn c = new conn(); + String str = "select f_code,f_name,src,dst,capacity,class_code,class_name from flight ,sector where f_code = '"+code+"'"; + + ResultSet rs = c.s.executeQuery(str); + table.setModel(DbUtils.resultSetToTableModel(rs)); + + }catch(SQLException e){ + e.printStackTrace(); + } + } + }); + + btnShow.setBounds(220, 150, 120, 30); + add(btnShow); + + table = new JTable(); + table.setBackground(Color.WHITE); + table.setBounds(23, 250, 800, 300); + + JScrollPane pane = new JScrollPane(table); + pane.setBounds(23, 250, 800, 300); + pane.setBackground(Color.WHITE); + add(pane); + + textField = new JTextField(); + textField.setBounds(220, 100, 200, 30); + add(textField); + + JLabel FlightCode = new JLabel("FLIGHT CODE"); + FlightCode.setFont(new Font("Tahoma", Font.PLAIN, 13)); + FlightCode.setBounds(23, 220, 126, 14); + add(FlightCode); + + JLabel FlightName = new JLabel("FLIGHT NAME"); + FlightName.setFont(new Font("Tahoma", Font.PLAIN, 13)); + FlightName.setBounds(145, 220, 120, 14); + add(FlightName); + + JLabel Source = new JLabel("SOURCE"); + Source.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Source.setBounds(275, 220, 104, 14); + add(Source); + + JLabel Destination = new JLabel("DESTINATION"); + Destination.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Destination.setBounds(367, 220, 120, 14); + add(Destination); + + + JLabel Capacity = new JLabel("CAPACITY"); + Capacity.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Capacity.setBounds(497, 220, 111, 14); + add(Capacity); + + JLabel ClassCode = new JLabel("CLASS CODE"); + ClassCode.setFont(new Font("Tahoma", Font.PLAIN, 13)); + ClassCode.setBounds(587, 220, 120, 14); + add(ClassCode); + + JLabel ClassName = new JLabel("CLASS NAME"); + ClassName.setFont(new Font("Tahoma", Font.PLAIN, 13)); + ClassName.setBounds(700, 220, 111, 14); + add(ClassName); + + + setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); + setSize(900,650); + setVisible(true); + setLocation(400,200); + + } +} diff --git a/AIRLINE SYSTEM USING JAVA/src/airline/Journey_Details.java b/AIRLINE SYSTEM USING JAVA/src/airline/Journey_Details.java new file mode 100644 index 00000000..e0f6c126 --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/src/airline/Journey_Details.java @@ -0,0 +1,143 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package airline; + +/** + * + * @author adrianadewunmi + */ +import java.awt.*; +import java.awt.event.*; +import java.sql.*; +import javax.swing.*; +import net.proteanit.sql.DbUtils; + +public class Journey_Details extends JFrame{ //Forth + + JTable table; + JLabel ReservationDetails,Pnrno,Ticketid,Fcode,Jnydate,Jnytime,Source,Destination,label,label1; + JButton Show; + + public static void main(String[] args){ + new Journey_Details(); + } + + public Journey_Details(){ + + setTitle("JOURNEY_DETAILS"); + getContentPane().setBackground(Color.WHITE); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + setLayout(null); + setVisible(true); + + Source = new JLabel("SOURCE"); + Source.setFont(new Font("Tahoma", Font.PLAIN, 19)); + Source.setBounds(60, 100, 150, 27); + add(Source); + + Destination = new JLabel("DESTINATION"); + Destination.setFont(new Font("Tahoma", Font.PLAIN, 19)); + Destination.setBounds(350, 100, 150, 27); + add(Destination); + + + + Show = new JButton("SHOW"); + Show.setBounds(680, 100, 100, 30); + add(Show); + + setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); + + ReservationDetails = new JLabel("JOURNEY DETAILS"); + ReservationDetails.setForeground(Color.BLUE); + ReservationDetails.setFont(new Font("Tahoma", Font.PLAIN, 31)); + ReservationDetails.setBounds(280, 27, 359, 31); + add(ReservationDetails); + + Pnrno = new JLabel("PNR_NO"); + Pnrno.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Pnrno.setBounds(79, 270, 83, 20); + add(Pnrno); + + Ticketid = new JLabel("TICKET_ID"); + Ticketid.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Ticketid.setBounds(172, 270, 71, 20); + add(Ticketid); + + Fcode = new JLabel("F_CODE"); + Fcode.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Fcode.setBounds(297, 270, 103, 20); + add(Fcode); + + Jnydate = new JLabel("JNY_DATE"); + Jnydate.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Jnydate.setBounds(390, 270, 94, 20); + add(Jnydate); + + Jnytime = new JLabel("JNY_TIME"); + Jnytime.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Jnytime.setBounds(494, 270, 83, 20); + add(Jnytime); + + Source = new JLabel("SOURCE"); + Source.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Source.setBounds(613, 270, 94, 20); + add(Source); + + Destination = new JLabel("DESTINATION"); + Destination.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Destination.setBounds(717, 270, 94, 20); + add(Destination); + + String[] items1 = {"BANGALORE", "MUMBAI", "CHENNAI", "PATNA","DELHI","HYDERABAD"}; + JComboBox comboBox = new JComboBox(items1); + comboBox.setBounds(150, 100, 150, 27); + add(comboBox); + + + String[] items2 = {"BANGALORE", "MUMBAI", "CHENNAI", "PATNA","DELHI","HYDERABAD"}; + JComboBox comboBox_1 = new JComboBox(items2); + comboBox_1.setBounds(500, 100, 150, 27); + add(comboBox_1); + + Show.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent ae){ + try{ + String src = (String) comboBox.getSelectedItem(); + String dst = (String) comboBox_1.getSelectedItem(); + + conn c = new conn(); + + String str = "select * from reservation where src = '"+src+"' and dst = '"+dst+"'"; + ResultSet rs= c.s.executeQuery(str); + + table.setModel(DbUtils.resultSetToTableModel(rs)); + /*else{ + JOptionPane.showMessageDialog(null,"No Flights between Source and Destination"); + + } */ + + + }catch(Exception e){} + } + }); + + table = new JTable(); + table.setBounds(38, 310, 770, 130); + add(table); + + JScrollPane pane = new JScrollPane(table); + pane.setBounds(23, 250, 800, 300); + pane.setBackground(Color.WHITE); + add(pane); + + setSize(860,600); + setLocation(400,200); + setVisible(true); + + } +} + diff --git a/AIRLINE SYSTEM USING JAVA/src/airline/Login.java b/AIRLINE SYSTEM USING JAVA/src/airline/Login.java new file mode 100644 index 00000000..cdb288a2 --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/src/airline/Login.java @@ -0,0 +1,106 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package airline; + +/** + * + * @author adrianadewunmi + */ +import java.awt.*; +import javax.swing.*; +import java.awt.event.*; +import java.sql.*; + +public class Login extends JFrame implements ActionListener{ + + JLabel l1,l2; + JTextField t1; + JPasswordField t2; + JButton b1,b2; + + Login(){ + + super("Login"); + + setLayout(null); + + l1 = new JLabel("Username"); + l1.setBounds(40,20,100,30); + add(l1); + + l2 = new JLabel("Password"); + l2.setBounds(40,70,100,30); + add(l2); + + t1=new JTextField(); + t1.setBounds(150,20,150,30); + add(t1); + + t2=new JPasswordField(); + t2.setBounds(150,70,150,30); + add(t2); + + ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icon/second.jpg")); + Image i2 = i1.getImage().getScaledInstance(200,200,Image.SCALE_DEFAULT); + ImageIcon i3 = new ImageIcon(i2); + JLabel l3 = new JLabel(i3); + l3.setBounds(350,10,150,150); + add(l3); + + + b1 = new JButton("Login"); + b1.setBounds(40,140,120,30); + b1.setFont(new Font("serif",Font.BOLD,15)); + b1.addActionListener(this); + b1.setBackground(Color.BLACK); + b1.setForeground(Color.BLACK); + add(b1); + + b2=new JButton("Cancel"); + b2.setBounds(180,140,120,30); + b2.setFont(new Font("serif",Font.BOLD,15)); + b2.setBackground(Color.BLACK); + b2.setForeground(Color.BLACK); + add(b2); + + b2.addActionListener(this); + + + getContentPane().setBackground(Color.WHITE); + + setVisible(true); + setSize(600,300); + setLocation(600,350); + + } + + public void actionPerformed(ActionEvent ae){ + if(ae.getSource()==b1){ + try{ + conn c1 = new conn(); + String u = t1.getText(); + String v = t2.getText(); + + String q = "select * from login where username='"+u+"' and password='"+v+"'"; + + ResultSet rs = c1.s.executeQuery(q); + if(rs.next()){ + new Mainframe().setVisible(true); + setVisible(false); + }else{ + JOptionPane.showMessageDialog(null, "Invalid login"); + setVisible(false); + } + }catch(Exception e){ + e.printStackTrace(); + } + }else if(ae.getSource()==b2){ + System.exit(0); + } + } + public static void main(String[] arg){ + new Login(); + } +} diff --git a/AIRLINE SYSTEM USING JAVA/src/airline/Mainframe.java b/AIRLINE SYSTEM USING JAVA/src/airline/Mainframe.java new file mode 100644 index 00000000..bad6fea0 --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/src/airline/Mainframe.java @@ -0,0 +1,128 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package airline; + +/** + * + * @author adrianadewunmi + */ +import java.awt.*; +import javax.swing.*; +import java.awt.event.*; + + +public class Mainframe extends JFrame{ + + public static void main(String[] args) { + new Mainframe().setVisible(true); + } + + public Mainframe() { + super("AIRLINE RESERVATION MANAGEMENT SYSTEM"); + initialize(); + } + + + private void initialize() { + + setForeground(Color.CYAN); + setLayout(null); + + JLabel NewLabel = new JLabel(""); + NewLabel.setIcon(new ImageIcon(ClassLoader.getSystemResource("icon/front.jpg"))); + NewLabel.setBounds(0, 0, 1920, 990); + add(NewLabel); + + JLabel AirlineManagementSystem = new JLabel("AIR INDIA WELCOMES YOU"); + AirlineManagementSystem.setForeground(Color.BLUE); + AirlineManagementSystem.setFont(new Font("Tahoma", Font.PLAIN, 36)); + AirlineManagementSystem.setBounds(700, 60, 1000, 55); + NewLabel.add(AirlineManagementSystem); + + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu AirlineSystem = new JMenu("AIRLINE SYSTEM"); + AirlineSystem.setForeground(Color.BLUE); + menuBar.add(AirlineSystem); + + JMenuItem FlightDetails = new JMenuItem("FLIGHT_INFO"); + AirlineSystem.add(FlightDetails); + + JMenuItem ReservationDetails = new JMenuItem("ADD_CUSTOMER_DETAILS"); + AirlineSystem.add(ReservationDetails); + + JMenuItem PassengerDetails = new JMenuItem("JOURNEY_DETAILS"); + AirlineSystem.add(PassengerDetails); + + JMenuItem SectorDetails_1 = new JMenuItem("PAYMENT_DETAILS"); + AirlineSystem.add(SectorDetails_1); + + JMenuItem Cancellation = new JMenuItem("CANCELLATION"); + AirlineSystem.add(Cancellation); + + JMenu exit = new JMenu("Logout"); + exit.setForeground(Color.RED); + menuBar.add(exit); + + JMenuItem logout = new JMenuItem("Logout"); + exit.add(logout); + + + FlightDetails.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent ae){ + new Flight_Info(); + } + }); + + ReservationDetails.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent ae){ + try { + new Add_Customer(); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + + PassengerDetails.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent ae){ + try { + new Journey_Details(); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + + SectorDetails_1.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent ae){ + try { + new Payment_Details(); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + + Cancellation.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent ae){ + new Cancel(); + } + }); + + logout.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent ae){ + setVisible(false); + new Login().setVisible(true); + } + }); + + setSize(1950,1090); + setVisible(true); + } +} + diff --git a/AIRLINE SYSTEM USING JAVA/src/airline/Payment_Details.java b/AIRLINE SYSTEM USING JAVA/src/airline/Payment_Details.java new file mode 100644 index 00000000..d3ef01fd --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/src/airline/Payment_Details.java @@ -0,0 +1,126 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package airline; + +/** + * + * @author adrianadewunmi + */ +import java.awt.*; +import java.awt.event.*; +import java.sql.*; +import javax.swing.*; +import net.proteanit.sql.DbUtils; + +public class Payment_Details extends JFrame{ //Fifth + + JTextField textField; + JTable table; + JLabel Sector; + JLabel FlightCode, Capacity, Classcode, Classname, label; + + public static void main(String[] args) { + new Payment_Details(); + } + + public Payment_Details(){ + initialize(); + } + + private void initialize(){ + setTitle("PAYMENT_DETAILS"); + getContentPane().setBackground(Color.WHITE); + setSize(860,486); + setLayout(null); + + JLabel Fcode = new JLabel("PNR NO"); + Fcode.setFont(new Font("Tahoma", Font.PLAIN, 17)); + Fcode.setBounds(60, 160, 150, 26); + add(Fcode); + + textField = new JTextField(); + textField.setBounds(200, 160, 150, 26); + add(textField); + + table = new JTable(); + table.setBounds(45, 329, 766, 87); + add(table); + + JButton Show = new JButton("SHOW"); + Show.setFont(new Font("Tahoma", Font.PLAIN, 17)); + Show.setBackground(Color.BLACK); + Show.setForeground(Color.BLACK); + Show.setBounds(200, 210, 150, 26); + add(Show); + + Sector = new JLabel("PAYMENT DETAILS"); + Sector.setForeground(Color.BLUE); + Sector.setFont(new Font("Tahoma", Font.PLAIN, 31)); + Sector.setBounds(51, 17, 300, 39); + add(Sector); + + FlightCode = new JLabel("PNR_NO"); + FlightCode.setFont(new Font("Tahoma", Font.PLAIN, 13)); + FlightCode.setBounds(84, 292, 108, 26); + add(FlightCode); + + Capacity = new JLabel("PAID_AMOUNT"); + Capacity.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Capacity.setBounds(183, 298, 92, 14); + add(Capacity); + + Classcode = new JLabel("PAY_DATE"); + Classcode.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Classcode.setBounds(322, 294, 101, 24); + add(Classcode); + + Classname = new JLabel("CHEQUE_NO"); + Classname.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Classname.setBounds(455, 298, 114, 14); + add(Classname); + + label = new JLabel(""); + label.setIcon(new ImageIcon(ClassLoader.getSystemResource("icon/payment.png"))); + label.setBounds(425, 15, 239, 272); + add(label); + + JLabel Cardno = new JLabel("CARD_NO"); + Cardno.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Cardno.setBounds(602, 299, 101, 19); + add(Cardno); + + JLabel Phoneno = new JLabel("PHONE_NO"); + Phoneno.setFont(new Font("Tahoma", Font.PLAIN, 13)); + Phoneno.setBounds(712, 294, 86, 24); + add(Phoneno); + + setVisible(true); + + Show.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent ae){ + + try { + String code = textField.getText(); + + conn c = new conn(); + String str = "select pnr_no,paid_amt,pay_date,cheque_no,card_no,ph_no from payment where pnr_no = '"+code+"'"; + + ResultSet rs = c.s.executeQuery(str); + + table.setModel(DbUtils.resultSetToTableModel(rs)); + + }catch(SQLException e) { + e.printStackTrace(); + } + } + }); + + setSize(960,590); + setLocation(400,200); + setVisible(true); + + } +} + diff --git a/AIRLINE SYSTEM USING JAVA/src/airline/conn.java b/AIRLINE SYSTEM USING JAVA/src/airline/conn.java new file mode 100644 index 00000000..b1e0ffa5 --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/src/airline/conn.java @@ -0,0 +1,40 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package airline; + +/** + * + * @author adrianadewunmi + */ +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author adrianadewunmi + */ +public class conn { + + Connection c; + Statement s; + + public conn(){ + try { + Class.forName("com.mysql.cj.jdbc.Driver"); + c = DriverManager.getConnection("jdbc:mysql://localhost:3306/ams", "root", "abc"); + s = c.createStatement(); + } catch (SQLException e) { + System.out.println("Connection Error: " + e); + } catch (ClassNotFoundException ex) { + Logger.getLogger(conn.class.getName()).log(Level.SEVERE, null, ex); + } + } + + +} diff --git a/AIRLINE SYSTEM USING JAVA/src/airline/mysql_commands.txt b/AIRLINE SYSTEM USING JAVA/src/airline/mysql_commands.txt new file mode 100644 index 00000000..e69280c7 --- /dev/null +++ b/AIRLINE SYSTEM USING JAVA/src/airline/mysql_commands.txt @@ -0,0 +1,87 @@ +This file contains information on creating a database for the Airline Management System project. +It's assumed that this process is performed at the command line. + +Tasks: + +1. Create Database +SQL Command: +create database ams; + +2. Switch to the ams database +SQL Command: +use ams; + +3. Create cancellation table +SQL Command: +create table cancellation ( + pnr_no varchar(255), + cancellaton_no varchar(255), + cancellation_data varchar(255), + fli_code varchar(255) +); + +4. Create flight table +SQL Command: +create table flight ( + f_code varchar(255), + f_name varchar(255), + src varchar(255), + dst varchar(255) +); + +5. Create login table +SQL Command: +create table login ( + username varchar(255), + password varchar(255) +); + +6. Create passenger table +SQL Command: +create table passenger ( + pnr_no varchar(255), + address varchar(255), + nationality varchar(255), + name varchar(255), + gender varchar(255), + ph_no varchar(255), + passport_no varchar(255), + fl_code varchar(255) +); + +7. Create payment table +SQL Command: +create table payment ( + pnr_no varchar(255), + ph_no varchar(255), + cheque_no varchar(255), + card_no varchar(255), + paid_amt varchar(255), + pay_date varchar(255) +); + +8. Create reservation table +SQL Command: +create table reservation ( + pnr_no varchar(255), + ticket_id varchar(255), + f_code varchar(255), + jny_date varchar(255), + jny_time varchar(255), + src varchar(255), + dst varchar(255) +); + +9. Create sector table +SQL Command: +create table sector ( + flight_code varchar(255), + capacity varchar(255), + class_code varchar(255), + class_name varchar(255) +); + +10. Insert values into login table +insert into login +values ('admin', '12345'); + diff --git a/AIRLINE SYSTEM USING JAVA/src/icon/cancel.jpg b/AIRLINE SYSTEM USING JAVA/src/icon/cancel.jpg new file mode 100644 index 00000000..e5f2e8d1 Binary files /dev/null and b/AIRLINE SYSTEM USING JAVA/src/icon/cancel.jpg differ diff --git a/AIRLINE SYSTEM USING JAVA/src/icon/cancel.png b/AIRLINE SYSTEM USING JAVA/src/icon/cancel.png new file mode 100644 index 00000000..8081e6ea Binary files /dev/null and b/AIRLINE SYSTEM USING JAVA/src/icon/cancel.png differ diff --git a/AIRLINE SYSTEM USING JAVA/src/icon/emp.png b/AIRLINE SYSTEM USING JAVA/src/icon/emp.png new file mode 100644 index 00000000..eed8cd15 Binary files /dev/null and b/AIRLINE SYSTEM USING JAVA/src/icon/emp.png differ diff --git a/AIRLINE SYSTEM USING JAVA/src/icon/front.jpg b/AIRLINE SYSTEM USING JAVA/src/icon/front.jpg new file mode 100644 index 00000000..b4832f28 Binary files /dev/null and b/AIRLINE SYSTEM USING JAVA/src/icon/front.jpg differ diff --git a/AIRLINE SYSTEM USING JAVA/src/icon/front.png b/AIRLINE SYSTEM USING JAVA/src/icon/front.png new file mode 100644 index 00000000..39ac0e75 Binary files /dev/null and b/AIRLINE SYSTEM USING JAVA/src/icon/front.png differ diff --git a/AIRLINE SYSTEM USING JAVA/src/icon/payment.png b/AIRLINE SYSTEM USING JAVA/src/icon/payment.png new file mode 100644 index 00000000..4cbf3340 Binary files /dev/null and b/AIRLINE SYSTEM USING JAVA/src/icon/payment.png differ diff --git a/AIRLINE SYSTEM USING JAVA/src/icon/second.jpg b/AIRLINE SYSTEM USING JAVA/src/icon/second.jpg new file mode 100644 index 00000000..30f0da2b Binary files /dev/null and b/AIRLINE SYSTEM USING JAVA/src/icon/second.jpg differ diff --git a/AI_Detective_Game/ai_detective_game.py b/AI_Detective_Game/ai_detective_game.py new file mode 100644 index 00000000..c6c90068 --- /dev/null +++ b/AI_Detective_Game/ai_detective_game.py @@ -0,0 +1,105 @@ +import random + +class AIDetective: + def __init__(self): + self.case_solved = False + self.clues = [] + self.suspects = ["Mr. Green", "Mrs. White", "Colonel Mustard", "Miss Scarlet"] + self.weapons = ["Candlestick", "Knife", "Lead Pipe", "Revolver"] + self.rooms = ["Library", "Kitchen", "Ballroom", "Conservatory"] + self.solution = { + "culprit": random.choice(self.suspects), + "weapon": random.choice(self.weapons), + "room": random.choice(self.rooms) + } + +```java +import java.util.*; + +class Main { + public static void main(String[] args) { + new Hang().Generate(); + } +} +``` + +```java +class Hang { + private final Random rd = new Random(); + private final Scanner sc = new Scanner(System.in); + private final String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + private final int alphabetLength = alphabet.length(); + private final char[] word = new char[6]; // Random 6-letter word + private final char[] displayedWord = {'_', '_', '_', '_', '_', '_'}; // Guessed letters display + private final int maxAttempts = 6; // Maximum attempts + + void Generate() { + // Generate a random 6-letter word + for (int i = 0; i < word.length; i++) { + word[i] = alphabet.charAt(rd.nextInt(alphabetLength)); + } + + System.out.println("Guess the 6-letter word:"); + displayWord(); + Function(); + } +} +``` + + void displayWord() { + // Display the current state of the guessed word + for (int i = 0; i < 6; i++) { + System.out.print(c1[i] + " "); + } + System.out.println(); + } + + + + + + + + ```python +def get_clue(self): + if len(self.clues) < 5: + new_clue_options = [ + f"I found traces of {self.solution['weapon'].lower()} in the {self.solution['room'].lower()}.", + f"{self.solution['culprit']} was seen near the {self.solution['room'].lower()} earlier.", + f"A witness heard a commotion in the {self.solution['room'].lower()}.", + f"{self.solution['culprit']} had a motive for the crime.", + f"The {self.solution['weapon'].lower()} seems to be missing from its usual place." + ] + new_clue = random.choice(new_clue_options) + if new_clue not in self.clues: + self.clues.append(new_clue) + return new_clue + return self.get_clue() + return random.choice(self.clues) + +def solve_case(self, culprit, weapon, room): + if culprit == self.solution["culprit"] and weapon == self.solution["weapon"] and room == self.solution["room"]: + self.case_solved = True + return "Congratulations! You've solved the case!" +``` + else: + return "I'm afraid that's not correct. Let's continue our investigation." + + # def play(self): + # self.introduce_game() + # while not self.case_solved: + # user_input = input("What would you like to do? ").strip().lower() + # if user_input == "solve": + # culprit = input("Who is the culprit? ") + # weapon = input("What is the murder weapon? ") + # room = input("In which room did the murder occur? ") + # print(self.solve_case(culprit, weapon, room)) + # elif user_input == "quit": + # print("Thank you for playing. The case remains unsolved.") + # break + # else: + # print(self.get_clue()) + +if __name__ == "__main__": + game = AIDetective() + game.play() diff --git a/Alarm-Clock/Alarm.clock.py b/Alarm-Clock/Alarm.clock.py new file mode 100644 index 00000000..4c0f3d87 --- /dev/null +++ b/Alarm-Clock/Alarm.clock.py @@ -0,0 +1,30 @@ +import time +import winsound # This is specific to Windows for sound; replace with another method for different OS. + +def set_alarm(alarm_time): + while True: + current_time = time.strftime("%H:%M:%S") + print(f"Current time: {current_time}", end="\r") + if current_time == alarm_time: + print("\nTime to wake up!") + # Play a sound (only works on Windows) + winsound.Beep(1000, 1000) # Frequency (Hz), Duration (ms) + break + time.sleep(1) # Check every second + +def main(): + print("Welcome to the Alarm Clock!") + alarm_time = input("Set the alarm time (HH:MM:SS, 24-hour format): ") + + # Validate input time format + try: + time.strptime(alarm_time, "%H:%M:%S") + except ValueError: + print("Incorrect time format. Please enter in HH:MM:SS format.") + return + + print(f"Alarm set for {alarm_time}.") + set_alarm(alarm_time) + +if __name__ == "__main__": + main() diff --git a/Alarm-Clock/files/9311248.png b/Alarm-Clock/files/9311248.png new file mode 100644 index 00000000..2d830b89 Binary files /dev/null and b/Alarm-Clock/files/9311248.png differ diff --git a/Alarm-Clock/files/clock.svg b/Alarm-Clock/files/clock.svg new file mode 100644 index 00000000..9d274a68 --- /dev/null +++ b/Alarm-Clock/files/clock.svg @@ -0,0 +1,3 @@ + + + diff --git a/Alarm-Clock/files/ringtone.mp3 b/Alarm-Clock/files/ringtone.mp3 new file mode 100644 index 00000000..8ccdbf00 Binary files /dev/null and b/Alarm-Clock/files/ringtone.mp3 differ diff --git a/Alarm-Clock/index.html b/Alarm-Clock/index.html new file mode 100644 index 00000000..2da55cbd --- /dev/null +++ b/Alarm-Clock/index.html @@ -0,0 +1,33 @@ +```html + + + + + + Alarm Clock + + + + + + + if (timeDifference > 0) { + setTimeout(() => { + alarmStatus.textContent = 'Alarm ringing!'; + alert("Wake up!"); // Replace with preferred alarm method. + }, timeDifference); + + alarmStatus.textContent = `Alarm set for ${alarmTime.toLocaleTimeString()}`; + } else { + alarmStatus.textContent = "Please set a future time."; + } + }); + + setInterval(() => { + const now = new Date(); + timeDisplay.textContent = now.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit', second:'2-digit'}); + }, 1000); + + + +``` diff --git a/Alarm-Clock/style.css b/Alarm-Clock/style.css new file mode 100644 index 00000000..4fece284 --- /dev/null +++ b/Alarm-Clock/style.css @@ -0,0 +1,66 @@ +body { + font-family: Arial, sans-serif; + background-color: #f0f0f0; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; +} + +.wrapper { + background-color: #fff; + padding: 20px; + border-radius: 10px; + box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1); + text-align: center; + width: 300px; +} + +img { + width: 200px; + margin-bottom: 20px; +} + +h1 { + font-size: 2.5rem; + margin-bottom: 20px; + color: #333; +} + +.content { + display: flex; + justify-content: space-between; + margin-bottom: 20px; +} + +.column { + display: flex; + flex-direction: column; +} + +select { + padding: 5px; + font-size: 1rem; + margin-top: 5px; +} + +button { + background-color: #4CAF50; + color: white; + border: none; + padding: 10px 20px; + font-size: 1rem; + border-radius: 5px; + cursor: pointer; +} + +button:hover { + background-color: #45a049; +} + +#alarmStatus { + margin-top: 15px; + font-size: 1rem; + color: #555; +} \ No newline at end of file diff --git a/Amazon product availability checker/Sample Output.md b/Amazon product availability checker/Sample Output.md new file mode 100644 index 00000000..74212941 --- /dev/null +++ b/Amazon product availability checker/Sample Output.md @@ -0,0 +1,11 @@ +Tracking.... +Processing: http://www.amazon.in/dp/B077PWK5BT +Only 1 left in stock. +Tracking.... +Processing: http://www.amazon.in/dp/B077PWK5BT +Only 1 left in stock. +Tracking.... +Processing: http://www.amazon.in/dp/B077PWK5BT +Only 1 left in stock. + +Note that the program might throw an error (Critical security alert/Sign-in attempt was blocked) while sending the mail to the user, which can be handled by modifying the security setting in the mail application you are using. \ No newline at end of file diff --git a/Amazon product availability checker/azp.py b/Amazon product availability checker/azp.py new file mode 100644 index 00000000..19d2c483 --- /dev/null +++ b/Amazon product availability checker/azp.py @@ -0,0 +1,94 @@ +# Python script for Amazon product availability checker +# importing libraries +from lxml import html +import requests +from time import sleep +import time +import schedule +import smtplib + +# Email id for who want to check availability +receiver_email_id = "EMAIL_ID_OF_USER" + + +def check(url): + headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36'} + + # adding headers to show that you are + # a browser who is sending GET request + page = requests.get(url, headers = headers) + for i in range(20): + # because continuous checks in + # milliseconds or few seconds + # blocks your request + sleep(3) + + # parsing the html content + doc = html.fromstring(page.content) + + # checking availability + XPATH_AVAILABILITY = '//div[@id ="availability"]//text()' + RAw_AVAILABILITY = doc.xpath(XPATH_AVAILABILITY) + AVAILABILITY = ''.join(RAw_AVAILABILITY).strip() if RAw_AVAILABILITY else None + return AVAILABILITY + + +def sendemail(ans, product): + GMAIL_USERNAME = "YOUR_GMAIL_ID" + GMAIL_PASSWORD = "YOUR_GMAIL_PASSWORD" + + recipient = receiver_email_id + body_of_email = ans + email_subject = product + ' product availability' + + # creates SMTP session + s = smtplib.SMTP('smtp.gmail.com', 587) + + # start TLS for security + s.starttls() + + # Authentication + s.login(GMAIL_USERNAME, GMAIL_PASSWORD) + + # message to be sent + headers = "\r\n".join(["from: " + GMAIL_USERNAME, + "subject: " + email_subject, + "to: " + recipient, + "mime-version: 1.0", + "content-type: text/html"]) + + content = headers + "\r\n\r\n" + body_of_email + s.sendmail(GMAIL_USERNAME, recipient, content) + s.quit() + + +def ReadAsin(): + # Asin Id is the product Id which + # needs to be provided by the user + Asin = 'B077PWK5BT' + url = "http://www.amazon.in/dp/" + Asin + print ("Processing: "+url) + ans = check(url) + arr = [ + 'Only 1 left in stock.', + 'Only 2 left in stock.', + 'In stock.'] + print(ans) + if ans in arr: + # sending email to user if + # in case product available + sendemail(ans, Asin) + +# scheduling same code to run multiple +# times after every 1 minute +def job(): + print("Tracking....") + ReadAsin() + +schedule.every(1).minutes.do(job) + +while True: + + # running all pending tasks/jobs + schedule.run_pending() + time.sleep(1) diff --git a/Amazon product availability checker/required modules.md b/Amazon product availability checker/required modules.md new file mode 100644 index 00000000..850930ab --- /dev/null +++ b/Amazon product availability checker/required modules.md @@ -0,0 +1,5 @@ +-> requests: Used to make HTTP get and post requests +-> time: Used to find current time, wait, sleep +-> schedule: Used to schedule a function to run again after intervals. It is similar to “setInterval” functionality in JavaScript. +-> smptlib: Used to send email using Python. + diff --git a/Android-System-/main.js b/Android-System-/main.js index 766ba12c..b4458f2d 100644 --- a/Android-System-/main.js +++ b/Android-System-/main.js @@ -20,31 +20,23 @@ function dial() { }); } -const url = `https://api.weatherbit.io/v2.0/current?city=Belgrade&key=fe7369b6e9d24781a30923dca5f093f1`; -function allImages() { - const imgWrap = document.querySelector('.imgWrap'); - for (let index = 1; index < 14; index++) { - imgWrap.innerHTML += ``; - } -} +```javascript function getWeather() { - fetch(url) - .then(response => response.json()) - .then(response => { - response.data.forEach(item => { - const weatherIcon = document.querySelector('.weatherIcon'); - const weatherCity = document.querySelector('.weatherCity'); - const weatherTemp = document.querySelector('.weatherTemp'); - const icon = `https://www.weatherbit.io/static/img/icons/${item.weather.icon}.png`; - weatherIcon.innerHTML = ``; - weatherCity.innerHTML = item.city_name; - weatherTemp.innerHTML = item.temp + ' ° C'; - }); - }) - .catch(err => console.log(err)); + fetch(url) + .then(response => response.json()) + .then(data => { + data.data.forEach(item => { + const iconUrl = `https://www.weatherbit.io/static/img/icons/${item.weather.icon}.png`; + document.querySelector('.weatherIcon').innerHTML = ``; + document.querySelector('.weatherCity').innerHTML = item.city_name; + document.querySelector('.weatherTemp').innerHTML = item.temp + ' ° C'; + }); + }) + .catch(err => console.log(err)); } +``` function homePage() { loginPageContainer.innerHTML = ` @@ -578,4 +570,5 @@ function battery() { } battery(); -setInterval(battery, 4000); \ No newline at end of file + +setInterval(battery, 4000); diff --git a/Anti-Malware_application/README.md b/Anti-Malware_application/README.md new file mode 100644 index 00000000..29fba0cd --- /dev/null +++ b/Anti-Malware_application/README.md @@ -0,0 +1,26 @@ +# A ML-based anti-malware program written in Python # + +

I first created this project for a competition. I had to learn a lot of new stuff and take inspiration(and a bit of code) from others who had tried similar projects before. This project uses customtkinter and scikit-learn to handle the GUI and ML operations respectively. It utilizes a decision tree classifier to classify files as malware or benign. It can classify a single file or all the files in a folder. It currently only works with executable files(but can be modified to work with other file types). Using the PEfile library, this program extracts information from the executable file(s) to classify them. + + +Note: It is not perfect and is prone to a lot of false-positives, but I hardly encountered any false-negatives. I think this is due to the overfitting of the model. + +### Installation and execution + +1) Install the necessary libraries +``` +pip3 install customtkinter +pip3 install tkinter +pip3 install pandas +pip3 install sklearn +pip3 install pefile +pip3 install numpy + +``` + +2) Execute the program +``` +python3 anti-malware.py +``` + +Happy learning! \ No newline at end of file diff --git a/Anti-Malware_application/anti-malware.py b/Anti-Malware_application/anti-malware.py new file mode 100644 index 00000000..cf765cda --- /dev/null +++ b/Anti-Malware_application/anti-malware.py @@ -0,0 +1,239 @@ +################################################################################# +### Author: Pyerie # +### Application: A not-so-accurate ML based anti-malware solution # +################################################################################# + +print("[+] Loading.... ") +import customtkinter +from tkinter.filedialog import * +from tkinter import * +import pefile +import numpy as np +import pandas as pd +from sklearn.tree import DecisionTreeClassifier +from sklearn.model_selection import train_test_split +from sklearn import metrics +import os + + + +dataset = pd.read_csv('database3.csv') +X = dataset.drop(['legitimate'],axis=1).values + +y = dataset['legitimate'].values + + + +X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1) +clf = DecisionTreeClassifier() + + +y_test = y_test.reshape(-1,1) +for i in range(0, 10): + clf = clf.fit(X_train,y_train) +res1 = clf.predict(X_test) +accuracy = metrics.accuracy_score(y_test, res1) +accuracy = str(accuracy)[2:4] + "%" +print("Accuracy: "+accuracy) + + +customtkinter.set_appearance_mode("dark") +customtkinter.set_default_color_theme("dark-blue") + + +window = Tk() +screen_width = window.winfo_screenwidth() +screen_height = window.winfo_screenheight() +window.geometry(str(screen_width)+"x"+str(screen_height)) +window.title("eSuraksha") +window['bg'] = "#121212" +def extract_features(file): + features = [] + + + + try: + + pe_obj = pefile.PE(file, fast_load=True) + except pefile.PEFormatError as error: + print("Not PE file!") +features.append(pe_obj.OPTIONAL_HEADER.DATA_DIRECTORY[6].Size) +features.append(pe_obj.OPTIONAL_HEADER.DATA_DIRECTORY[6].VirtualAddress) +features.append(pe_obj.OPTIONAL_HEADER.MajorImageVersion) +features.append(pe_obj.OPTIONAL_HEADER.MajorOperatingSystemVersion) +features.append(pe_obj.OPTIONAL_HEADER.DATA_DIRECTORY[0].VirtualAddress) +features.append(pe_obj.OPTIONAL_HEADER.DATA_DIRECTORY[0].Size) +try: + features.append(pe_obj.OPTIONAL_HEADER.DATA_DIRECTORY[12].VirtualAddress) +except: + features.append(0) +features.append(pe_obj.OPTIONAL_HEADER.DATA_DIRECTORY[2].Size) +features.append(pe_obj.OPTIONAL_HEADER.MajorLinkerVersion) +features.append(pe_obj.FILE_HEADER.NumberOfSections) +features.append(pe_obj.OPTIONAL_HEADER.SizeOfStackReserve) +features.append(pe_obj.OPTIONAL_HEADER.DllCharacteristics) +features.append(pe_obj.OPTIONAL_HEADER.AddressOfEntryPoint) +features.append(pe_obj.OPTIONAL_HEADER.ImageBase) + + + + + + return features + +toplevel_created = False + +toplevel2_created = False + +def single_file(): + + global toplevel_created + global toplevel2_created + global single_file_top + if toplevel_created == "True": + single_file_top.destroy() + toplevel_created = "False" + elif toplevel_created == "False": + pass + + if toplevel2_created == "True": + many_files.destroy() + toplevel2_created = "False" + elif toplevel2_created == "False": + pass + + single_file_top = Toplevel(window) + single_file_top.geometry("350x200") + customtkinter.set_appearance_mode("dark") + customtkinter.set_default_color_theme("dark-blue") + single_file_top['bg'] = "#121212" + single_file_top.title("Scan a single file") + toplevel_created = "True" + result = customtkinter.CTkLabel(single_file_top, text="Loading...") + result.pack() + + file_path = askopenfilename() + try: + features_extracted = extract_features(str(file_path)) + not_pe = False + except UnboundLocalError as e: + not_pe = True + result.after(0, result.destroy) + benign_l = customtkinter.CTkLabel(single_file_top, text="Not PE file!") + benign_l.pack() + toplevel2_created = False + + if not_pe != True: + data_of_sample = np.array(features_extracted) + data_of_sample = data_of_sample.reshape(1,-1) + + + prediction = clf.predict(data_of_sample) + + + if prediction == 1: + result.after(0, result.destroy) + + malware_l = customtkinter.CTkLabel(single_file_top, fg_color="red", text="ML model detected malware!") + malware_l.pack() + + + elif prediction == 0: + result.after(0, result.destroy) + benign_l = customtkinter.CTkLabel(single_file_top, fg_color="green", text="No malware detected!") + benign_l.pack() + + +def scan_many(): + + + global toplevel2_created + global toplevel_created + global many_files + + if toplevel2_created == "True": + many_files.destroy() + toplevel2_created = "False" + elif toplevel2_created == "False": + pass + + if toplevel_created == "True": + single_file_top.destroy() + toplevel_created = "False" + elif toplevel_created == "False": + pass + + many_files = Toplevel(window) + many_files.geometry("350x200") + customtkinter.set_appearance_mode("dark") + customtkinter.set_default_color_theme("dark-blue") + many_files['bg'] = "#121212" + many_files.title("Scan a directory") + toplevel2_created = "True" + result2 = customtkinter.CTkLabel(many_files, text="Loading...") + result2.pack() + malware_many = [] + directory = askdirectory() + global extracted + for root, directory, files in os.walk(str(directory)): + for name_of_file in files: + path = os.path.join(str(root),str(name_of_file)) + + formats_of_pe = [".acm" , ".ax" , ".cpl" , ".dll" , ".drv" , ".efi" , ".exe" , ".mui" , ".ocx" , ".scr" , ".sys" , ".tsp", ".bin"] + for format_i in formats_of_pe: + if name_of_file.endswith(format_i) == True: + + extracted = 1 + try: + + features_of_many = extract_features(str(path)) + except UnboundLocalError as e: + pass + break + + else: + extracted = 0 + + + + if extracted == 1: + data_for_many = np.array(features_of_many) + data_for_many = data_for_many.reshape(1,-1) + + prediction_for_many = clf.predict(data_for_many) + + + if prediction_for_many == 1: + malware_many.append(str(path)) + + + if len(malware_many) != 0: + result2.after(0, result2.destroy) + malware_label2 = customtkinter.CTkLabel(many_files,text="Malware found: ") + malware_label2.pack() + malware_text_box = customtkinter.CTkTextbox(many_files) + for_text_box = '' + + for name_of_malware in malware_many: + for_text_box += "".join([name_of_malware, '\n------------------------------------------']) + + + + malware_text_box.insert('0.0',for_text_box) + malware_text_box.configure(state="disabled") + malware_text_box.pack() + + + + + elif len(malware_many) == 0: + result2.after(0, result2.destroy) + benign_label = customtkinter.CTkLabel(many_files,text="No malware found!") + benign_label.pack() + +button1 = customtkinter.CTkButton(master=window, command=single_file,text="Scan a single file") +button1.pack() +button2 = customtkinter.CTkButton(master=window, command=scan_many, text="Scan a folder") +button2.pack() + +window.mainloop() diff --git a/Anti-Malware_application/database3.csv b/Anti-Malware_application/database3.csv new file mode 100755 index 00000000..b0148daa --- /dev/null +++ b/Anti-Malware_application/database3.csv @@ -0,0 +1,639 @@ +debug_size,debug_RVA,image_version,os_version,export_RVA,export_size,IATRVA,res_size,linker_version,number_of_sections,stack_reserve_size,dll,address_of_entrypoint,image_base,legitimate +0,0,0,4,0,0,0,0,5,3,1048576,0,4096,142606336,1 +0,0,0,4,0,0,0,1504,11,3,4194304,34112,0,5368709120,1 +0,0,0,4,0,0,0,1504,11,3,4194304,34112,0,5368709120,1 +0,0,0,4,0,0,0,1512,8,3,4194304,34112,0,4194304,1 +0,0,0,4,0,0,0,1512,8,3,4194304,34112,0,4194304,1 +0,0,0,4,0,0,0,156,6,3,1048576,0,129744,4194304,1 +0,0,0,4,0,0,0,163500,2,8,1048576,0,361688,4194304,1 +0,0,0,4,0,0,0,202776,8,4,1048576,1536,83152,4194304,1 +0,0,0,4,0,0,0,202776,8,4,1048576,1536,83152,4194304,1 +0,0,0,4,0,0,0,232,8,3,1048576,1536,75280,4194304,1 +0,0,0,4,0,0,0,232,8,3,1048576,1536,75280,4194304,1 +0,0,0,4,0,0,0,33908,2,10,1048576,0,794730,4194304,1 +0,0,0,4,0,0,0,371784,6,3,1048576,34112,0,4194304,1 +0,0,0,4,0,0,0,5120,2,8,1048576,0,32996,4194304,1 +0,0,0,4,0,0,0,5120,2,8,1048576,0,32996,4194304,1 +0,0,0,4,0,0,0,552,8,4,1048576,1536,42288,4194304,1 +0,0,0,4,0,0,168460,0,2,17,2097152,352,5376,4194304,1 +0,0,0,4,0,0,168460,0,2,17,2097152,352,5376,4194304,1 +0,0,0,4,0,0,24576,467844,6,4,1048576,0,21247,4194304,1 +0,0,0,4,0,0,24576,467844,6,4,1048576,0,21247,4194304,1 +0,0,0,4,0,0,24576,87868,7,4,1048576,0,5467,4194304,1 +0,0,0,4,0,0,24576,87868,7,4,1048576,0,5467,4194304,1 +0,0,0,4,0,0,28672,0,6,3,1048576,0,10124,4194304,1 +0,0,0,4,0,0,32784,2400,5,4,1048576,0,16896,4194304,1 +0,0,0,4,0,0,32784,2400,5,4,1048576,0,16896,4194304,1 +0,0,0,4,0,0,335872,1512,8,5,1048576,34112,335882,4194304,1 +0,0,0,4,0,0,335872,1512,8,5,1048576,34112,335882,4194304,1 +0,0,0,4,0,0,4096,29980,8,4,1048576,1024,15088,4194304,1 +0,0,0,4,0,0,4096,29980,8,4,1048576,1024,15088,4194304,1 +0,0,0,4,0,0,4096,48367,6,3,1048576,0,4524,4194304,1 +0,0,0,4,0,0,4096,48367,6,3,1048576,0,4524,4194304,1 +0,0,0,4,0,0,40960,3515476,6,4,1048576,0,39446,4194304,1 +0,0,0,4,0,0,5308416,1520,8,5,1048576,34112,5308426,4194304,1 +0,0,0,4,0,0,5308416,1520,8,5,1048576,34112,5308426,4194304,1 +0,0,0,4,0,0,8192,1544,48,3,1048576,34144,11014,4194304,0 +0,0,0,4,0,0,8192,1792,8,3,1048576,34112,391150,4194304,1 +0,0,0,4,0,0,8192,1792,8,3,1048576,34112,391150,4194304,1 +0,0,0,4,0,0,8192,24192,11,3,1048576,34112,443086,4194304,1 +0,0,0,4,0,0,8192,36168,5,5,1048576,0,4096,4194304,1 +0,0,0,4,0,0,8192,36168,5,5,1048576,0,4096,4194304,1 +0,0,0,4,0,0,8192,39758,48,3,1048576,34112,143694,4194304,1 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,4,0,0,8192,796,6,4,1048576,34112,1520718,4194304,1 +0,0,0,4,0,0,90112,1504,11,5,1048576,34112,90122,4194304,1 +0,0,0,4,121319424,6601,121334772,392,2,13,2097152,352,5344,5368709120,0 +0,0,0,4,12880,405,12288,0,6,4,1048576,0,8369,268435456,1 +0,0,0,4,12880,405,12288,0,6,4,1048576,0,8369,268435456,1 +0,0,0,4,13888,128,12288,0,8,5,1048576,0,10560,268435456,1 +0,0,0,4,13888,128,12288,0,8,5,1048576,0,10560,268435456,1 +0,0,0,4,1433600,181,0,105472,5,8,1048576,0,5136,4194304,1 +0,0,0,4,1433600,181,0,105472,5,8,1048576,0,5136,4194304,1 +0,0,0,4,16576,240,16384,15568,6,5,1048576,0,13088,268435456,1 +0,0,0,4,16576,240,16384,15568,6,5,1048576,0,13088,268435456,1 +0,0,0,4,16576,248,16384,18472,6,5,1048576,0,13104,268435456,1 +0,0,0,4,16576,248,16384,18472,6,5,1048576,0,13104,268435456,1 +0,0,0,4,211136,1458,184320,0,8,4,1048576,0,8390,536870912,1 +0,0,0,4,23248,85,20480,0,7,4,1048576,0,16837,268435456,1 +0,0,0,4,23248,85,20480,0,7,4,1048576,0,16837,268435456,1 +0,0,0,4,28000,96,24576,0,6,4,1048576,0,21066,268435456,1 +0,0,0,4,28000,96,24576,0,6,4,1048576,0,21066,268435456,1 +0,0,0,4,398336,1452,344064,0,8,5,1048576,0,247712,536870912,1 +0,0,0,4,398336,1452,344064,0,8,5,1048576,0,247712,536870912,1 +0,0,0,4,47696,130,45056,0,8,4,1048576,0,43951,268435456,1 +0,0,0,4,74624,121,61440,0,8,5,1048576,0,13664,1342177280,1 +0,0,0,4,74624,121,61440,0,8,5,1048576,0,13664,1342177280,1 +0,0,0,4,9088,123,8192,0,8,4,1048576,1024,7941,1342177280,1 +0,0,0,5,0,0,0,0,10,3,1048576,33024,414720,4194304,1 +0,0,0,5,0,0,0,0,10,3,1048576,33024,414720,4194304,1 +0,0,0,5,0,0,0,1324,10,3,1048576,33088,924368,4194304,1 +0,0,0,5,0,0,0,1324,10,3,1048576,33088,924368,4194304,1 +0,0,0,5,0,0,102400,0,9,4,10000000,33088,89711,4194304,1 +0,0,0,5,0,0,102400,0,9,4,10000000,33088,89711,4194304,1 +0,0,0,5,0,0,110592,26064,9,4,1048576,32768,65089,4194304,1 +0,0,0,5,0,0,110592,26064,9,4,1048576,32768,65089,4194304,1 +0,0,0,5,0,0,114688,0,9,4,10000000,33088,104257,4194304,1 +0,0,0,5,0,0,122880,0,9,4,10000000,33088,107951,4194304,1 +0,0,0,5,0,0,122880,0,9,4,10000000,33088,107951,4194304,1 +0,0,0,5,0,0,176128,0,9,4,10000000,33088,169999,4194304,1 +0,0,0,5,0,0,176128,0,9,4,10000000,33088,169999,4194304,1 +0,0,0,5,0,0,176128,1000,10,6,1048576,33088,106848,5368709120,1 +0,0,0,5,0,0,176128,1000,10,6,1048576,33088,106848,5368709120,1 +0,0,0,5,0,0,20480,436,9,5,10000000,33088,16053,4194304,1 +0,0,0,5,0,0,20480,436,9,5,10000000,33088,16053,4194304,1 +0,0,0,5,0,0,204800,0,10,4,1048576,33088,12982,4194304,1 +0,0,0,5,0,0,27068,5352,7,4,1048576,0,5486,4194304,1 +0,0,0,5,0,0,27112,5600,9,4,2097152,0,5540,4194304,1 +0,0,0,5,0,0,28672,2816,10,4,1048576,33024,8657,4194304,1 +0,0,0,5,0,0,28672,2816,10,4,1048576,33024,8657,4194304,1 +0,0,0,5,0,0,28672,436,10,6,1048576,33088,7976,5368709120,1 +0,0,0,5,0,0,28672,436,10,6,1048576,33088,7976,5368709120,1 +0,0,0,5,0,0,28672,8076,10,4,1048576,33024,8657,4194304,1 +0,0,0,5,0,0,28672,8076,10,4,1048576,33024,8657,4194304,1 +0,0,0,5,0,0,32768,436,9,5,10000000,33088,31181,4194304,1 +0,0,0,5,0,0,339968,0,10,4,1048576,33088,59428,4194304,1 +0,0,0,5,0,0,339968,0,10,4,1048576,33088,59428,4194304,1 +0,0,0,5,0,0,36864,138500,9,4,1048576,32768,9680,4194304,1 +0,0,0,5,0,0,393316,17832,10,3,1048576,33024,393495,4194304,1 +0,0,0,5,0,0,393316,17832,10,3,1048576,33024,393495,4194304,1 +0,0,0,5,0,0,4096,18456,10,3,1048576,32768,22485,4194304,1 +0,0,0,5,0,0,462848,149002,10,5,1048576,0,316285,4194304,1 +0,0,0,5,0,0,73728,0,9,3,1048576,32768,29764,4194304,1 +0,0,0,5,0,0,73728,0,9,3,1048576,32768,29764,4194304,1 +0,0,0,5,0,0,77824,3708,9,4,1048576,32768,30134,4194304,1 +0,0,0,5,0,0,77824,3708,9,4,1048576,32768,30134,4194304,1 +0,0,0,5,0,0,81920,784,14,6,1048576,33088,11183,4194304,1 +0,0,0,5,0,0,81920,784,14,6,1048576,33088,11183,4194304,1 +0,0,0,5,0,0,81920,864,14,6,1048576,33088,11706,4194304,1 +0,0,0,5,0,0,81920,864,14,6,1048576,33088,11706,4194304,1 +0,0,0,5,0,0,90112,0,10,3,1048576,0,49257,4194304,1 +0,0,0,5,0,0,90112,0,10,3,1048576,0,49257,4194304,1 +0,0,0,5,0,0,90112,0,10,3,1048576,0,68474,4194304,1 +0,0,0,5,0,0,90112,0,10,4,1048576,320,39389,268435456,1 +0,0,0,5,0,0,90112,0,10,4,1048576,320,39389,268435456,1 +0,0,0,5,0,0,90112,436,9,5,10000000,33088,82305,4194304,1 +0,0,0,5,0,0,90112,436,9,5,10000000,33088,82305,4194304,1 +0,0,0,5,0,0,94208,0,10,3,1048576,0,42247,4194304,1 +0,0,0,5,0,0,94208,0,10,3,1048576,0,42247,4194304,1 +0,0,0,5,0,0,94208,0,10,3,1048576,0,84734,4194304,1 +0,0,0,5,0,0,98304,0,10,3,1048576,0,59417,4194304,1 +0,0,0,5,0,0,98304,0,10,3,1048576,0,59544,4194304,1 +0,0,0,5,0,0,98304,0,10,3,1048576,0,59544,4194304,1 +0,0,0,5,112064,213,90112,0,10,4,1048576,320,52370,268435456,1 +0,0,0,5,112064,213,90112,0,10,4,1048576,320,52370,268435456,1 +0,0,0,5,129392,71,98304,436,10,6,1048576,320,39544,6442450944,1 +0,0,0,5,129392,71,98304,436,10,6,1048576,320,39544,6442450944,1 +0,0,0,5,161136,7233,135168,1088,9,5,10000000,0,133948,268435456,1 +0,0,0,5,161136,7233,135168,1088,9,5,10000000,0,133948,268435456,1 +0,0,0,5,202576,1609,167936,1040,9,5,1048576,0,162866,268435456,1 +0,0,0,5,202576,1609,167936,1040,9,5,1048576,0,162866,268435456,1 +0,0,0,5,21568,218,16384,0,9,4,10000000,320,11674,268435456,1 +0,0,0,5,39760,128,32768,436,9,5,1048576,320,5793,268435456,1 +0,0,0,5,39760,128,32768,436,9,5,1048576,320,5793,268435456,1 +0,0,0,5,56352,4343,53248,0,9,4,1048576,0,49832,268435456,1 +0,0,0,5,58864,1436,40960,912,9,5,1048576,0,38872,1514930176,1 +0,0,0,5,58864,1436,40960,912,9,5,1048576,0,38872,1514930176,1 +0,0,0,5,715024,92326,552960,1088,9,5,10000000,0,548935,268435456,1 +0,0,0,5,715024,92326,552960,1088,9,5,10000000,0,548935,268435456,1 +0,0,0,5,87312,54,53248,247608,10,5,1048576,320,32057,268435456,1 +0,0,0,6,0,0,0,2064,6,3,262144,34112,100624,319815680,1 +0,0,0,6,0,0,0,2064,6,3,262144,34112,100624,319815680,1 +0,0,1,4,0,0,0,69632,2,5,327680,0,4568,4194304,1 +0,0,1,4,0,0,0,69632,2,5,327680,0,4568,4194304,1 +0,0,1,4,0,0,4096,104264,6,3,1048576,0,5420,4194304,1 +0,0,1,4,0,0,4096,104264,6,3,1048576,0,5420,4194304,1 +0,0,1,4,0,0,4096,111432,6,3,1048576,0,5420,4194304,1 +0,0,1,4,0,0,4096,111432,6,3,1048576,0,5420,4194304,1 +0,0,1,4,0,0,4096,2264,6,3,1048576,0,4596,4194304,1 +0,0,1,4,0,0,4096,2264,6,3,1048576,0,4596,4194304,1 +0,0,1,4,0,0,4096,305992,6,3,1048576,0,5420,4194304,1 +0,0,1,4,0,0,4096,305992,6,3,1048576,0,5420,4194304,1 +0,0,1,4,0,0,4096,306504,6,3,1048576,0,5420,4194304,1 +0,0,1,4,0,0,4096,306504,6,3,1048576,0,5420,4194304,1 +0,0,1,4,0,0,4096,307528,6,3,1048576,0,5420,4194304,1 +0,0,1,4,0,0,4096,307528,6,3,1048576,0,5420,4194304,1 +0,0,1,4,0,0,4096,8048,6,3,1048576,0,5168,4194304,1 +0,0,1,4,0,0,4096,8048,6,3,1048576,0,5168,4194304,1 +0,0,1,4,13488,265,12288,0,7,4,10000000,0,7832,268435456,1 +0,0,1,4,13488,265,12288,0,7,4,10000000,0,7832,268435456,1 +0,0,1,4,15312,71,12288,0,7,4,1048576,0,8804,268435456,1 +0,0,1,4,15312,71,12288,0,7,4,1048576,0,8804,268435456,1 +0,0,1,4,43488,6680,40960,0,7,4,1048576,0,40195,268435456,1 +0,0,1,4,43488,6680,40960,0,7,4,1048576,0,40195,268435456,1 +0,0,1,4,56272,6927,53248,0,7,4,10000000,0,50056,268435456,1 +0,0,1,4,79024,16065,73728,0,7,4,10000000,0,70170,268435456,1 +0,0,1,4,9088,263,8192,0,7,4,1048576,0,6183,268435456,1 +0,0,1,4,9088,263,8192,0,7,4,1048576,0,6183,268435456,1 +0,0,1,4,929792,370,0,0,2,7,2097152,0,4192,1711276032,1 +0,0,1,4,929792,370,0,0,2,7,2097152,0,4192,1711276032,1 +0,0,1,4,9424,666,8192,0,7,4,1048576,0,5902,268435456,1 +0,0,1,4,9424,666,8192,0,7,4,1048576,0,5902,268435456,1 +0,0,1,5,0,0,16384,110413,10,5,1048576,33088,8992,4194304,1 +0,0,1,5,0,0,24576,0,12,4,1048576,33024,5049,4194304,1 +0,0,1,5,104128,59,98304,0,9,4,10000000,320,92784,268435456,1 +0,0,1,5,118544,212,102400,0,9,4,10000000,320,90040,268435456,1 +0,0,1,5,118544,212,102400,0,9,4,10000000,320,90040,268435456,1 +0,0,1,5,129136,59,118784,0,9,5,10000000,320,114964,6442450944,1 +0,0,1,5,129136,59,118784,0,9,5,10000000,320,114964,6442450944,1 +0,0,1,5,131056,75,114688,0,9,4,10000000,320,107077,268435456,1 +0,0,1,5,131056,75,114688,0,9,4,10000000,320,107077,268435456,1 +0,0,1,5,13696,247,12288,436,9,5,10000000,320,7470,268435456,1 +0,0,1,5,13696,247,12288,436,9,5,10000000,320,7470,268435456,1 +0,0,1,5,14368,962,12288,0,9,4,10000000,320,7461,268435456,1 +0,0,1,5,145792,212,122880,0,9,4,10000000,320,108280,268435456,1 +0,0,1,5,145792,212,122880,0,9,4,10000000,320,108280,268435456,1 +0,0,1,5,16048,217,12288,0,9,4,10000000,320,10234,268435456,1 +0,0,1,5,16048,217,12288,0,9,4,10000000,320,10234,268435456,1 +0,0,1,5,161648,75,139264,0,9,5,10000000,320,131988,6442450944,1 +0,0,1,5,161648,75,139264,0,9,5,10000000,320,131988,6442450944,1 +0,0,1,5,17552,1186,16384,0,9,4,10000000,320,14078,268435456,1 +0,0,1,5,247232,1775,229376,0,9,4,10000000,320,220208,268435456,1 +0,0,1,5,247232,1775,229376,0,9,4,10000000,320,220208,268435456,1 +0,0,1,5,27616,116,24576,436,9,5,10000000,320,20148,268435456,1 +0,0,1,5,27616,116,24576,436,9,5,10000000,320,20148,268435456,1 +0,0,1,5,30928,2314,28672,0,9,4,10000000,320,25856,268435456,1 +0,0,1,5,30928,2314,28672,0,9,4,10000000,320,25856,268435456,1 +0,0,10,10,0,0,0,2336,5,3,1048576,0,87536,4194304,1 +0,0,10,10,0,0,0,2336,5,3,1048576,0,87536,4194304,1 +0,0,2,4,206848,15373,200704,0,7,4,10000000,0,197109,268435456,1 +0,0,2,4,241408,15431,221184,0,7,4,1048576,0,219149,268435456,1 +0,0,2,4,241408,15431,221184,0,7,4,1048576,0,219149,268435456,1 +0,0,2,4,35184,1232,32768,0,7,4,10000000,0,29044,268435456,1 +0,0,2,4,35184,1232,32768,0,7,4,10000000,0,29044,268435456,1 +0,0,2,4,39984,1188,36864,0,7,4,1048576,0,33163,268435456,1 +0,0,2,4,39984,1188,36864,0,7,4,1048576,0,33163,268435456,1 +0,0,2,4,9120,151,8192,0,7,4,1048576,0,5493,268435456,1 +0,0,2,4,9312,309,8192,0,7,4,1048576,0,5843,268435456,1 +0,0,2,4,9312,309,8192,0,7,4,1048576,0,5843,268435456,1 +0,0,2,5,13680,329,12288,0,9,4,10000000,320,7258,268435456,1 +0,0,2,5,13680,329,12288,0,9,4,10000000,320,7258,268435456,1 +0,0,2,5,16016,191,12288,0,9,4,10000000,320,10058,268435456,1 +0,0,2,5,16016,191,12288,0,9,4,10000000,320,10058,268435456,1 +0,0,2,5,52304,8652,49152,0,9,4,10000000,320,44646,268435456,1 +0,0,2,5,52304,8652,49152,0,9,4,10000000,320,44646,268435456,1 +0,0,2,5,745296,50343,606208,0,9,4,10000000,0,598258,268435456,1 +0,0,2,5,745296,50343,606208,0,9,4,10000000,0,598258,268435456,1 +0,0,2,5,79616,19797,73728,0,9,4,10000000,320,71941,268435456,1 +0,0,2,5,79616,19797,73728,0,9,4,10000000,320,71941,268435456,1 +0,0,2,5,9504,175,8192,0,9,4,10000000,320,7066,268435456,1 +0,0,3,4,0,0,4096,123832,6,3,1048576,0,4640,4194304,1 +0,0,3,4,0,0,4096,123832,6,3,1048576,0,4640,4194304,1 +0,0,3,5,13472,164,12288,436,9,5,10000000,320,8894,268435456,1 +0,0,3,5,13472,164,12288,436,9,5,10000000,320,8894,268435456,1 +0,0,3,5,213056,19079,208896,0,9,4,10000000,320,206398,268435456,1 +0,0,3,5,31328,1351,28672,0,9,4,10000000,320,24640,268435456,1 +0,0,3,5,31328,1351,28672,0,9,4,10000000,320,24640,268435456,1 +0,0,4,5,25792,206,24576,0,9,4,10000000,320,21620,268435456,1 +0,0,4,5,25792,206,24576,0,9,4,10000000,320,21620,268435456,1 +0,0,5,4,0,0,0,0,7,3,1048576,0,93712,268435456,1 +0,0,5,4,0,0,0,0,7,3,1048576,0,93712,268435456,1 +0,0,5,5,0,0,0,82356,2,9,1048576,0,4096,4194304,1 +0,0,5,5,0,0,1024,0,7,3,262144,0,24070,65536,1 +0,0,5,5,0,0,1024,0,7,3,262144,0,24070,65536,1 +0,0,5,5,0,0,9856,0,7,5,262144,0,9616,65536,1 +0,0,6,4,0,0,28672,15144,6,5,1048576,32768,12538,4194304,1 +0,0,6,4,0,0,28672,2528,6,5,1048576,32768,12538,4194304,1 +0,0,6,4,0,0,28672,27496,6,5,1048576,34112,12505,4194304,0 +0,0,6,4,0,0,28672,97856,6,5,1048576,32768,12577,4194304,1 +0,0,6,4,0,0,28672,97856,6,5,1048576,32768,12577,4194304,1 +0,0,6,4,0,0,32768,35448,6,5,1048576,34112,13888,4194304,0 +0,0,6,5,0,0,103172,328448,2,8,1048576,33088,71708,4194304,0 +0,0,6,5,0,0,36864,281464,10,6,1048576,34112,14864,4194304,0 +0,0,6,6,0,0,0,0,9,7,262144,34112,7168,319815680,1 +0,0,6,6,0,0,0,0,9,7,262144,34112,7168,319815680,1 +0,0,6,6,0,0,13184,904,8,6,262144,0,1392,65536,1 +0,0,6,6,0,0,13184,904,8,6,262144,0,1392,65536,1 +0,0,6,6,802816,154,795380,69632,2,10,1048576,33088,745196,4194304,0 +0,0,7,9,0,0,182536,2232,8,3,1048576,0,176352,4194304,1 +0,0,7,9,0,0,182536,2232,8,3,1048576,0,176352,4194304,1 +0,0,8,4,0,0,4096,17126,6,3,1048576,0,4532,4194304,1 +0,0,8,4,0,0,4096,17126,6,3,1048576,0,4532,4194304,1 +0,0,8,5,10064,129,8192,0,9,4,10000000,320,6750,268435456,1 +0,0,8,5,10064,129,8192,0,9,4,10000000,320,6750,268435456,1 +0,0,8,5,147136,721,81920,0,9,4,10000000,320,77302,268435456,1 +0,0,8,5,147136,721,81920,0,9,4,10000000,320,77302,268435456,1 +0,0,8,5,24816,10332,20480,0,9,4,10000000,320,15934,268435456,1 +0,0,8,5,24816,10332,20480,0,9,4,10000000,320,15934,268435456,1 +0,0,9,4,0,0,4096,37956,6,3,1048576,0,4680,4194304,1 +0,0,9,4,0,0,4096,37956,6,3,1048576,0,4680,4194304,1 +0,485207007,0,4,0,0,0,98,76,3,1048576,0,4120,4194304,1 +112,100480,0,6,0,0,69632,480,14,6,1048576,33120,12256,5368709120,1 +112,100480,0,6,0,0,69632,480,14,6,1048576,33120,12256,5368709120,1 +112,258400,0,6,0,0,208896,480,14,6,1048576,33120,14624,5368709120,1 +112,291328,0,6,0,0,233472,480,14,5,1048576,33088,24460,4194304,1 +28,104544,0,6,0,0,81920,0,14,5,1048576,33088,11344,4194304,1 +28,104544,0,6,0,0,81920,0,14,5,1048576,33088,11344,4194304,1 +28,107104,0,4,0,0,107088,1510,8,3,1048576,34112,107074,4194304,1 +28,107104,0,4,0,0,107088,1510,8,3,1048576,34112,107074,4194304,1 +28,107176,0,4,0,0,107160,1510,8,3,1048576,34112,107146,4194304,1 +28,107176,0,4,0,0,107160,1510,8,3,1048576,34112,107146,4194304,1 +28,114296,0,4,0,0,114288,1510,8,3,1048576,34112,114274,4194304,1 +28,114296,0,4,0,0,114288,1510,8,3,1048576,34112,114274,4194304,1 +28,114368,0,4,0,0,114360,1510,8,3,1048576,34112,114346,4194304,1 +28,114368,0,4,0,0,114360,1510,8,3,1048576,34112,114346,4194304,1 +28,13164,0,4,0,0,8192,1512,11,3,1048576,34112,13566,4194304,1 +28,13164,0,4,0,0,8192,1512,11,3,1048576,34112,13566,4194304,1 +28,175552,0,5,0,0,135168,104672,14,6,1048576,33088,30362,4194304,1 +28,175552,0,5,0,0,135168,104672,14,6,1048576,33088,30362,4194304,1 +28,234624,0,5,0,0,172032,1508,14,7,2000000,49504,45840,5368709120,1 +28,30432,0,6,30464,56,28672,960,14,5,1048576,1280,27574,268435456,1 +28,33264,6,6,0,0,32768,0,9,6,262144,0,45156,65536,1 +28,33264,6,6,0,0,32768,0,9,6,262144,0,45156,65536,1 +28,402428,0,4,0,0,8192,28488,48,3,1048576,34144,402822,4194304,1 +28,649584,0,5,0,0,569344,149120,14,5,1048576,33088,275803,4194304,1 +28,649584,0,5,0,0,569344,149120,14,5,1048576,33088,275803,4194304,1 +28,660084,0,4,0,0,8192,21188,48,3,1048576,34112,660302,4194304,1 +28,660084,0,4,0,0,8192,21188,48,3,1048576,34112,660302,4194304,1 +28,763376,0,5,0,0,679936,149120,14,5,1048576,33088,281259,4194304,1 +28,763376,0,5,0,0,679936,149120,14,5,1048576,33088,281259,4194304,1 +28,78528,0,5,84864,51,77824,16384,9,5,1048576,34048,45804,4194304,1 +28,78528,0,5,84864,51,77824,16384,9,5,1048576,34048,45804,4194304,1 +28,81440,0,5,0,0,139264,716,8,5,1048576,1344,71440,4194304,1 +28,9588,0,4,0,0,8192,1504,48,3,1048576,34112,9982,4194304,1 +28,9588,0,4,0,0,8192,1504,48,3,1048576,34112,9982,4194304,1 +56,1081264,0,5,0,0,921600,436404,14,6,1048576,33088,548672,4194304,1 +56,109136,0,6,111840,80,86016,856,14,6,1048576,320,19001,268435456,1 +56,109136,0,6,111840,80,86016,856,14,6,1048576,320,19001,268435456,1 +56,186544,0,6,0,0,143360,480,14,7,1048576,352,38400,6442450944,1 +56,186544,0,6,0,0,143360,480,14,7,1048576,352,38400,6442450944,1 +56,2092800,0,5,0,0,2088960,176992,12,5,1048576,33088,1450535,4194304,1 +56,219384,0,6,0,0,180224,44848,14,7,1048576,49504,134464,5368709120,0 +56,242176,0,6,0,0,184320,480,14,6,1048576,320,5376,268435456,1 +56,242176,0,6,0,0,184320,480,14,6,1048576,320,5376,268435456,1 +56,245472,0,6,0,0,184320,134528,14,7,1048576,33120,39624,5368709120,1 +56,295200,0,6,0,0,225280,480,14,7,1048576,352,5296,6442450944,1 +56,295200,0,6,0,0,225280,480,14,7,1048576,352,5296,6442450944,1 +56,49520,6,6,0,0,28672,209496,14,6,1048576,33120,6264,5368709120,1 +56,49520,6,6,0,0,28672,209496,14,6,1048576,33120,6264,5368709120,1 +56,663472,0,6,0,0,540672,480,14,7,1048576,33120,349504,5368709120,1 +56,663472,0,6,0,0,540672,480,14,7,1048576,33120,349504,5368709120,1 +56,72712,0,6,74560,128,53248,480,14,5,1048576,320,6392,268435456,1 +56,80688,0,6,84064,132,61440,480,14,6,1048576,320,9740,268435456,1 +56,80688,0,6,84064,132,61440,480,14,6,1048576,320,9740,268435456,1 +56,80688,0,6,84064,132,61440,480,14,6,1048576,320,9741,268435456,1 +56,80688,0,6,84064,132,61440,480,14,6,1048576,320,9741,268435456,1 +84,240320,0,5,247856,52,208896,57400,14,6,1048576,49472,126704,4194304,1 +84,5136,10,10,0,0,40960,492840,14,5,262144,49472,27232,4194304,1 +84,622684,0,4,0,0,8192,4240,48,3,1048576,34112,629726,4194304,1 +84,663900,0,4,0,0,8192,4240,48,3,1048576,34112,670938,4194304,1 +84,689960,0,4,0,0,8192,1452,48,3,1048576,34112,716474,4194304,1 +84,859764,0,4,0,0,8192,4240,48,3,1048576,34112,866802,4194304,1 +84,87440,10,10,93856,21216,80312,1056,14,7,262144,16736,69776,6442450944,1 +84,985696,0,4,0,0,8192,205244,48,3,1048576,34112,992090,4194304,1 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,6,4,0,0,32768,30704,6,5,1048576,34112,13199,4194304,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,6,4,0,0,32768,30704,6,5,1048576,34112,13199,4194304,0 +0,0,0,6,0,0,1187112,368472,14,10,1048576,33120,755732,5368709120,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,6,4,0,0,32768,30704,6,5,1048576,34112,13199,4194304,0 +0,0,0,6,0,0,1187112,368472,14,10,1048576,33120,755732,5368709120,0 +28,445964,0,4,0,0,8192,1128,48,3,1048576,34144,446358,268435456,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,6,4,0,0,32768,30704,6,5,1048576,34112,13199,4194304,0 +0,0,0,6,0,0,1187112,368472,14,10,1048576,33120,755732,5368709120,0 +28,445964,0,4,0,0,8192,1128,48,3,1048576,34144,446358,268435456,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,6,4,0,0,32768,30704,6,5,1048576,34112,13199,4194304,0 +0,0,0,6,0,0,1187112,368472,14,10,1048576,33120,755732,5368709120,0 +28,445964,0,4,0,0,8192,1128,48,3,1048576,34144,446358,268435456,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +0,0,6,4,0,0,32768,68928,6,5,1048576,34112,13199,4194304,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,6,4,0,0,32768,30704,6,5,1048576,34112,13199,4194304,0 +0,0,0,6,0,0,1187112,368472,14,10,1048576,33120,755732,5368709120,0 +28,445964,0,4,0,0,8192,1128,48,3,1048576,34144,446358,268435456,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +0,0,6,4,0,0,32768,68928,6,5,1048576,34112,13199,4194304,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,6,4,0,0,32768,30704,6,5,1048576,34112,13199,4194304,0 +0,0,0,6,0,0,1187112,368472,14,10,1048576,33120,755732,5368709120,0 +28,445964,0,4,0,0,8192,1128,48,3,1048576,34144,446358,268435456,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +0,0,6,4,0,0,32768,68928,6,5,1048576,34112,13199,4194304,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,956,48,3,1048576,34144,146370,268435456,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,6,4,0,0,32768,30704,6,5,1048576,34112,13199,4194304,0 +0,0,0,6,0,0,1187112,368472,14,10,1048576,33120,755732,5368709120,0 +28,445964,0,4,0,0,8192,1128,48,3,1048576,34144,446358,268435456,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +0,0,6,4,0,0,32768,68928,6,5,1048576,34112,13199,4194304,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,956,48,3,1048576,34144,146370,268435456,0 +0,0,0,4,0,0,8192,1544,48,3,1048576,34144,11014,4194304,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,6,4,0,0,32768,30704,6,5,1048576,34112,13199,4194304,0 +0,0,0,6,0,0,1187112,368472,14,10,1048576,33120,755732,5368709120,0 +28,445964,0,4,0,0,8192,1128,48,3,1048576,34144,446358,268435456,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +0,0,6,4,0,0,32768,68928,6,5,1048576,34112,13199,4194304,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,956,48,3,1048576,34144,146370,268435456,0 +0,0,0,4,0,0,8192,1544,48,3,1048576,34144,11014,4194304,0 +28,224408,0,6,0,0,188416,64880,14,6,1048576,33120,127600,5368709120,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,6,4,0,0,32768,30704,6,5,1048576,34112,13199,4194304,0 +0,0,0,6,0,0,1187112,368472,14,10,1048576,33120,755732,5368709120,0 +28,445964,0,4,0,0,8192,1128,48,3,1048576,34144,446358,268435456,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +0,0,6,4,0,0,32768,68928,6,5,1048576,34112,13199,4194304,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,956,48,3,1048576,34144,146370,268435456,0 +0,0,0,4,0,0,8192,1544,48,3,1048576,34144,11014,4194304,0 +28,224408,0,6,0,0,188416,64880,14,6,1048576,33120,127600,5368709120,0 +0,0,0,6,0,0,0,36048,14,3,4194304,0,5400240,4194304,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,6,4,0,0,32768,30704,6,5,1048576,34112,13199,4194304,0 +0,0,0,6,0,0,1187112,368472,14,10,1048576,33120,755732,5368709120,0 +28,445964,0,4,0,0,8192,1128,48,3,1048576,34144,446358,268435456,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +0,0,6,4,0,0,32768,68928,6,5,1048576,34112,13199,4194304,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,956,48,3,1048576,34144,146370,268435456,0 +0,0,0,4,0,0,8192,1544,48,3,1048576,34144,11014,4194304,0 +28,224408,0,6,0,0,188416,64880,14,6,1048576,33120,127600,5368709120,0 +0,0,0,6,0,0,0,36048,14,3,4194304,0,5400240,4194304,0 +0,0,0,4,0,0,8192,908,48,3,1048576,34144,157578,268435456,0 +0,0,0,4,0,0,8192,44240,48,3,1048576,34144,2160194,4194304,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +84,704232,0,4,0,0,8192,1204,48,3,1048576,34144,704522,268435456,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,920,48,3,1048576,34144,1146110,268435456,0 +0,0,0,4,0,0,8192,932,48,3,1048576,34144,2175182,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29252,4194304,0 +28,108816,0,6,0,0,81920,4072,14,6,1048576,33120,39160,5368709120,0 +84,114032,0,4,0,0,8192,1348,48,3,1048576,34144,114318,268435456,0 +0,0,0,4,0,0,8192,952,48,3,1048576,34144,690138,268435456,0 +0,0,0,4,0,0,32768,4072,6,4,1048576,256,29588,4194304,0 +0,0,0,4,0,0,8192,924,48,3,1048576,34144,51898,268435456,0 +0,0,6,4,0,0,32768,30704,6,5,1048576,34112,13199,4194304,0 +0,0,0,6,0,0,1187112,368472,14,10,1048576,33120,755732,5368709120,0 +28,445964,0,4,0,0,8192,1128,48,3,1048576,34144,446358,268435456,0 +0,0,0,6,0,0,0,64332,14,3,1048576,33088,330944,4194304,0 +0,0,6,4,0,0,32768,68928,6,5,1048576,34112,13199,4194304,0 +0,0,6,5,0,0,103172,75496,2,8,1048576,33088,71644,4194304,0 +0,0,0,4,0,0,8192,956,48,3,1048576,34144,146370,268435456,0 +0,0,0,4,0,0,8192,1544,48,3,1048576,34144,11014,4194304,0 +28,224408,0,6,0,0,188416,64880,14,6,1048576,33120,127600,5368709120,0 +0,0,0,6,0,0,0,36048,14,3,4194304,0,5400240,4194304,0 +0,0,0,4,0,0,8192,908,48,3,1048576,34144,157578,268435456,0 +0,0,6,6,802816,154,795380,69632,2,10,1048576,33088,745196,4194304,0 +112,157424,0,6,0,0,122880,163843400,14,5,1048576,33088,43787,4194304,0 +112,157424,0,6,0,0,122880,114220356,14,5,1048576,33088,42392,4194304,0 +0,0,6,4,0,0,32768,75880,6,5,1048576,34112,13238,4194304,0 +56,2405360,0,6,0,0,2109440,20296,14,6,1048576,33088,1613407,4194304,0 +112, 153040, 0, 6, 0, 0, 118784, 122137172, 14, 5, 1048576, 33088, 40936, 4194304,0 +112,175744,0,6,0,0,139264,95569956,14,7,1048576,33088,46622,4194304,0 +112,861680,0,6,0,0,749568,1544416,14,5,1048576,33088,450027,4194304,0 +0,0,6,5,0,0,103172,45568,2,8,1048576,33088,71644,4194304,0 +0,0,6,4,0,0,32768,105488,6,5,1048576,34112,13888,4194304,0 +0,0,6,6,802816,154,795380,51260,2,10,1048576,33088,745196,4194304,0 +0,0,6,6,802816,154,795380,51260,2,10,1048576,33088,745196,4194304,0 +112,787560,0,6,0,0,446464,59024,14,5,1048576,33088,301013,4194304,0 +84,33792,10,5,225168,84,233472,180108,14,6,1048576,33088,117719,4194304,0 +28, 234320, 0, 5, 0, 0, 172032, 61452, 14, 7, 2000000, 49504, 42672, 5368709120, 0 +0, 0, 0, 4, 0, 0, 0, 4444, 5, 2, 1048576, 0, 207065, 4194304, 1 + diff --git a/Armstrong_number.java b/Armstrong_number.java new file mode 100644 index 00000000..b1798984 --- /dev/null +++ b/Armstrong_number.java @@ -0,0 +1,52 @@ +// Java program to determine whether the +// Number is Armstrong number or not +public class Armstrong { + // Function to calculate x raised to the + // power y + int power(int x, long y) + { + if (y == 0) + return 1; + if (y % 2 == 0) + return power(x, y / 2) * power(x, y / 2); + return x * power(x, y / 2) * power(x, y / 2); + } + + // Function to calculate order of the number + int order(int x) + { + int n = 0; + while (x != 0) { + n++; + x = x / 10; + } + return n; + } + + // Function to check whether the given number is + // Armstrong number or not + boolean isArmstrong(int x) + { + // Calling order function + int n = order(x); + int temp = x, sum = 0; + while (temp != 0) { + int r = temp % 10; + sum = sum + power(r, n); + temp = temp / 10; + } + + // If satisfies Armstrong condition + return (sum == x); + } + + // Driver Program + public static void main(String[] args) + { + Armstrong ob = new Armstrong(); + int x = 153; + System.out.println(x + " : " + ob.isArmstrong(x)); + x = 1253; + System.out.println(x + " : " + ob.isArmstrong(x)); + } +} diff --git a/BMI calculator/index.html b/BMI calculator/index.html new file mode 100644 index 00000000..ebaf1158 --- /dev/null +++ b/BMI calculator/index.html @@ -0,0 +1,53 @@ + + + + + + + BMI Calculator + + + + + + +

+

BMI CALCULATOR

+ +
+ + +
+ +
+ + + + + + + + + +
+ +
+
+

BMI Value:

+
+
+ +
+

Status:

+
+
+
+ +
+
+ + diff --git a/BMI calculator/main.css b/BMI calculator/main.css new file mode 100644 index 00000000..63219b85 --- /dev/null +++ b/BMI calculator/main.css @@ -0,0 +1,91 @@ +```css +/* Reset */ +* { + box-sizing: border-box; + margin: 0; + padding: 0; + font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; +} + +/* Input Styles */ +.inputs { + display: flex; + justify-content: center; + gap: 12px; + margin-bottom: 14px; +} + +.inputs label { + flex: 1; +} + +.values { + width: 100%; + padding: 10px 12px; + border: 1px solid #d7dbe6; + border-radius: 8px; + font-size: 16px; +} +``` + +/* Actions */ +.actions { + margin: 12px 0 18px; + display: flex; + gap: 8px; + flex-wrap: wrap; + justify-content: center; +} +button { + cursor: pointer; + border: none; + padding: 8px 12px; + border-radius: 8px; + font-weight: 600; + transition: transform 120ms ease, box-shadow 120ms ease; +} +button:active { transform: translateY(1px); } + +/* Primary and secondary styles */ +button.primary { + background: linear-gradient(90deg,#2b7be4,#4aa0ff); + color: white; + box-shadow: 0 6px 18px rgba(67,119,255,0.18); +} +button.secondary { + background: #f3f5fb; + color: #1b1f2a; + border: 1px solid #e6e9f2; +} + +/* Results */ +.results { + display: flex; + gap: 24px; + justify-content: center; + margin-top: 8px; + flex-wrap: wrap; +} +.bmi-value, .status { + min-width: 200px; + text-align: left; +} +.output { + margin-top: 8px; + padding: 10px 12px; + background: #ffffff; + border-radius: 8px; + border: 1px dashed #e2e6f0; + min-height: 42px; + display: flex; + align-items: center; + font-weight: 700; +} + +/* Tip area */ +.tip { + margin-top: 14px; + color: #3d4b6b; + font-size: 14px; + opacity: 0.95; +} diff --git a/BMI calculator/script.js b/BMI calculator/script.js new file mode 100644 index 00000000..338f9127 --- /dev/null +++ b/BMI calculator/script.js @@ -0,0 +1,173 @@ +// script.js + +// Main calculate function (Caln) +// Calculates BMI and updates #bmi-output and #bmi-status +function Caln() { + const hInput = document.getElementById('h-input'); + const wInput = document.getElementById('w-input'); + const bmiOut = document.getElementById('bmi-output'); + const statusOut = document.getElementById('bmi-status'); + const tip = document.getElementById('tip'); + + const hCm = Number(hInput.value); + const wKg = Number(wInput.value); + + // Basic validation + if (!hCm || !wKg || hCm <= 0 || wKg <= 0) { + bmiOut.textContent = ''; + statusOut.textContent = ''; + tip.textContent = 'Please enter valid height (cm) and weight (kg).'; + return; + } + // Reset everything (inputs + outputs) +function resetAll() { + document.getElementById('h-input').value = ''; + document.getElementById('w-input').value = ''; + document.getElementById('bmi-output').textContent = ''; + document.getElementById('bmi-status').textContent = ''; + document.getElementById('tip').textContent = ''; +} + +// Clear outputs only +function clearOutputs() { + document.getElementById('bmi-output').textContent = ''; + document.getElementById('bmi-status').textContent = ''; + document.getElementById('tip').textContent = ''; +} + + // Determine status + let status = ''; + if (bmiRounded < 18.5) { + status = 'Underweight'; + } else if (bmiRounded < 25) { + status = 'Normal weight'; + } else if (bmiRounded < 30) { + status = 'Overweight'; + } else { + status = 'Obesity'; + } + + // Update UI + bmiOut.textContent = bmiRounded; + statusOut.textContent = status; + tip.textContent = `Calculated for ${hCm} cm and ${wKg} kg. BMI = ${bmiRounded}.`; +} + + // Convert height to meters + const hM = hCm / 100; + const bmi = wKg / (hM * hM); + + // Round to one decimal place + const bmiRounded = Math.round(bmi * 10) / 10; + + + +// Copy BMI value to clipboard +function copyBMI() { + const bmiValue = document.getElementById('bmi-output').textContent.trim(); + if (!bmiValue) { + alert('No BMI value to copy. Please calculate first.'); + return; + } + + // Use Clipboard API with fallback + if (navigator.clipboard && navigator.clipboard.writeText) { + navigator.clipboard.writeText(bmiValue) + .then(() => { + alert('BMI copied to clipboard: ' + bmiValue); + }) + .catch((err) => { + // fallback to older method on failure + fallbackCopyTextToClipboard(bmiValue); + }); + } else { + fallbackCopyTextToClipboard(bmiValue); + } +} + +// Fallback copy method +function fallbackCopyTextToClipboard(text) { + const textarea = document.createElement('textarea'); + textarea.value = text; + textarea.style.position = 'fixed'; + textarea.style.left = '-9999px'; + document.body.appendChild(textarea); + textarea.select(); + try { + document.execCommand('copy'); + alert('BMI copied to clipboard: ' + text); + } catch (err) { + alert('Failed to copy BMI.'); + } + document.body.removeChild(textarea); +} + +// Save entry to localStorage +function saveEntry() { + const h = document.getElementById('h-input').value; + const w = document.getElementById('w-input').value; + const bmi = document.getElementById('bmi-output').textContent.trim(); + const status = document.getElementById('bmi-status').textContent.trim(); + + if (!h || !w) { + alert('Please enter height and weight before saving.'); + return; + } + + const entry = { + height_cm: Number(h), + weight_kg: Number(w), + bmi: bmi || null, + status: status || null, + timestamp: new Date().toISOString() + }; + + // Save as last entry (single) + localStorage.setItem('bmi_last_entry', JSON.stringify(entry)); + alert('Entry saved.'); +} + +// Load last entry from localStorage +function loadLastEntry() { + const raw = localStorage.getItem('bmi_last_entry'); + if (!raw) { + alert('No saved entry found.'); + return; + } + try { + const entry = JSON.parse(raw); + document.getElementById('h-input').value = entry.height_cm ?? ''; + document.getElementById('w-input').value = entry.weight_kg ?? ''; + // Set previously saved outputs (if available) + document.getElementById('bmi-output').textContent = entry.bmi ?? ''; + document.getElementById('bmi-status').textContent = entry.status ?? ''; + document.getElementById('tip').textContent = 'Loaded saved entry from ' + (entry.timestamp ?? 'unknown time') + '.'; + } catch (err) { + alert('Failed to load saved entry.'); + } +} + +// Show help tips +function showHelp() { + const tips = [ + 'Enter height in centimeters and weight in kilograms.', + 'BMI formula: \\( \\text{BMI} = \\dfrac{weight(kg)}{(height(m))^{2}} \\).', + 'Normal BMI is usually between 18.5 and 24.9.', + 'Use Save Entry to keep the last result. Load Last Entry will restore it.' + ]; + // Display as alert and also in tip area + alert(tips.join('\\n')); + document.getElementById('tip').textContent = tips.join(' • '); +} + +// Optional: run Caln() when pressing Enter in inputs +document.addEventListener('DOMContentLoaded', function () { + const inputs = document.querySelectorAll('.values'); + inputs.forEach((el) => { + el.addEventListener('keydown', function (e) { + if (e.key === 'Enter') { + Caln(); + } + }); + }); +}); diff --git a/C++_calculator/README.md b/C++_calculator/README.md new file mode 100644 index 00000000..eecbf608 --- /dev/null +++ b/C++_calculator/README.md @@ -0,0 +1,25 @@ +# Simple claculator using C++ # + +Hi there! + +## General info ## + +I wanted to practice my (very basic) C++ skills, hence, made this simple text-based-calculator. It uses switch statements to perform the desired operations. + +## Improvements to make ## + +1) Make a GUI +2) Must support many other data types and operations + +## Installation and usage ## + +1) Build the output file: +``` +g++ calculator.cpp +``` +2) Execute: +``` +./calculator.cpp +``` +3) Happy learning! + diff --git a/C++_calculator/calculator.cpp b/C++_calculator/calculator.cpp new file mode 100644 index 00000000..49ae873c --- /dev/null +++ b/C++_calculator/calculator.cpp @@ -0,0 +1,37 @@ +```cpp +#include +#include + +using namespace std; + +int main() { + char operation; + float num1, num2; + + cout << "Enter an operation (+, -, /, *): "; + cin >> operation; + + cout << "Enter two numbers: "; + cin >> num1 >> num2; + + switch (operation) { + case '+': + cout << "Sum: " << num1 + num2 << endl; + break; + case '-': + cout << "Difference: " << num1 - num2 << endl; + break; + case '*': + cout << "Product: " << num1 * num2 << endl; + break; + case '/': + cout << "Quotient: " << num1 / num2 << endl; + break; + default: + cout << "Invalid operation" << endl; + break; + } + + return 0; +} +``` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e6044430..77251c08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1 +1,7 @@ -Name : NightHAck36 \ No newline at end of file +Name : NightHAck36 +
+Contributor: [Ashish Noob](https://github.com/ashish-noob) +Shubham Sahay +Megha Rai +Neetendra Singh +Global Alumni Convention is on 25th of November! diff --git a/CPP/Hollowdiamond.cpp b/CPP/Hollowdiamond.cpp new file mode 100644 index 00000000..84a02e93 --- /dev/null +++ b/CPP/Hollowdiamond.cpp @@ -0,0 +1,23 @@ +```cpp +#include +using namespace std; + +int main() { + int n; + cout << "Enter a number for the hollow diamond pattern: "; + cin >> n; + + // Upper half + for (int i = 1; i <= n; i++) { + for (int j = n - i; j >= 0; j--) cout << "*"; + for (int k = 2 * (i - 1); k > 0; k--) cout << " "; + for (int l = n - i; l >= 0; l--) cout << "*"; + cout << endl; + } + + // Lower half + for (int i = 0; i < n; i++) { + for (int j = 0; j <= i; j++) cout << "*"; + for (int k = 2 * (n - i - 1); k > 0; k--) cout << " "; + for (int m = 0; m <= i; m++) cout << "*"; +``` diff --git a/Cafe Landing Page/images/1111.PNG b/Cafe Landing Page/images/1111.PNG new file mode 100644 index 00000000..cf6d1240 Binary files /dev/null and b/Cafe Landing Page/images/1111.PNG differ diff --git a/Cafe Landing Page/images/222222.PNG b/Cafe Landing Page/images/222222.PNG new file mode 100644 index 00000000..ac80e45f Binary files /dev/null and b/Cafe Landing Page/images/222222.PNG differ diff --git a/Cafe Landing Page/images/cake1.PNG b/Cafe Landing Page/images/cake1.PNG new file mode 100644 index 00000000..2add50b6 Binary files /dev/null and b/Cafe Landing Page/images/cake1.PNG differ diff --git a/Cafe Landing Page/images/cake2.PNG b/Cafe Landing Page/images/cake2.PNG new file mode 100644 index 00000000..b312b143 Binary files /dev/null and b/Cafe Landing Page/images/cake2.PNG differ diff --git a/Cafe Landing Page/images/deck1.PNG b/Cafe Landing Page/images/deck1.PNG new file mode 100644 index 00000000..31a159bd Binary files /dev/null and b/Cafe Landing Page/images/deck1.PNG differ diff --git a/Cafe Landing Page/images/deck2.PNG b/Cafe Landing Page/images/deck2.PNG new file mode 100644 index 00000000..942af03f Binary files /dev/null and b/Cafe Landing Page/images/deck2.PNG differ diff --git a/Cafe Landing Page/images/deck3.PNG b/Cafe Landing Page/images/deck3.PNG new file mode 100644 index 00000000..4cb48c0b Binary files /dev/null and b/Cafe Landing Page/images/deck3.PNG differ diff --git a/Cafe Landing Page/images/deck4.PNG b/Cafe Landing Page/images/deck4.PNG new file mode 100644 index 00000000..2d7fb992 Binary files /dev/null and b/Cafe Landing Page/images/deck4.PNG differ diff --git a/Cafe Landing Page/images/final1.PNG b/Cafe Landing Page/images/final1.PNG new file mode 100644 index 00000000..e425e403 Binary files /dev/null and b/Cafe Landing Page/images/final1.PNG differ diff --git a/Cafe Landing Page/images/final2.PNG b/Cafe Landing Page/images/final2.PNG new file mode 100644 index 00000000..9798b856 Binary files /dev/null and b/Cafe Landing Page/images/final2.PNG differ diff --git a/Cafe Landing Page/images/final3.PNG b/Cafe Landing Page/images/final3.PNG new file mode 100644 index 00000000..061d723b Binary files /dev/null and b/Cafe Landing Page/images/final3.PNG differ diff --git a/Cafe Landing Page/images/final4.PNG b/Cafe Landing Page/images/final4.PNG new file mode 100644 index 00000000..7b0f5f2e Binary files /dev/null and b/Cafe Landing Page/images/final4.PNG differ diff --git a/Cafe Landing Page/images/final5.PNG b/Cafe Landing Page/images/final5.PNG new file mode 100644 index 00000000..06822bbf Binary files /dev/null and b/Cafe Landing Page/images/final5.PNG differ diff --git a/Cafe Landing Page/images/final6.PNG b/Cafe Landing Page/images/final6.PNG new file mode 100644 index 00000000..86e1ff7f Binary files /dev/null and b/Cafe Landing Page/images/final6.PNG differ diff --git a/Cafe Landing Page/images/first.PNG b/Cafe Landing Page/images/first.PNG new file mode 100644 index 00000000..84b91240 Binary files /dev/null and b/Cafe Landing Page/images/first.PNG differ diff --git a/Cafe Landing Page/images/fuh.jfif b/Cafe Landing Page/images/fuh.jfif new file mode 100644 index 00000000..cb0d0a3f Binary files /dev/null and b/Cafe Landing Page/images/fuh.jfif differ diff --git a/Cafe Landing Page/images/logo.PNG b/Cafe Landing Page/images/logo.PNG new file mode 100644 index 00000000..731f98ea Binary files /dev/null and b/Cafe Landing Page/images/logo.PNG differ diff --git a/Cafe Landing Page/images/logo1.PNG b/Cafe Landing Page/images/logo1.PNG new file mode 100644 index 00000000..f05268a2 Binary files /dev/null and b/Cafe Landing Page/images/logo1.PNG differ diff --git a/Cafe Landing Page/images/maining.jfif b/Cafe Landing Page/images/maining.jfif new file mode 100644 index 00000000..e2d34aac Binary files /dev/null and b/Cafe Landing Page/images/maining.jfif differ diff --git a/Cafe Landing Page/images/one.jfif b/Cafe Landing Page/images/one.jfif new file mode 100644 index 00000000..1a3c1c88 Binary files /dev/null and b/Cafe Landing Page/images/one.jfif differ diff --git a/Cafe Landing Page/images/soon.PNG b/Cafe Landing Page/images/soon.PNG new file mode 100644 index 00000000..3faf58bf Binary files /dev/null and b/Cafe Landing Page/images/soon.PNG differ diff --git a/Cafe Landing Page/images/yoo.PNG b/Cafe Landing Page/images/yoo.PNG new file mode 100644 index 00000000..35a6db64 Binary files /dev/null and b/Cafe Landing Page/images/yoo.PNG differ diff --git a/Cafe Landing Page/index.html b/Cafe Landing Page/index.html new file mode 100644 index 00000000..b3740b12 --- /dev/null +++ b/Cafe Landing Page/index.html @@ -0,0 +1,270 @@ + + + + + + + + ```html + +``` + + + + + +
+ +
+ ALL DRINKS ARE 50% OFF UNTIL AUGUST 1ST 2021 @ 11 A.M. +
+
+
+ + +
+
+
+ +
+
+

NEW DRINK SPECIALS

+

All Drinks are 50% OFF for a limited time.

+ +
+
+
+ ... +
+
+
+
+ + + +
+

Drinks

+
+
+
+
+ ... +
+
Orange Drink Cocktail
+

Orange Juice

+

+ $12.50 +

+

$6.50

+ +
+
+
+ ... +
+
Fruit Punch
+

Gin and Fruit Punch Juice

+

+ $12.50 +

+

$$6.25

+ +
+
+
+ ... +
+
Frozen Pink Gin
+

Gin and Pink Lemonade.

+

+ $12.50 +

+

$6.25

+ +
+
+
+ ... +
+
Rose Lemonade
+

Pink Lemonade.

+

+ $12.50 +

+

$6.25

+ +
+
+
+ + + +
+

Cakes

+
+
+
+
+
+
+
+ ... +
+
Strawberry Cakee
+

+ Vanilla Cake with Strawberries and Whip Cream +

+

$15.00

+ +
+
+
+
+
+ ... +
+
Foofy Cake
+

+ Vanilla Cake with Strawberries and Whip Cream +

+

$15.50

+ +
+
+
+
+
+
+ + + + +
+
+
+
+ ... +
+
+

Coming Soon

+ New drinks are going to be here soon..
+ +
+
+
+
+ + +
+
+
+
+

Order Items Here

+

One cake and drink per customer.

+
+
+
+
+ + + + + + + + + +
+
+
+
+ + +
+ +
+ © 2021 MyCafe | KunaL GitHub +
+
+
+ + + + diff --git a/Cafe Landing Page/style.css b/Cafe Landing Page/style.css new file mode 100644 index 00000000..2007f2c6 --- /dev/null +++ b/Cafe Landing Page/style.css @@ -0,0 +1,24 @@ + + +.formbtn{ + padding: 7px 16px; + border: 1px dotted #e51065 ; + border-radius: 50px; + color: #e51065; + font-weight: 600; + cursor: pointer; + background-color: #FFA6C9 ; + +} +.formbtn:hover{ + font-style: italic; +} +.font{ + font-family: 'Sacramento', cursive; + font-weight: bold; + font-size:50px; +} +.sale{ + font-weight: lighter; + font-weight: italic; +} diff --git a/Card-Game/css/style.min.css b/Card-Game/css/style.min.css index 2fc82950..0578c768 100644 --- a/Card-Game/css/style.min.css +++ b/Card-Game/css/style.min.css @@ -1,52 +1,322 @@ @import url("https://fonts.googleapis.com/css2?family=Pangolin&display=swap"); -*{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;font-family:'Pangolin', cursive} -.game-container{position:absolute;height:100vh;width:100%;background-color:#f08080} -.game-container img{height:10vmin} -.game-container .background-lines{position:absolute;height:100%;width:100%} -.line-1,.line-2,.line-3,.line-4,.line-5,.line-6{height:20%;width:100%} -.line-1{background-color:#e8ead3} -.line-2{background-color:#f5dd90} -.line-3{background-color:#fbd46d} -.line-4{background-color:#ff9c71} -.line-5{background-color:#f68e5f} -.line-6{background-color:#f76c5e} -#grid{overflow:hidden;position:absolute;height:550px;width:600px;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);padding:20px 0;border-radius:50px;-webkit-box-shadow:0px 0px 70px 10px rgba(0,0,0,0.1);box-shadow:0px 0px 70px 10px rgba(0,0,0,0.1);background-color:rgba(85,85,85,0.25);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-perspective:1500px;perspective:1500px} -#grid .card-wrapper{height:90px;width:90px;margin:0 10px;position:relative;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;-webkit-transition:-webkit-transform 0.5s;transition:-webkit-transform 0.5s;transition:transform 0.5s;transition:transform 0.5s, -webkit-transform 0.5s} -#grid .card-wrapper .card-front,#grid .card-wrapper .card-back{height:100%;width:100%;background-color:#f8f8f8;border-radius:10px;-webkit-box-shadow:10px 10px 20px rgba(0,0,0,0.2);box-shadow:10px 10px 20px rgba(0,0,0,0.2);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-transform:scale(1);transform:scale(1);-webkit-backface-visibility:hidden;backface-visibility:hidden} -#grid .card-wrapper .card-front{position:absolute;-webkit-transform:rotateY(180deg);transform:rotateY(180deg)} -#grid .card-wrapper .card-back{position:absolute;background-color:#f8f8f8} -#grid .card-wrapper.flip{-webkit-transform:rotateY(180deg);transform:rotateY(180deg)} -#grid .card-wrapper:hover{cursor:pointer} -#grid .card-wrapper:hover .card-back{background-color:#e7e7e7} -#grid .card-wrapper:active{-webkit-transform:scale(1.5);transform:scale(1.5);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:200ms;transition-duration:200ms} -#you-win,#you-loose,#welcome-screen{position:absolute;height:100vh;width:100%;background-color:rgba(94,94,94,0.288);display:none;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center} -#you-win button,#you-loose button,#welcome-screen button{height:70px;width:200px;color:#fff;font-size:25px;font-weight:600;letter-spacing:1px;background-color:#eb6666;border:none;outline:none;border-radius:5px} -#you-win button:hover,#you-loose button:hover,#welcome-screen button:hover{cursor:pointer;background-color:#e63946} -#you-win #you-win-wrapper,#you-win #you-loose-wrapper,#you-win #welcome-wrapper,#you-loose #you-win-wrapper,#you-loose #you-loose-wrapper,#you-loose #welcome-wrapper,#welcome-screen #you-win-wrapper,#welcome-screen #you-loose-wrapper,#welcome-screen #welcome-wrapper{height:550px;width:600px;border-radius:10px;padding:0 50px;background-color:#f1faee;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column} -#you-win #you-win-wrapper #title,#you-win #you-win-wrapper #timeee,#you-win #you-loose-wrapper #title,#you-win #you-loose-wrapper #timeee,#you-win #welcome-wrapper #title,#you-win #welcome-wrapper #timeee,#you-loose #you-win-wrapper #title,#you-loose #you-win-wrapper #timeee,#you-loose #you-loose-wrapper #title,#you-loose #you-loose-wrapper #timeee,#you-loose #welcome-wrapper #title,#you-loose #welcome-wrapper #timeee,#welcome-screen #you-win-wrapper #title,#welcome-screen #you-win-wrapper #timeee,#welcome-screen #you-loose-wrapper #title,#welcome-screen #you-loose-wrapper #timeee,#welcome-screen #welcome-wrapper #title,#welcome-screen #welcome-wrapper #timeee{color:#343436;font-size:30px;font-weight:700;letter-spacing:2px;text-align:center;margin-bottom:40px} -#you-win #you-win-wrapper #timeee,#you-win #you-loose-wrapper #timeee,#you-win #welcome-wrapper #timeee,#you-loose #you-win-wrapper #timeee,#you-loose #you-loose-wrapper #timeee,#you-loose #welcome-wrapper #timeee,#welcome-screen #you-win-wrapper #timeee,#welcome-screen #you-loose-wrapper #timeee,#welcome-screen #welcome-wrapper #timeee{margin-top:40px;font-size:20px} -#welcome-screen{display:-webkit-box;display:-ms-flexbox;display:flex} -#timer{position:absolute;top:15%;left:5%;height:200px;width:200px;background-color:#333366;border-radius:20px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center} -#timer #time{color:#fff;font-size:40px;text-align:center} -html, body { + +* { + -webkit-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + padding: 0; + font-family: 'Pangolin', cursive +} + +.game-container { + position: absolute; + height: 100vh; width: 100%; - height:100%; - } - - .game-container,.card-back { - background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab); - background-size: 400% 400%; - animation: gradient 15s ease infinite; - } - - @keyframes gradient { - 0% { - background-position: 0% 50%; - } - 50% { - background-position: 100% 50%; - } - 100% { - background-position: 0% 50%; - } - } \ No newline at end of file + background-color: #f08080 +} + +.game-container img { + height: 10vmin +} + +.game-container .background-lines { + position: absolute; + height: 100%; + width: 100% +} + +.line-1, +.line-2, +.line-3, +.line-4, +.line-5, +.line-6 { + height: 20%; + width: 100% +} + +.line-1 { + background-color: #e8ead3 +} + +.line-2 { + background-color: #f5dd90 +} + +.line-3 { + background-color: #fbd46d +} + +.line-4 { + background-color: #ff9c71 +} + +.line-5 { + background-color: #f68e5f +} + +.line-6 { + background-color: #f76c5e +} + +#grid { + overflow: hidden; + position: absolute; + height: 550px; + width: 600px; + top: 50%; + left: 50%; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + padding: 20px 0; + border-radius: 50px; + -webkit-box-shadow: 0px 0px 70px 10px rgba(0, 0, 0, 0.1); + box-shadow: 0px 0px 70px 10px rgba(0, 0, 0, 0.1); + background-color: rgba(85, 85, 85, 0.25); + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-perspective: 1500px; + perspective: 1500px +} + +#grid .card-wrapper { + height: 90px; + width: 90px; + margin: 0 10px; + position: relative; + -webkit-transform-style: preserve-3d; + transform-style: preserve-3d; + -webkit-transition: -webkit-transform 0.5s; + transition: -webkit-transform 0.5s; + transition: transform 0.5s; + transition: transform 0.5s, -webkit-transform 0.5s +} + +#grid .card-wrapper .card-front, +#grid .card-wrapper .card-back { + height: 100%; + width: 100%; + background-color: #f8f8f8; + border-radius: 10px; + -webkit-box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.2); + box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.2); + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-transform: scale(1); + transform: scale(1); + -webkit-backface-visibility: hidden; + backface-visibility: hidden +} + +#grid .card-wrapper .card-front { + position: absolute; + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg) +} + +#grid .card-wrapper .card-back { + position: absolute; + background-color: #f8f8f8 +} + +#grid .card-wrapper.flip { + -webkit-transform: rotateY(180deg); + transform: rotateY(180deg) +} + +#grid .card-wrapper:hover { + cursor: pointer +} + +#grid .card-wrapper:hover .card-back { + background-color: #e7e7e7 +} + +#grid .card-wrapper:active { + -webkit-transform: scale(1.5); + transform: scale(1.5); + -webkit-transition-property: all; + transition-property: all; + -webkit-transition-duration: 200ms; + transition-duration: 200ms +} + +#you-win, +#you-loose, +#welcome-screen { + position: absolute; + height: 100vh; + width: 100%; + background-color: rgba(94, 94, 94, 0.288); + display: none; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center +} + +#you-win button, +#you-loose button, +#welcome-screen button { + height: 70px; + width: 200px; + color: #fff; + font-size: 25px; + font-weight: 600; + letter-spacing: 1px; + background-color: #eb6666; + border: none; + outline: none; + border-radius: 5px +} + +#you-win button:hover, +#you-loose button:hover, +#welcome-screen button:hover { + cursor: pointer; + background-color: #e63946 +} + +#you-win #you-win-wrapper, +#you-win #you-loose-wrapper, +#you-win #welcome-wrapper, +#you-loose #you-win-wrapper, +#you-loose #you-loose-wrapper, +#you-loose #welcome-wrapper, +#welcome-screen #you-win-wrapper, +#welcome-screen #you-loose-wrapper, +#welcome-screen #welcome-wrapper { + height: 550px; + width: 800px; + border-radius: 10px; + padding: 0 50px; + background-color: #f1faee; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column +} + +#you-win #you-win-wrapper #title, +#you-win #you-win-wrapper #timeee, +#you-win #you-loose-wrapper #title, +#you-win #you-loose-wrapper #timeee, +#you-win #welcome-wrapper #title, +#you-win #welcome-wrapper #timeee, +#you-loose #you-win-wrapper #title, +#you-loose #you-win-wrapper #timeee, +#you-loose #you-loose-wrapper #title, +#you-loose #you-loose-wrapper #timeee, +#you-loose #welcome-wrapper #title, +#you-loose #welcome-wrapper #timeee, +#welcome-screen #you-win-wrapper #title, +#welcome-screen #you-win-wrapper #timeee, +#welcome-screen #you-loose-wrapper #title, +#welcome-screen #you-loose-wrapper #timeee, +#welcome-screen #welcome-wrapper #title, +#welcome-screen #welcome-wrapper #timeee { + color: #343436; + font-size: 30px; + font-weight: 700; + letter-spacing: 2px; + text-align: center; + margin-bottom: 40px +} + +#you-win #you-win-wrapper #timeee, +#you-win #you-loose-wrapper #timeee, +#you-win #welcome-wrapper #timeee, +#you-loose #you-win-wrapper #timeee, +#you-loose #you-loose-wrapper #timeee, +#you-loose #welcome-wrapper #timeee, +#welcome-screen #you-win-wrapper #timeee, +#welcome-screen #you-loose-wrapper #timeee, +#welcome-screen #welcome-wrapper #timeee { + margin-top: 40px; + font-size: 20px +} + +#welcome-screen { + display: -webkit-box; + display: -ms-flexbox; + display: flex +} + +#timer { + position: absolute; + top: 15%; + left: 5%; + height: 200px; + width: 200px; + background-color: #333366; + border-radius: 20px; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center +} + +#timer #time { + color: #fff; + font-size: 40px; + text-align: center +} + +html, +body { + width: 100%; + height: 100%; +} + +.game-container, +.card-back { + background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab); + background-size: 400% 400%; + animation: gradient 15s ease infinite; +} + +@keyframes gradient { + 0% { + background-position: 0% 50%; + } + + 50% { + background-position: 100% 50%; + } + + 100% { + background-position: 0% 50%; + } +} \ No newline at end of file diff --git a/Card-Game/images/birthdaycake.png b/Card-Game/images/birthdaycake.png new file mode 100644 index 00000000..da3bf7f7 Binary files /dev/null and b/Card-Game/images/birthdaycake.png differ diff --git a/Card-Game/images/cupcake.png b/Card-Game/images/cupcake.png new file mode 100644 index 00000000..d8324ae4 Binary files /dev/null and b/Card-Game/images/cupcake.png differ diff --git a/Card-Game/images/dessert.png b/Card-Game/images/dessert.png new file mode 100644 index 00000000..73252e47 Binary files /dev/null and b/Card-Game/images/dessert.png differ diff --git a/Card-Game/images/roll.png b/Card-Game/images/roll.png new file mode 100644 index 00000000..1e4d2754 Binary files /dev/null and b/Card-Game/images/roll.png differ diff --git a/Card-Game/index.html b/Card-Game/index.html index 8229b753..2180647d 100644 --- a/Card-Game/index.html +++ b/Card-Game/index.html @@ -1,55 +1,61 @@ +```html - - - - - - - Memory Game - - -
-
-
-
-
- -
-
-
-
-
Timer
00:00
-
-
-
-
-
-
- Too slow bitch....
Until next time..... -
- -
-
-
-
-
Well you won...
Now what ?
- -
-
-
-
-
- I see, so hours of boredom has finally brought you here
You - dissapoint me son....

GO get a life -
- -

- (ps. you got 59 seconds to finish this.
And yes it's - possible I tested it.) -

-
-
- - + + + + + + Memory Game + + +
+
+
+
+
+
+
+
+
+
Timer
00:00
+
+
+
+
+
+
+ Too slow bitch....
Until next time..... +
+ +
+
+
+
+
Well you won...
Now what ?
+ +
+
+
+
+
+
+ I see, so hours of boredom has finally brought you here
You + dissapoint me son....

GO get a life +
+ +
+ +
+ +
+

+ (ps. you got 59 seconds to finish this.
And yes it's + possible I tested it.) +

+
+
+ + +``` diff --git a/Card-Game/script.js b/Card-Game/script.js index 7818045b..3b176234 100644 --- a/Card-Game/script.js +++ b/Card-Game/script.js @@ -1,3 +1,4 @@ +function play(val){ const cardArray = [ { name: 'burger', @@ -39,21 +40,40 @@ const cardArray = [ name: 'watermelon', img: 'images/watermelon.png' }, + { + name: 'roll', + img: 'images/roll.png' + }, + { + name: 'birthdaycake', + img: 'images/birthdaycake.png' + }, + { + name: 'cupcake', + img: 'images/cupcake.png' + }, + { + name: 'dessert', + img: 'images/dessert.png' + }, ]; - +const arrsize = val; +console.log(arrsize); let cardSpawner = () => { let index = 0; - const numberOfCards = 20; + const numberOfCards = 2*arrsize; + if(numberOfCards==12) document.getElementById('grid').style.width='400px'; + if(numberOfCards==28) document.getElementById('grid').style.width='800px'; for(let i=0;i
`; document.getElementById('grid').appendChild(card); index++; - if(index>9){index=0}; + if(index>arrsize-1){index=0}; } } @@ -180,8 +200,21 @@ let youLoose = () => { cardsList.forEach(cardsList => cardsList.addEventListener('click',flipCard)); +function show_all_cards(){ + for(let i=0;i + +``` +cd chatplatform +$npm install express +$npm install nodemon -D` +$nodemon index.js +``` \ No newline at end of file diff --git a/Chatplatform/index.js b/Chatplatform/index.js new file mode 100644 index 00000000..0d1c49f2 --- /dev/null +++ b/Chatplatform/index.js @@ -0,0 +1,77 @@ +const express = require('express'); +const path = require('path'); +const http = require('http'); +const socketio=require('socket.io'); +// const formatMessage = require('./utils/messages'); +const { + userJoin, + userLeave, + getCurrentUser, + getRoomUsers +} = require('./utils/users'); +const formatMessage = require('./utils/messages'); +const app = express(); +app.use(express.static(path.join(__dirname, "public"))); +const server = http.createServer(app); +const io=socketio(server); +const botName = "Admin "; +io.on('connection', (socket)=>{ + // socket represents an actual user + // emit a endt to the client + // socket.emit("welcomemessage", "Welcome to the chat"); + // socket.on("connected", (data)=>{ + // console.log(data); + // console.log(socket.id + " connected"); + // }) + socket.on("joinRoom", ({ username, room }) => { + const user = userJoin(socket.id, username, room); + + socket.join(user.room); + + // Welcome current user + socket.emit("message", formatMessage(botName, "Welcome to command tech!")); + + // Broadcast when a user connects + socket.broadcast + .to(user.room) + .emit( + "message", + formatMessage(botName, `${user.username} has joined the chat`) + ); + + // Send users and room info + io.to(user.room).emit("roomUsers", { + room: user.room, + users: getRoomUsers(user.room), + }); + }); + + // Listen for chatMessage + // Listen for chatMessage + socket.on("chatMessage", (msg) => { + const user = getCurrentUser(socket.id); + io.to(user.room).emit("message", formatMessage(user.username, msg)); + }); + + // Runs when client disconnects + socket.on("disconnect", () => { + const user = userLeave(socket.id); + + if (user) { + io.to(user.room).emit( + "message", + formatMessage(botName, `${user.username} has left the chat`) + ); + + // Send users and room info + io.to(user.room).emit("roomUsers", { + room: user.room, + users: getRoomUsers(user.room), + }); + } + }); + }); + + const PORT = 3000; + + server.listen(PORT, () => console.log(`Server running on port ${PORT}`)); \ No newline at end of file diff --git a/Chatplatform/package-lock.json b/Chatplatform/package-lock.json new file mode 100644 index 00000000..82626d67 --- /dev/null +++ b/Chatplatform/package-lock.json @@ -0,0 +1,821 @@ +{ + "name": "chatapp", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "chatapp", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "express": "^4.18.2", + "moment": "^2.29.4", + "socket.io": "^4.7.2" + } + }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", + "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" + }, + "node_modules/@types/cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==" + }, + "node_modules/@types/cors": { + "version": "2.8.14", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.14.tgz", + "integrity": "sha512-RXHUvNWYICtbP6s18PnOCaqToK8y14DnLd75c6HfyKf228dxy7pHNOQkxPtvXKp/hINFMDjbYzsj63nnpPMSRQ==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "20.8.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.0.tgz", + "integrity": "sha512-LzcWltT83s1bthcvjBmiBvGJiiUe84NWRHkw+ZV6Fr41z2FbIzvc815dk2nQ3RAKMuN2fkenM/z3Xv2QzEpYxQ==" + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/base64id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", + "engines": { + "node": "^4.5.0 || >= 5.9" + } + }, + "node_modules/body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/engine.io": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.2.tgz", + "integrity": "sha512-IXsMcGpw/xRfjra46sVZVHiSWo/nJ/3g1337q9KNXtS6YRzbW5yIzTCb9DjhrBe7r3GZQR0I4+nq+4ODk5g/cA==", + "dependencies": { + "@types/cookie": "^0.4.1", + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "~0.4.1", + "cors": "~2.8.5", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.11.0" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz", + "integrity": "sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/engine.io/node_modules/cookie": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/engine.io/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/engine.io/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.18.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", + "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/socket.io": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.7.2.tgz", + "integrity": "sha512-bvKVS29/I5fl2FGLNHuXlQaUH/BlzX1IN6S+NKLNZpBsPZIDH+90eQmCs2Railn4YUiww4SzUedJ6+uzwFnKLw==", + "dependencies": { + "accepts": "~1.3.4", + "base64id": "~2.0.0", + "cors": "~2.8.5", + "debug": "~4.3.2", + "engine.io": "~6.5.2", + "socket.io-adapter": "~2.5.2", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/socket.io-adapter": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz", + "integrity": "sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==", + "dependencies": { + "ws": "~8.11.0" + } + }, + "node_modules/socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io-parser/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/socket.io/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/ws": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/Chatplatform/package.json b/Chatplatform/package.json new file mode 100644 index 00000000..8933e256 --- /dev/null +++ b/Chatplatform/package.json @@ -0,0 +1,17 @@ +{ + "name": "chatapp", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "express": "^4.18.2", + "moment": "^2.29.4", + "socket.io": "^4.7.2" + } +} diff --git a/Chatplatform/public/chat.html b/Chatplatform/public/chat.html new file mode 100644 index 00000000..5e041dba --- /dev/null +++ b/Chatplatform/public/chat.html @@ -0,0 +1,52 @@ + + + + + + + + Chat App + + +
+
+

command_tech

+ Leave Room +
+
+
+

Room Name:

+

+

Users

+
    +
    +
    +
    +
    +
    + + +
    +
    +
    + + + + + + \ No newline at end of file diff --git a/Chatplatform/public/css/style.css b/Chatplatform/public/css/style.css new file mode 100644 index 00000000..2ff72fa0 --- /dev/null +++ b/Chatplatform/public/css/style.css @@ -0,0 +1,197 @@ +@import url('https://fonts.googleapis.com/css?family=Roboto&display=swap'); + +:root { +--dark-color-a: #667aff; +--dark-color-b: #7386ff; +--light-color: #e6e9ff; +--success-color: #5cb85c; +--error-color: #d9534f; +} + +* { +box-sizing: border-box; +margin: 0; +padding: 0; +} + +body { +font-family: 'Roboto', sans-serif; +font-size: 16px; +background: var(--light-color); +margin: 20px; +} +li{ + list-style: none; + margin-left:5px; +} + +ul { + list-style: none; + height: 60%; + width:100%; + overflow: auto; +} + +a { +text-decoration: none; +} + +.btn { +cursor: pointer; +padding: 5px 15px; +background: var(--light-color); +color: var(--dark-color-a); +border: 0; +font-size: 17px; +} + +/* Chat Page */ + +.chat-container { +max-width: 1100px; +background: #fff; +margin: 30px auto; +overflow: hidden; +} + +.chat-header { +background: var(--dark-color-a); +color: #fff; +border-top-left-radius: 5px; +border-top-right-radius: 5px; +padding: 15px; +display: flex; +align-items: center; +justify-content: space-between; +} + +.chat-main { +display: grid; +grid-template-columns: 1fr 3fr; +} + +.chat-sidebar { +background: var(--dark-color-b); +color: #fff; +padding: 20px 20px 60px; +overflow-y: scroll; +} + +.chat-sidebar h2 { +font-size: 20px; +background: rgba(0, 0, 0, 0.1); +padding: 10px; +margin-bottom: 20px; +} + +.chat-sidebar h3 { +margin-bottom: 15px; +} + +.chat-sidebar ul li { +padding: 10px 0; +} + +.chat-messages { +padding: 30px; +max-height: 500px; +overflow-y: scroll; +} + +.chat-messages .message { +padding: 10px; +margin-bottom: 15px; +background-color: var(--light-color); +border-radius: 5px; +overflow-wrap: break-word; +} + +.chat-messages .message .meta { +font-size: 15px; +font-weight: bold; +color: var(--dark-color-b); +opacity: 0.7; +margin-bottom: 7px; +} + +.chat-messages .message .meta span { +color: #777; +} + +.chat-form-container { +padding: 20px 30px; +background-color: var(--dark-color-a); +} + +.chat-form-container form { +display: flex; +} + +.chat-form-container input[type='text'] { +font-size: 16px; +padding: 5px; +height: 40px; +flex: 1; +} + +/* Join Page */ +.join-container { +max-width: 500px; +margin: 80px auto; +color: #fff; +} + +.join-header { +text-align: center; +padding: 20px; +background: var(--dark-color-a); +border-top-left-radius: 5px; +border-top-right-radius: 5px; +} + +.join-main { +padding: 30px 40px; +background: var(--dark-color-b); +} + +.join-main p { +margin-bottom: 20px; +} + +.join-main .form-control { +margin-bottom: 20px; +} + +.join-main label { +display: block; +margin-bottom: 5px; +} + +.join-main input[type='text'] { +font-size: 16px; +padding: 5px; +height: 40px; +width: 100%; +} + +.join-main select { +font-size: 16px; +padding: 5px; +height: 40px; +width: 100%; +} + +.join-main .btn { +margin-top: 20px; +width: 100%; +} + +@media (max-width: 700px) { +.chat-main { +display: block; +} + +.chat-sidebar { +display: none; +} +} diff --git a/Chatplatform/public/index.html b/Chatplatform/public/index.html new file mode 100644 index 00000000..47a28990 --- /dev/null +++ b/Chatplatform/public/index.html @@ -0,0 +1,51 @@ + + + + + + + + + + Chat App + + +
    + +
    +

    command_tech

    +
    + +
    +
    +
    + + +
    +
    + + +
    + +
    +
    +
    + + + + \ No newline at end of file diff --git a/Chatplatform/public/js/main.js b/Chatplatform/public/js/main.js new file mode 100644 index 00000000..4b1f2e45 --- /dev/null +++ b/Chatplatform/public/js/main.js @@ -0,0 +1,96 @@ +// const socket = io(); +// socket.on('welcomemessage', (data) => { +// console.log(data); +// }); +// socket.emit("connected","The client connected"); +const chatForm = document.getElementById('chat-form'); +const chatMessages = document.querySelector('.chat-messages'); +const roomName = document.getElementById('room-name'); +const userList = document.getElementById('users'); + +// Get username and room from URL +const { username, room } = Qs.parse(location.search, { + ignoreQueryPrefix: true, +}); + +const socket = io(); + +// Join chatroom +socket.emit('joinRoom', { username, room }); + +// Get room and users +socket.on('roomUsers', ({ room, users }) => { + outputRoomName(room); + outputUsers(users); +}); + +// Message from server +socket.on('message', (message) => { + // console.log(message); + outputMessage(message); + + // Scroll down + chatMessages.scrollTop = chatMessages.scrollHeight; +}); + +// Message submit +chatForm.addEventListener('submit', (e) => { + e.preventDefault(); + + // Get message text + let msg = e.target.elements.msg.value; + + msg = msg.trim(); + + if (!msg) { + return false; + } + + // Emit message to server + socket.emit('chatMessage', msg); + + // Clear input + e.target.elements.msg.value = ''; + e.target.elements.msg.focus(); +}); + +// Output message to DOM +function outputMessage(message) { + const div = document.createElement('div'); + div.classList.add('message'); + const p = document.createElement('p'); + p.classList.add('meta'); + p.innerText = message.username; + p.innerHTML += ` ${message.time}`; + div.appendChild(p); + const para = document.createElement('p'); + para.classList.add('text'); + para.innerText = message.text; + div.appendChild(para); + document.querySelector('.chat-messages').appendChild(div); +} + +// Add room name to DOM +function outputRoomName(room) { + roomName.innerText = room; +} + +// Add users to DOM +function outputUsers(users) { + userList.innerHTML = ''; + users.forEach((user) => { + const li = document.createElement('li'); + li.innerText = user.username; + userList.appendChild(li); + + }); +} + +//Prompt the user before leave chat room +document.getElementById('leave-btn').addEventListener('click', () => { + const leaveRoom = confirm('Are you sure you want to leave the chatroom?'); + if (leaveRoom) { + window.location = '../index.html'; + } else { + } +}); \ No newline at end of file diff --git a/Chatplatform/utils/messages.js b/Chatplatform/utils/messages.js new file mode 100644 index 00000000..1b85cca1 --- /dev/null +++ b/Chatplatform/utils/messages.js @@ -0,0 +1,9 @@ +const moment = require('moment'); +function formatMessage(username,text) { + return { + username, + text, + time: moment().format('h:mm a') + } +} +module.exports = formatMessage \ No newline at end of file diff --git a/Chatplatform/utils/users.js b/Chatplatform/utils/users.js new file mode 100644 index 00000000..48b96648 --- /dev/null +++ b/Chatplatform/utils/users.js @@ -0,0 +1,32 @@ +const users = []; + +function userJoin(id, username, room) { + const user = { id, username, room }; + + users.push(user); + + return user; +} +// get current user +function getCurrentUser(id) { + return users.find(user => user.id === id); +} + +// user leaves chat +function userLeave(id) { + const index = users.findIndex(user => user.id === id); + if(index !== -1) { + return users.splice(index, 1)[0]; + } +} +// get users in particular room + +function getRoomUsers(room){ + return users.filter(user => user.room === room); +} +module.exports = { + userJoin, + userLeave, + getCurrentUser, + getRoomUsers +} \ No newline at end of file diff --git a/Chess b/Chess new file mode 100644 index 00000000..185f8521 --- /dev/null +++ b/Chess @@ -0,0 +1,691 @@ +import java.awt.*; +import java.awt.event.*; +import java.awt.image.BufferedImage; +import javax.swing.*; +import javax.swing.border.*; +import java.util.ArrayList; + +// Enumeration for different types of chess pieces. +enum PieceType {king, queen, bishop, knight, rook, pawn, none} + +// Enumeration for player colors. +enum PlayerColor {black, white, none} + +// ChessBoard class represents the main structure of the chess game. +public class ChessBoard { + private final JPanel gui = new JPanel(new BorderLayout(3, 3)); + private JPanel chessBoard; + private JButton[][] chessBoardSquares = new JButton[8][8]; + private Piece[][] chessBoardStatus = new Piece[8][8]; + private ImageIcon[] pieceImage_b = new ImageIcon[7]; + private ImageIcon[] pieceImage_w = new ImageIcon[7]; + private JLabel message = new JLabel("Click Reset to Start"); + + // Constructor of the ChessBoard class. + ChessBoard() { + initPieceImages(); // Initializes images for each chess piece. + initBoardStatus(); // Initializes the status of each square on the board. + initializeGui(); // Sets up the GUI layout and components. + } + + // Initializes the board status by placing empty pieces on each square. + public final void initBoardStatus() { + for(int i=0;i<8;i++) { + for(int j=0;j<8;j++) chessBoardStatus[j][i] = new Piece(); + } + } + + // Initializes and scales the images for each type of chess piece. + public final void initPieceImages() { + // Black piece images + pieceImage_b[0] = new ImageIcon(new ImageIcon("./img/king_b.png").getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH)); + pieceImage_b[1] = new ImageIcon(new ImageIcon("./img/queen_b.png").getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH)); + pieceImage_b[2] = new ImageIcon(new ImageIcon("./img/bishop_b.png").getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH)); + pieceImage_b[3] = new ImageIcon(new ImageIcon("./img/knight_b.png").getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH)); + pieceImage_b[4] = new ImageIcon(new ImageIcon("./img/rook_b.png").getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH)); + pieceImage_b[5] = new ImageIcon(new ImageIcon("./img/pawn_b.png").getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH)); + pieceImage_b[6] = new ImageIcon(new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB)); + + // White piece images + pieceImage_w[0] = new ImageIcon(new ImageIcon("./img/king_w.png").getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH)); + pieceImage_w[1] = new ImageIcon(new ImageIcon("./img/queen_w.png").getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH)); + pieceImage_w[2] = new ImageIcon(new ImageIcon("./img/bishop_w.png").getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH)); + pieceImage_w[3] = new ImageIcon(new ImageIcon("./img/knight_w.png").getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH)); + pieceImage_w[4] = new ImageIcon(new ImageIcon("./img/rook_w.png").getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH)); + pieceImage_w[5] = new ImageIcon(new ImageIcon("./img/pawn_w.png").getImage().getScaledInstance(64, 64, Image.SCALE_SMOOTH)); + pieceImage_w[6] = new ImageIcon(new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB)); + } + + // Retrieves the image icon for a given chess piece. + public ImageIcon getImageIcon(Piece piece) { + if(piece.color.equals(PlayerColor.black)) { + if(piece.type.equals(PieceType.king)) return pieceImage_b[0]; + else if(piece.type.equals(PieceType.queen)) return pieceImage_b[1]; + else if(piece.type.equals(PieceType.bishop)) return pieceImage_b[2]; + else if(piece.type.equals(PieceType.knight)) return pieceImage_b[3]; + else if(piece.type.equals(PieceType.rook)) return pieceImage_b[4]; + else if(piece.type.equals(PieceType.pawn)) return pieceImage_b[5]; + else return pieceImage_b[6]; + } + else if(piece.color.equals(PlayerColor.white)) { + if(piece.type.equals(PieceType.king)) return pieceImage_w[0]; + else if(piece.type.equals(PieceType.queen)) return pieceImage_w[1]; + else if(piece.type.equals(PieceType.bishop)) return pieceImage_w[2]; + else if(piece.type.equals(PieceType.knight)) return pieceImage_w[3]; + else if(piece.type.equals(PieceType.rook)) return pieceImage_w[4]; + else if(piece.type.equals(PieceType.pawn)) return pieceImage_w[5]; + else return pieceImage_w[6]; + } + else return pieceImage_w[6]; + } + + // Sets up the main GUI for the chess game. + public final void initializeGui() { + gui.setBorder(new EmptyBorder(5, 5, 5, 5)); + JToolBar tools = new JToolBar(); + tools.setFloatable(false); + gui.add(tools, BorderLayout.PAGE_START); + JButton startButton = new JButton("Reset"); + startButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + initiateBoard(); + } + }); + + tools.add(startButton); + tools.addSeparator(); + tools.add(message); + + chessBoard = new JPanel(new GridLayout(0, 8)); + chessBoard.setBorder(new LineBorder(Color.BLACK)); + gui.add(chessBoard); + ImageIcon defaultIcon = new ImageIcon(new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB)); + Insets buttonMargin = new Insets(0,0,0,0); + for(int i=0; i Moveable; + + // Inner class to handle button (square) actions. + class ButtonListener implements ActionListener { + Point curr; + + ButtonListener(int x, int y) { curr = new Point(x, y); } + + // Handles the action performed when a button (square) is clicked. + public void actionPerformed(ActionEvent e) { + if(end) return; + + Piece Pc = getIcon(curr.x, curr.y); + boolean chgPc = false; + + if(!firstClk) + chgPc = isAlly(curr.x, curr.y, firstPc.color); + + if(firstClk || chgPc) { + if(Pc.color != turn) return; + + if(chgPc) { + for(Point p : Moveable) + unmarkPosition(p.x, p.y); + Moveable = new ArrayList<>(); + } + + switch (Pc.type) { + case pawn: + markPawn(curr.x, curr.y, Pc.color); + break; + case rook: + markRook(curr.x, curr.y, Pc.color); + break; + case knight: + markKnight(curr.x, curr.y, Pc.color); + break; + case bishop: + markBishop(curr.x, curr.y, Pc.color); + break; + case queen: + markQueen(curr.x, curr.y, Pc.color); + break; + case king: + markKing(curr.x, curr.y, Pc.color); + break; + case none: + break; + } + + for(Point p : Moveable) + markPosition(p.x, p.y); + + firstPc = Pc; + firstPt = curr; + firstClk = false; + } + else { + Point secondPt = curr; + boolean isValid = false; + + for(Point p : Moveable) { + if(p.equals(secondPt)) { + isValid = true; + setIcon(curr.x, curr.y, firstPc); + setIcon(firstPt.x, firstPt.y, new Piece()); + for(Point p0 : Moveable) + unmarkPosition(p0.x, p0.y); + + firstClk = true; + Moveable = new ArrayList<>(); + turn = (turn == PlayerColor.black) ? PlayerColor.white : PlayerColor.black; + + if(findKing(turn) == null) { + end = true; + setStatus(turn + "'s turn / GAME OVER"); + break; + } + + String s1 = ""; + String s2 = ""; + + if(isCheck(turn, findKing(turn))) { + s1 = "/ CHECK"; + if(isCheckMate(turn)) { + s2 = "MATE / GAME OVER"; + end = true; + } + } + + setStatus(turn+"'s turn " + s1 + s2); + break; + } + } + + if(!isValid) { + for(Point p : Moveable) + unmarkPosition(p.x, p.y); + firstClk = true; + Moveable = new ArrayList<>(); + } + } + } + } + + // Method to be called upon initiating the board. + void onInitiateBoard() { + turn = PlayerColor.black; + firstClk = true; + Moveable = new ArrayList<>(); + setStatus(turn + "'s turn"); + end = false; + } + + // Marks the possible moves for a pawn. + void markPawn(int x, int y, PlayerColor pc) { + int move = (pc == PlayerColor.black) ? 1 : -1; + if((x==7 && pc == PlayerColor.black) || (x == 0 && pc == PlayerColor.white)) + return; + Piece advance = getIcon(x+move, y); + if(advance.type == PieceType.none) { + Moveable.add(new Point(x+move, y)); + } + if((pc == PlayerColor.black && x == 1) || (pc == PlayerColor.white && x == 6)) { + Piece advanceTwo = getIcon(x+2*move, y); + if(advance.type == PieceType.none && advanceTwo.type == PieceType.none) + Moveable.add(new Point(x+2*move, y)); + } + + switch (y) { + case 0: + if(isEnemy(x+move, y+1, pc)) { + Moveable.add(new Point(x+move, y+1)); + } + break; + case 7: + if(isEnemy(x+move, y-1, pc)) { + Moveable.add(new Point(x+move, y-1)); + } + break; + default: + if(isEnemy(x+move, y+1, pc)) { + Moveable.add(new Point(x+move, y+1)); + } + if(isEnemy(x+move, y-1, pc)) { + Moveable.add(new Point(x+move, y-1)); + } + break; + } + + if(Moveable.isEmpty()) + return; + } + + // Marks the possible moves for a rook. + void markRook(int x, int y, PlayerColor pc) { + for(int i=y+1; i<8; ++i) { + if(getIcon(x, i).type == PieceType.none) + Moveable.add(new Point(x, i)); + if(isAlly(x, i, pc)) + break; + if(isEnemy(x, i, pc)) { + Moveable.add(new Point(x, i)); + break; + } + } + for(int i=y-1; i>=0; --i) { + if(getIcon(x,i).type == PieceType.none) + Moveable.add(new Point(x, i)); + if(isAlly(x, i, pc)) + break; + if(isEnemy(x, i, pc)) { + Moveable.add(new Point(x, i)); + break; + } + } + for(int i=x-1; i>=0; --i) { + if(getIcon(i, y).type == PieceType.none) + Moveable.add(new Point(i, y)); + if(isAlly(i, y, pc)) + break; + if(isEnemy(i, y, pc)) { + Moveable.add(new Point(i, y)); + break; + } + } + for(int i=x+1; i<8; ++i) { + if(getIcon(i, y).type == PieceType.none) + Moveable.add(new Point(i, y)); + if(isAlly(i, y, pc)) + break; + if(isEnemy(i, y, pc)) { + Moveable.add(new Point(i, y)); + break; + } + } + if(Moveable.isEmpty()) return; + } + + // Marks the possible moves for a knight. + void markKnight(int x, int y, PlayerColor pc) { + for(int i=x-2; i<=x+2; i+=4) { + for(int j=y-1; j<=y+1; j+=2) { + if((i>=0) && (i<8) && (j>=0) && (j<8)) { + if(!isAlly(i, j, pc)) Moveable.add(new Point(i, j)); + } + } + } + + for(int i=x-1; i<=x+1; i+=2) { + for(int j=y-2; j<=y+2; j+=4) { + if((i>=0) && (i<8) && (j>=0) && (j<8)) { + if(!isAlly(i, j, pc)) Moveable.add(new Point(i, j)); + } + } + } + } + + // Marks the possible moves for a bishop. + void markBishop(int x, int y, PlayerColor pc) { + for(int i=x-1, j=y+1; i>=0 && j<8; --i, ++j) { + if(getIcon(i, j).type == PieceType.none) + Moveable.add(new Point(i, j)); + if(isAlly(i, j, pc)) + break; + if(isEnemy(i, j, pc)) { + Moveable.add(new Point(i, j)); + break; + } + } + for(int i=x+1, j=y+1; i<8 && j<8; ++i, ++j) { + if(getIcon(i, j).type == PieceType.none) + Moveable.add(new Point(i, j)); + if(isAlly(i, j, pc)) + break; + if(isEnemy(i, j, pc)) { + Moveable.add(new Point(i, j)); + break; + } + } + for(int i=x-1, j=y-1; i>=0 && j>=0; --i, --j) { + if(getIcon(i, j).type == PieceType.none) + Moveable.add(new Point(i, j)); + if(isAlly(i, j, pc)) + break; + if(isEnemy(i, j, pc)) { + Moveable.add(new Point(i, j)); + break; + } + } + for(int i=x+1, j=y-1; i<8 && j>=0; ++i, --j) { + if(getIcon(i, j).type == PieceType.none) + Moveable.add(new Point(i, j)); + if(isAlly(i, j, pc)) + break; + if(isEnemy(i, j,pc)) { + Moveable.add(new Point(i, j)); + break; + } + } + if(Moveable.isEmpty()) + return; + } + + // Marks the possible moves for a queen. + void markQueen(int x, int y, PlayerColor pc) { + markRook(x, y, pc); + markBishop(x, y, pc); + } + + // Marks the possible moves for a king. + void markKing(int x, int y, PlayerColor pc) { + for(int i=x-1; i<=x+1; ++i) { + for(int j=y-1; j<=y+1; ++j) { + if((i>=0) && (i<8) && (j>=0) && (j<8)) { + if(!isAlly(i, j, pc)) + Moveable.add(new Point(i, j)); + } + } + } + } + + // Determines if a given square is occupied by an ally piece. + boolean isAlly(int x, int y, PlayerColor pc) { + return getIcon(x, y).color == pc; + } + + // Determines if a given square is occupied by an enemy piece. + boolean isEnemy(int x, int y, PlayerColor pc) { + return getIcon(x, y).color != pc && getIcon(x, y).color != PlayerColor.none; + } + + // Finds the position of the king of a given color. + Point findKing(PlayerColor pc) { + for(int i=0; i<8; ++i) { + for(int j=0; j<8; ++j) { + if(isAlly(i, j, pc) && getIcon(i, j).type == PieceType.king) + return new Point(i, j); + } + } + return null; + } + + // Checks if the king of a given color is in check. + boolean isCheck(PlayerColor pc, Point king) { + Point kingPosition = king; + + for(int i = kingPosition.x-2; i <= kingPosition.x+2; i += 4) { + for(int j = kingPosition.y-1; j <= kingPosition.y+1; j += 2) { + if((i>=0) && (i<8) && (j>=0) && (j<8)) { + if(isEnemy(i, j, pc) && getIcon(i, j).type == PieceType.knight) + return true; + } + } + } + + for(int i = kingPosition.x-1; i <= kingPosition.x+1; i += 2) { + for(int j = kingPosition.y-2; j <= kingPosition.y+2; j += 4) { + if((i>=0) && (i<8) && (j>=0) && (j<8)) { + if(isEnemy(i, j, pc) && getIcon(i, j).type == PieceType.knight) + return true; + } + } + } + + for(int x = kingPosition.x-1; x >= 0; --x) { + if(isAlly(x, kingPosition.y, pc)) + break; + if(isEnemy(x,kingPosition.y, pc) && ((getIcon(x, kingPosition.y).type == PieceType.rook) || (getIcon(x, kingPosition.y).type == PieceType.queen))) { + return true; + } + } + + for(int x = kingPosition.x+1; x<8; ++x) { + if(isAlly(x, kingPosition.y, pc)) + break; + if(isEnemy(x, kingPosition.y, pc) && ((getIcon(x, kingPosition.y).type == PieceType.rook) || (getIcon(x, kingPosition.y).type == PieceType.queen))) { + return true; + } + } + + for(int y = kingPosition.y+1; y<8; ++y) { + if(isAlly(kingPosition.x, y, pc)) + break; + if(isEnemy(kingPosition.x, y, pc) && ((getIcon(kingPosition.x, y).type == PieceType.rook) || (getIcon(kingPosition.x, y).type == PieceType.queen))) { + return true; + } + } + + for(int y = kingPosition.y-1; y>=0; --y) { + if(isAlly(kingPosition.x, y, pc)) + break; + if(isEnemy(kingPosition.x, y, pc) && ((getIcon(kingPosition.x, y).type == PieceType.rook) || (getIcon(kingPosition.x, y).type == PieceType.queen))) { + return true; + } + } + + for(int x = kingPosition.x-1, y = kingPosition.y-1; x>=0 && y>=0; --x, --y) { + if(isAlly(x, y, pc)) + break; + if(pc == PlayerColor.white && x == kingPosition.x-1) { + if(isEnemy(x, y, pc) && getIcon(x, y).type == PieceType.pawn) + return true; + } + if((isEnemy(x, y, pc)) && ((getIcon(x, y).type == PieceType.bishop) || getIcon(x, y).type == PieceType.queen)) { + return true; + } + } + + for(int x = kingPosition.x+1, y = kingPosition.y-1; x<8 && y>=0; ++x, --y) { + if(isAlly(x, y, pc)) + break; + + if(pc == PlayerColor.black && x == kingPosition.x+1) { + if(isEnemy(x, y, pc) && getIcon(x, y).type == PieceType.pawn) + return true; + } + + if((isEnemy(x, y, pc)) && ((getIcon(x, y).type == PieceType.bishop) || getIcon(x, y).type == PieceType.queen)) { + return true; + } + } + + for(int x = kingPosition.x-1, y = kingPosition.y+1; x >=0 && y<8; --x, ++y) { + if(isAlly(x,y,pc)) + break; + + if(pc == PlayerColor.white && x == kingPosition.x-1) { + if(isEnemy(x, y, pc) && getIcon(x,y).type == PieceType.pawn) + return true; + } + + if((isEnemy(x, y, pc)) && ((getIcon(x, y).type == PieceType.bishop) || getIcon(x, y).type == PieceType.queen)) { + return true; + } + } + + for(int x = kingPosition.x+1, y = kingPosition.y+1; x<8 && y<8; ++x, ++y) { + if(isAlly(x, y, pc)) + break; + + if(pc == PlayerColor.black && x == kingPosition.x+1) { + if(isEnemy(x, y, pc) && getIcon(x, y).type == PieceType.pawn) + return true; + } + + if((isEnemy(x, y, pc)) && ((getIcon(x, y).type == PieceType.bishop) || getIcon(x, y).type == PieceType.queen)) { + return true; + } + } + + return false; + } + + // Checks if the king of a given color is in checkmate. + boolean isCheckMate(PlayerColor pc) { + Point kingPosition = findKing(pc); + boolean isMate = true; + + for(int i=0; i<8; ++i) { + for(int j=0; j<8; ++j) { + if(isAlly(i,j,pc)) { + switch(getIcon(i, j).type) { + case pawn: + markPawn(i, j, pc); + break; + case rook: + markRook(i, j, pc); + break; + case knight: + markKnight(i, j, pc); + break; + case bishop: + markBishop(i, j, pc); + break; + case queen: + markQueen(i, j, pc); + break; + case king: + markKing(i, j, pc); + break; + } + + for(Point p : Moveable) { + Piece originalPiece = getIcon(p.x, p.y); + setIcon(p.x, p.y, getIcon(i, j)); + setIcon(i, j, new Piece()); + + if(!isCheck(pc, findKing(pc))) { + isMate = false; + } + + setIcon(i, j, getIcon(p.x, p.y)); + setIcon(p.x, p.y, originalPiece); + } + Moveable = new ArrayList<>(); + } + } + } + + return isMate; + } +} diff --git a/Color-flipper/.DS_Store b/Color-flipper/.DS_Store new file mode 100644 index 00000000..5b6982d6 Binary files /dev/null and b/Color-flipper/.DS_Store differ diff --git a/Color-flipper/README.md b/Color-flipper/README.md new file mode 100644 index 00000000..40826de5 --- /dev/null +++ b/Color-flipper/README.md @@ -0,0 +1,3 @@ + +Color flipper - +A simple website made with HTML, CSS and JS to get different color codes and view the color in the background. } \ No newline at end of file diff --git a/Color-flipper/hex.html b/Color-flipper/hex.html new file mode 100644 index 00000000..44ddb3aa --- /dev/null +++ b/Color-flipper/hex.html @@ -0,0 +1,29 @@ + + + + + + Color Flipper || Hex + + + + + + +
    +
    +

    background color : #f1f5f8

    + +
    +
    + + + \ No newline at end of file diff --git a/Color-flipper/hex.js b/Color-flipper/hex.js new file mode 100644 index 00000000..9cb33c21 --- /dev/null +++ b/Color-flipper/hex.js @@ -0,0 +1,17 @@ +const hex = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F"]; +const btn = document.getElementById("btn"); +const color = document.querySelector(".color"); + +btn.addEventListener("click", function () { + let hexColor = "#"; + for (let i = 0; i < 6; i++) { + hexColor += hex[getRandomNumber()]; + } + + color.textContent = hexColor; + document.body.style.backgroundColor = hexColor; +}); + +function getRandomNumber() { + return Math.floor(Math.random() * hex.length); +} \ No newline at end of file diff --git a/Color-flipper/index.html b/Color-flipper/index.html new file mode 100644 index 00000000..c8a0ac7a --- /dev/null +++ b/Color-flipper/index.html @@ -0,0 +1,25 @@ + + + + + + Color Flipper || Simple + + + + +
    +
    +

    background color : #f1f5f8

    + +
    +
    + + + diff --git a/Color-flipper/script.js b/Color-flipper/script.js new file mode 100644 index 00000000..7e702317 --- /dev/null +++ b/Color-flipper/script.js @@ -0,0 +1,14 @@ +const colors = ["green", "red", "rgba(133,122,200)", "#f15025"]; +const btn = document.getElementById("btn"); +const color = document.querySelector(".color"); + +btn.addEventListener("click", function () { + const randomNumber = getRandomNumber(); + + document.body.style.backgroundColor = colors[randomNumber]; + color.textContent = colors[randomNumber]; +}); + +function getRandomNumber() { + return Math.floor(Math.random() * colors.length); +} \ No newline at end of file diff --git a/Color-flipper/style.css b/Color-flipper/style.css new file mode 100644 index 00000000..ba145b9e --- /dev/null +++ b/Color-flipper/style.css @@ -0,0 +1,224 @@ + +@import url("https://fonts.googleapis.com/css?family=Open+Sans|Roboto:400,700&display=swap"); + +:root { + --clr-primary-1: hsl(205, 86%, 17%); + --clr-primary-2: hsl(205, 77%, 27%); + --clr-primary-3: hsl(205, 72%, 37%); + --clr-primary-4: hsl(205, 63%, 48%); + --clr-primary-5: hsl(205, 78%, 60%); + --clr-primary-6: hsl(205, 89%, 70%); + --clr-primary-7: hsl(205, 90%, 76%); + --clr-primary-8: hsl(205, 86%, 81%); + --clr-primary-9: hsl(205, 90%, 88%); + --clr-primary-10: hsl(205, 100%, 96%); + --clr-grey-1: hsl(209, 61%, 16%); + --clr-grey-2: hsl(211, 39%, 23%); + --clr-grey-3: hsl(209, 34%, 30%); + --clr-grey-4: hsl(209, 28%, 39%); + --clr-grey-5: hsl(210, 22%, 49%); + --clr-grey-6: hsl(209, 23%, 60%); + --clr-grey-7: hsl(211, 27%, 70%); + --clr-grey-8: hsl(210, 31%, 80%); + --clr-grey-9: hsl(212, 33%, 89%); + --clr-grey-10: hsl(210, 36%, 96%); + --clr-white: #fff; + --clr-red-dark: hsl(360, 67%, 44%); + --clr-red-light: hsl(360, 71%, 66%); + --clr-green-dark: hsl(125, 67%, 44%); + --clr-green-light: hsl(125, 71%, 66%); + --clr-black: #222; + --ff-primary: "Roboto", sans-serif; + --ff-secondary: "Open Sans", sans-serif; + --transition: all 0.3s linear; + --spacing: 0.1rem; + --radius: 0.25rem; + --light-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); + --dark-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); + --max-width: 1170px; + --fixed-width: 620px; +} + +*, +::after, +::before { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: var(--ff-secondary); + background: var(--clr-grey-10); + color: var(--clr-grey-1); + line-height: 1.5; + font-size: 0.875rem; +} + +ul { + list-style-type: none; +} + +a { + text-decoration: none; +} + +h1, +h2, +h3, +h4 { + letter-spacing: var(--spacing); + text-transform: capitalize; + line-height: 1.25; + margin-bottom: 0.75rem; + font-family: var(--ff-primary); +} + +h1 { + font-size: 3rem; +} + +h2 { + font-size: 2rem; +} + +h3 { + font-size: 1.25rem; +} + +h4 { + font-size: 0.875rem; +} + +p { + margin-bottom: 1.25rem; + color: var(--clr-grey-5); +} + +@media screen and (min-width: 800px) { + h1 { + font-size: 4rem; + } + h2 { + font-size: 2.5rem; + } + h3 { + font-size: 1.75rem; + } + h4 { + font-size: 1rem; + } + body { + font-size: 1rem; + } + h1, + h2, + h3, + h4 { + line-height: 1; + } +} + +.section { + padding: 5rem 0; +} + +.section-center { + width: 90vw; + margin: 0 auto; + max-width: 1170px; +} + +@media screen and (min-width: 992px) { + .section-center { + width: 95vw; + } +} + +main { + min-height: 100vh; + display: grid; + place-items: center; +} + +nav { + background: var(--clr-white); + height: 3rem; + display: grid; + align-items: center; + box-shadow: var(--dark-shadow); +} + +.nav-center { + width: 90vw; + max-width: var(--fixed-width); + margin: 0 auto; + display: flex; + align-items: center; + justify-content: space-between; +} + +.nav-center h4 { + margin-bottom: 0; + color: var(--clr-primary-5); +} + +.nav-links { + display: flex; +} + +nav a { + text-transform: capitalize; + font-weight: 700; + font-size: 1rem; + color: var(--clr-primary-1); + letter-spacing: var(--spacing); + margin-right: 1rem; +} +nav a:hover { + color: var(--clr-primary-5); +} + +main { + min-height: calc(100vh - 3rem); + display: grid; + place-items: center; +} + +.container { + text-align: center; +} + +.container h2 { + background: var(--clr-black); + color: var(--clr-white); + padding: 1rem; + border-radius: var(--radius); + margin-bottom: 2.5rem; +} + +.color { + color: var(--clr-primary-5); +} + +.btn-hero { + font-family: var(--ff-primary); + text-transform: uppercase; + background: transparent; + color: var(--clr-black); + letter-spacing: var(--spacing); + display: inline-block; + font-weight: 700; + transition: var(--transition); + border: 2px solid var(--clr-black); + cursor: pointer; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); + border-radius: var(--radius); + font-size: 1rem; + padding: 0.75rem 1.25rem; +} + +.btn-hero:hover { + color: var(--clr-white); + background: var(--clr-black); +} \ No newline at end of file diff --git a/Crypto/BlackiqCryption.py b/Crypto/BlackiqCryption.py new file mode 100644 index 00000000..d243fcc4 --- /dev/null +++ b/Crypto/BlackiqCryption.py @@ -0,0 +1,54 @@ +import sys + +# Encryption/Decryption Mapping +CHAR_MAP = { + 'a': '!', 'b': '@', 'c': '#', 'd': '$', 'e': '%', 'f': '^', 'g': '&', 'h': '*', 'i': '(', 'j': '-', 'k': '+', 'l': '=', 'm': '_', + 'n': '/', 'o': '|', 'p': '}', 'q': '{', 'r': ']', 's': '[', 't': ')', 'u': ':', 'v': ';', 'w': ',', 'x': '>', 'y': '<', 'z': "'", + 'A': '!', 'B': '@', 'C': '#', 'D': '$', 'E': '%', 'F': '^', 'G': '&', 'H': '*', 'I': '(', 'J': '-', 'K': '+', 'L': '=', 'M': '_', + 'N': '/', 'O': '|', 'P': '}', 'Q': '{', 'R': ']', 'S': '[', 'T': ')', 'U': ':', 'V': ';', 'W': ',', 'X': '>', 'Y': '<', 'Z': "'", + ' ': ' ', '.': '.' +} + +REVERSE_MAP = {v: k for k, v in CHAR_MAP.items()} + +# Utility functions for encryption and decryption +def encrypt(text): + """Encrypts the given text using the CHAR_MAP.""" + encrypted_text = ''.join([CHAR_MAP.get(ch, ch) for ch in text]) + return encrypted_text + +def decrypt(text): + """Decrypts the given text using the REVERSE_MAP.""" + decrypted_text = ''.join([REVERSE_MAP.get(ch, ch) for ch in text]) + return decrypted_text + +def validate_input(option, text): + """Validates user input for encryption/decryption.""" + if option not in ['C', 'E']: + print("Invalid option. Please choose 'C' for encryption or 'E' for decryption.") + sys.exit(1) + if not text.strip(): + print("Input text cannot be empty.") + sys.exit(1) + +def main(): + print("Welcome to BlackIQCryption") + print("Choose an option: ") + print("C - Cryption (Encryption)") + print("E - Encryotion (Decryption)") + + option = input("What do you want? C or E: ").strip().upper() + text = input("Enter your text: ").strip() + + # Validate inputs + validate_input(option, text) + + if option == 'C': + result = encrypt(text) + print(f"Encrypted Text: {result}") + elif option == 'E': + result = decrypt(text) + print(f"Decrypted Text: {result}") + +if __name__ == "__main__": + main() diff --git a/DS - extract and plot data/.DS_Store b/DS - extract and plot data/.DS_Store new file mode 100644 index 00000000..8882ac1b Binary files /dev/null and b/DS - extract and plot data/.DS_Store differ diff --git a/DS - extract and plot data/data.csv b/DS - extract and plot data/data.csv new file mode 100644 index 00000000..4ccc8bc1 --- /dev/null +++ b/DS - extract and plot data/data.csv @@ -0,0 +1,13 @@ +Month,Product_A,Product_B +Jan,120,100 +Feb,135,115 +Mar,150,130 +Apr,160,140 +May,180,160 +Jun,200,170 +Jul,210,190 +Aug,220,200 +Sep,195,180 +Oct,205,195 +Nov,215,210 +Dec,230,220 diff --git a/DS - extract and plot data/extractandplot.py b/DS - extract and plot data/extractandplot.py new file mode 100644 index 00000000..e8c60e89 --- /dev/null +++ b/DS - extract and plot data/extractandplot.py @@ -0,0 +1,23 @@ +#author: seema kumari patel +# Implementation of data extraction and plotting using pandas and matplotlib + +import pandas as pd +import matplotlib.pyplot as plt + +# Read the CSV file +df = pd.read_csv("data.csv") + +# Display first few rows +print(df.head()) + +# Plot sales trends +plt.figure(figsize=(10,6)) +plt.plot(df['Month'], df['Product_A'], marker='o', label='Product A') +plt.plot(df['Month'], df['Product_B'], marker='s', label='Product B') + +plt.title("Monthly Sales Data") +plt.xlabel("Month") +plt.ylabel("Units Sold") +plt.legend() +plt.grid(True) +plt.show() diff --git a/Dice_Game/DiceJS.js b/Dice_Game/DiceJS.js new file mode 100644 index 00000000..90432605 --- /dev/null +++ b/Dice_Game/DiceJS.js @@ -0,0 +1,21 @@ +const RandomOne= Math.floor(Math.random()*6 + 1); + +const ImageOne = './img/dice' + RandomOne + '.png'; + +document.querySelectorAll('img')[0].setAttribute('src', ImageOne); + +const RandomTwo= Math.floor(Math.random()*6 + 1); + +const ImageTwo = './img/dice' + RandomTwo + '.png'; + +document.querySelectorAll('img')[1].setAttribute('src', ImageTwo); + +if(RandomOne > RandomTwo){ + document.querySelector('h1').innerHTML = 'Player 1 Wins !! Congratulations!'; +} +else if(RandomOne < RandomTwo){ + document.querySelector('h1').innerHTML = 'Player 2 Wins !! Congratulations!'; +} +else{ + document.querySelector('h1').innerHTML = 'Game Draw !'; +} \ No newline at end of file diff --git a/Dice_Game/DiceStyle.css b/Dice_Game/DiceStyle.css new file mode 100644 index 00000000..39f64803 --- /dev/null +++ b/Dice_Game/DiceStyle.css @@ -0,0 +1,88 @@ +body { + background: linear-gradient(to right, rgba(255, 0, 0, 0), rgba(255, 0, 0, 1)); +} + +p { + font-family: Verdana, Geneva, Tahoma, sans-serif; + font-weight: bold; + font-size: 2.5rem; + color: rgb(0, 8, 255); +} + +.main { + width: 100%; + text-align: center; + margin: auto; +} + +h1 { + font-size: 3rem; + text-align: center; + color: rgb(0, 0, 0); + margin: 0; + font-family: cursive; + text-shadow: 3px 3px red; +} + +.cont { + display: inline-block; + margin: 0px 50px; + text-align: center; +} + +button { + width: 30%; + background-color: green; + font-size: 2rem; + font-weight: bold; + padding: 10px; + margin-left: 37%; + border-radius: 10px; + cursor: pointer; +} + +button:hover { + background-color: limegreen; +} + +#fb:hover { + color: blue; +} + +#linkedin:hover { + color: darkblue; +} +#github:hover { + color: rgb(130, 130, 130); +} + +#insta:hover { + color: rgb(241, 43, 76); +} + +#tweet:hover { + color: #1da1f2; +} + +#mail:hover { + color: #bb001b; +} + +a { + color: black; +} + +img { + width: 100px; + height: 100px; + -webkit-animation: mover 1s infinite alternate; + animation: mover 1s infinite alternate; +} +@keyframes mover { + 0% { + transform: translateY(0); + } + 100% { + transform: translateY(-10px); + } +} diff --git a/Dice_Game/RollingDiceGame.html b/Dice_Game/RollingDiceGame.html new file mode 100644 index 00000000..64ea3b55 --- /dev/null +++ b/Dice_Game/RollingDiceGame.html @@ -0,0 +1,62 @@ + + + + + + + Rolling Dice Game + + + + + +
    +

    Rolling Dice Game

    +
    +

    Player 1

    + +
    + +
    +

    Player 2

    + +
    +
    + +
    + Made by: its-hrs +

    Contact Me:

    +
    + + + + + +
    + + + + + + + + diff --git a/Dice_Game/img/dice1.png b/Dice_Game/img/dice1.png new file mode 100644 index 00000000..543a9eec Binary files /dev/null and b/Dice_Game/img/dice1.png differ diff --git a/Dice_Game/img/dice2.png b/Dice_Game/img/dice2.png new file mode 100644 index 00000000..472bbacd Binary files /dev/null and b/Dice_Game/img/dice2.png differ diff --git a/Dice_Game/img/dice3.png b/Dice_Game/img/dice3.png new file mode 100644 index 00000000..5bb30aad Binary files /dev/null and b/Dice_Game/img/dice3.png differ diff --git a/Dice_Game/img/dice4.png b/Dice_Game/img/dice4.png new file mode 100644 index 00000000..2c116a94 Binary files /dev/null and b/Dice_Game/img/dice4.png differ diff --git a/Dice_Game/img/dice5.png b/Dice_Game/img/dice5.png new file mode 100644 index 00000000..d566cd85 Binary files /dev/null and b/Dice_Game/img/dice5.png differ diff --git a/Dice_Game/img/dice6.png b/Dice_Game/img/dice6.png new file mode 100644 index 00000000..8b98b3c3 Binary files /dev/null and b/Dice_Game/img/dice6.png differ diff --git a/Drum kit/images/crash.png b/Drum kit/images/crash.png new file mode 100644 index 00000000..a992fa0f Binary files /dev/null and b/Drum kit/images/crash.png differ diff --git a/Drum kit/images/kick.png b/Drum kit/images/kick.png new file mode 100644 index 00000000..b64877e7 Binary files /dev/null and b/Drum kit/images/kick.png differ diff --git a/Drum kit/images/snare.png b/Drum kit/images/snare.png new file mode 100644 index 00000000..1e089bac Binary files /dev/null and b/Drum kit/images/snare.png differ diff --git a/Drum kit/images/tom1.png b/Drum kit/images/tom1.png new file mode 100644 index 00000000..855b2111 Binary files /dev/null and b/Drum kit/images/tom1.png differ diff --git a/Drum kit/images/tom2.png b/Drum kit/images/tom2.png new file mode 100644 index 00000000..3e9f3636 Binary files /dev/null and b/Drum kit/images/tom2.png differ diff --git a/Drum kit/images/tom3.png b/Drum kit/images/tom3.png new file mode 100644 index 00000000..762cbf85 Binary files /dev/null and b/Drum kit/images/tom3.png differ diff --git a/Drum kit/images/tom4.png b/Drum kit/images/tom4.png new file mode 100644 index 00000000..e79c49e1 Binary files /dev/null and b/Drum kit/images/tom4.png differ diff --git a/Drum kit/index.html b/Drum kit/index.html new file mode 100644 index 00000000..39b2dbdf --- /dev/null +++ b/Drum kit/index.html @@ -0,0 +1,28 @@ + + + + + + Drum Kit + + + + + + +

    Drum 🥁 Kit

    +
    + + + + + + + +
    + + + + + + diff --git a/Drum kit/index.js b/Drum kit/index.js new file mode 100644 index 00000000..05a8f9eb --- /dev/null +++ b/Drum kit/index.js @@ -0,0 +1,83 @@ + +var numberOfDrumButtons = document.querySelectorAll(".drum").length; + +for(var i = 0; i< numberOfDrumButtons; i++) { + +document.querySelectorAll(".drum")[i].addEventListener( "click",function() { + +var buttonInnerHTML = this.innerHTML; + +makeSound(buttonInnerHTML); + +buttonAnimation(buttonInnerHTML); + +}); + +} + + +document.addEventListener("keypress", function(event) { + +makeSound(event.key); + +buttonAnimation(event.key); + +}); + +function makeSound(key) { + +switch (key) { + case "w": + var tom1 = new Audio('sounds/tom-1.mp3'); + tom1.play(); + break; + + case "a": + var tom2 = new Audio('sounds/tom-2.mp3'); + tom2.play(); + break; + + case "s": + var tom3 = new Audio('sounds/tom-3.mp3'); + tom3.play(); + break; + + case "d": + var tom4 = new Audio('sounds/tom-4.mp3'); + tom4.play(); + break; + + case "j": + var snare = new Audio('sounds/snare.mp3'); + snare.play(); + break; + + case "k": + var crash = new Audio('sounds/crash.mp3'); + crash.play(); + break; + + case "l": + var kick = new Audio('sounds/kick-bass.mp3'); + kick.play(); + break; + + + default: console.log(key); + +} + +} + +function buttonAnimation(currentKey){ + + var activeButton = document.querySelector("." + currentKey); + + activeButton.classList.add("pressed"); + + setTimeout(function(){ + + activeButton.classList.remove("pressed"); + }, 100); + +} \ No newline at end of file diff --git a/Drum kit/run.js b/Drum kit/run.js new file mode 100644 index 00000000..46e326a8 --- /dev/null +++ b/Drum kit/run.js @@ -0,0 +1,81 @@ +var numberOfDrumButtons = document.querySelectorAll(".drum").length; + +for (var i = 0; i < numberOfDrumButtons; i++) { + + document.querySelectorAll(".drum")[i].addEventListener("click", function() { + + var buttonInnerHTML = this.innerHTML; + + makeSound(buttonInnerHTML); + + // buttonAnimation(buttonInnerHTML); + + }); + +} + +document.addEventListener("keypress", function(event) { + + makeSound(event.key); + + //buttonAnimation(event.key); + +}); + + +function makeSound(key) { + + switch (key) { + case "w": + var tom1 = new Audio("sounds/tom-1.mp3"); + tom1.play(); + break; + + case "a": + var tom2 = new Audio("sounds/tom-2.mp3"); + tom2.play(); + break; + + case "s": + var tom3 = new Audio('sounds/tom-3.mp3'); + tom3.play(); + break; + + case "d": + var tom4 = new Audio('sounds/tom-4.mp3'); + tom4.play(); + break; + + case "j": + var snare = new Audio('sounds/snare.mp3'); + snare.play(); + break; + + case "k": + var crash = new Audio('sounds/crash.mp3'); + crash.play(); + break; + + case "l": + var kick = new Audio('sounds/kick-bass.mp3'); + kick.play(); + break; + + + default: console.log(key); + + } +} + +/* +function buttonAnimation(currentKey) { + + var activeButton = document.querySelector("." + currentKey); + + activeButton.classList.add("pressed"); + + setTimeout(function() { + activeButton.classList.remove("pressed"); + }, 100); + +} */ diff --git a/Drum kit/sounds/crash.mp3 b/Drum kit/sounds/crash.mp3 new file mode 100644 index 00000000..d5680626 Binary files /dev/null and b/Drum kit/sounds/crash.mp3 differ diff --git a/Drum kit/sounds/kick-bass.mp3 b/Drum kit/sounds/kick-bass.mp3 new file mode 100644 index 00000000..faf06c6c Binary files /dev/null and b/Drum kit/sounds/kick-bass.mp3 differ diff --git a/Drum kit/sounds/snare.mp3 b/Drum kit/sounds/snare.mp3 new file mode 100644 index 00000000..e7cf5b84 Binary files /dev/null and b/Drum kit/sounds/snare.mp3 differ diff --git a/Drum kit/sounds/tom-1.mp3 b/Drum kit/sounds/tom-1.mp3 new file mode 100644 index 00000000..7dc3003d Binary files /dev/null and b/Drum kit/sounds/tom-1.mp3 differ diff --git a/Drum kit/sounds/tom-2.mp3 b/Drum kit/sounds/tom-2.mp3 new file mode 100644 index 00000000..f3c04855 Binary files /dev/null and b/Drum kit/sounds/tom-2.mp3 differ diff --git a/Drum kit/sounds/tom-3.mp3 b/Drum kit/sounds/tom-3.mp3 new file mode 100644 index 00000000..38060330 Binary files /dev/null and b/Drum kit/sounds/tom-3.mp3 differ diff --git a/Drum kit/sounds/tom-4.mp3 b/Drum kit/sounds/tom-4.mp3 new file mode 100644 index 00000000..58b04beb Binary files /dev/null and b/Drum kit/sounds/tom-4.mp3 differ diff --git a/Drum kit/styles.css b/Drum kit/styles.css new file mode 100644 index 00000000..7c418e71 --- /dev/null +++ b/Drum kit/styles.css @@ -0,0 +1,88 @@ +body { + text-align: center; + background-color: #283149; +} + +h1 { + font-size: 5rem; + color: #DBEDF3; + font-family: "Arvo", cursive; + text-shadow: 3px 0 #DA0463; + +} + +footer { + color: #DBEDF3; + font-family: sans-serif; +} + +.w { + + background-image: url("images/tom1.png"); +} + +.a { + + background-image: url("images/tom2.png"); +} + +.s { + + background-image: url("images/tom3.png"); +} + +.d { + + background-image: url("images/tom4.png"); +} + +.j { + + background-image: url("images/snare.png"); +} + +.k { + + background-image: url("images/crash.png"); +} + +.l { + + background-image: url("images/kick.png"); +} + +.set { + margin: 10% auto; +} + +.game-over { + background-color: red; + opacity: 0.8; +} + +.pressed { + box-shadow: 0 3px 4px 0 #DBEDF3; + opacity: 0.5; +} + +.red { + color: red; +} + +.drum { + outline: none; + border: 10px solid #404B69; + font-size: 5rem; + font-family: 'Arvo', cursive; + line-height: 2; + font-weight: 900; + color: #DA0463; + text-shadow: 3px 0 #DBEDF3; + border-radius: 15px; + display: inline-block; + width: 150px; + height: 150px; + text-align: center; + margin: 10px; + background-color: white; +} diff --git a/Dynamic_calendar/index.html b/Dynamic_calendar/index.html new file mode 100644 index 00000000..0b3cfb7c --- /dev/null +++ b/Dynamic_calendar/index.html @@ -0,0 +1,43 @@ + + + + + + + Dynamic Calendar + + + + + + + + +
    +
    +

    October 2022

    +
    + arrow_back_ios + arrow_forward_ios +
    +
    +
    +
      +
    • Sun
    • +
    • Mon
    • +
    • Tue
    • +
    • Wed
    • +
    • Thu
    • +
    • Fri
    • +
    • Sat
    • +
    +
      +
    +
    +
    + + + diff --git a/Dynamic_calendar/script.js b/Dynamic_calendar/script.js new file mode 100644 index 00000000..1203638c --- /dev/null +++ b/Dynamic_calendar/script.js @@ -0,0 +1,52 @@ +const currentDate = document.querySelector(".current-date"), +daysTag = document.querySelector(".days"), +prevNextIcon = document.querySelectorAll(".icons span"); + +let date = new Date(); +currYear = date.getFullYear(); +currMonth = date.getMonth(); + +const months = ["January","February","March","April","May","June","July","August","September","October","November","December"]; +const renderCalendar = () =>{ + let firstDayOfMonth = new Date(currYear,currMonth,1).getDay(), // getting first day of month + lastDateofMonth = new Date(currYear,currMonth + 1,0).getDate(), // getting last date of month + lastDayofMonth = new Date(currYear,currMonth,lastDateofMonth).getDay(), // getting last day of month + lastDateofLastMonth = new Date(currYear,currMonth ,0).getDate(); // getting last date of last month + let liTag = ""; + + for (let i = firstDayOfMonth;i > 0; i--) { // previous month last date days + liTag += `
  • ${lastDateofLastMonth - i + 1}
  • `; + } + + for (let i = 1; i <= lastDateofMonth; i++) { // creating li of all days of current month + let isToday = i === date.getDate() && currMonth === new Date().getMonth() && currYear === new Date().getFullYear() ? "active" : ""; + liTag += `
  • ${i}
  • `; + } + + for (let i = lastDayofMonth; i < 6 ;i++) { // next month first days + liTag += `
  • ` + + } + + currentDate.innerText = `${months[currMonth]} ${currYear}`; + daysTag.innerHTML = liTag; + +} +renderCalendar(); + +prevNextIcon.forEach(icon =>{ + icon.addEventListener("click",()=>{ + currMonth = icon.id === "prev"? currMonth - 1 : currMonth + 1; + + if(currMonth < 0 || currMonth > 11){ + date = new Date(currYear,currMonth); + currYear = date.getFullYear(); + currMonth = date.getMonth(); + } + else{ + date = new Date(); + } + + renderCalendar(); + }); +}) diff --git a/Dynamic_calendar/style.css b/Dynamic_calendar/style.css new file mode 100644 index 00000000..4cc9c09d --- /dev/null +++ b/Dynamic_calendar/style.css @@ -0,0 +1,89 @@ +@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@700&display=swap'); + +* { + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: 'Poppins', sans-serif; +} +body { + display: flex; + align-items: center; + justify-content: center; + min-height: 100vh; + background: #9b59b6; +} +.wrapper { + width: 450px; + height: 500px; + background: #fff; + border-radius: 5px; +} +.wrapper header { + display: flex; + align-items: center; + padding: 25px 30px 10px; + justify-content: space-between; +} +header .current-date { + font-size: 1.4rem; + font-weight: 500; +} +header .icons span { + height: 38px; + width: 38px; + text-align: center; + line-height: 38px; + border-radius: 50%; + cursor: pointer; +} +header .icons span:hover { + background: #f2f2f2; +} +.calendar { + padding: 20px; +} +.calendar ul { + display: flex; + list-style: none; + flex-wrap: wrap; + text-align: center; +} +.calendar .days { + margin-bottom: 20px; +} +.calendar .weeks li { + font-weight: 500; +} +.calendar ul li { + position: relative; + width: calc(100% / 7); +} +.calendar .days li { + z-index: 1; + cursor: pointer; + margin-top: 30px; +} +.days li.inactive { + color: #aaa; +} +.days li.active { + color: #fff; +} +.calendar .days li::before { + position: absolute; + content: ''; + height: 40px; + width: 40px; + top: 50%; + left: 50%; + z-index: -1; + border-radius: 50%; + transform: translate(-50%, -50%); +} +.days li:hover::before { + background: #f2f2f2; +} +.days li.active::before { + background: #9b59b6; +} diff --git a/Full_shooting_game/index.html b/Full_shooting_game/index.html new file mode 100644 index 00000000..ef6b0648 --- /dev/null +++ b/Full_shooting_game/index.html @@ -0,0 +1,1160 @@ + + + + + JavaScript Shooting Game + + + + + + diff --git a/Grade & Simple-Calculator/home.js b/Grade & Simple-Calculator/home.js index fba0be72..05d0ec01 100644 --- a/Grade & Simple-Calculator/home.js +++ b/Grade & Simple-Calculator/home.js @@ -1,6 +1,4 @@ -let screen = document.getElementById('screen'); -buttons = document.querySelectorAll('button'); -let screenValue = ''; + for (item of buttons) { item.addEventListener('click', (e) => { buttonText = e.target.innerText; @@ -79,4 +77,4 @@ const getResult = () => { document.getElementById('percentage').innerHTML = percentage; document.getElementById('total').innerHTML = total; -} \ No newline at end of file +} diff --git a/Grade-Calc/dinner.menu.py b/Grade-Calc/dinner.menu.py new file mode 100644 index 00000000..9e7bad2f --- /dev/null +++ b/Grade-Calc/dinner.menu.py @@ -0,0 +1,26 @@ +import random + +def pick_dinner(): + # List of dinner options + dinner_options = [ + "Spaghetti Bolognese", + "Grilled Chicken with Vegetables", + "Tacos with Beef and Salsa", + "Vegetable Stir Fry with Rice", + "Salmon with Asparagus", + "Homemade Pizza", + "Beef Stroganoff", + "Quinoa Salad with Chickpeas", + "Shrimp Curry", + "Stuffed Bell Peppers" + ] + + # Randomly select a dinner option + selected_dinner = random.choice(dinner_options) + + return selected_dinner + +# Pick and print a dinner option +if __name__ == "__main__": + dinner = pick_dinner() + print(f"Tonight's dinner option is: {dinner}") diff --git a/Grade-Calc/home.js b/Grade-Calc/home.js index fba0be72..4c4f123d 100644 --- a/Grade-Calc/home.js +++ b/Grade-Calc/home.js @@ -1,29 +1,3 @@ -let screen = document.getElementById('screen'); -buttons = document.querySelectorAll('button'); -let screenValue = ''; -for (item of buttons) { - item.addEventListener('click', (e) => { - buttonText = e.target.innerText; - console.log('Button text is ', buttonText); - if (buttonText == 'X') { - buttonText = '*'; - screenValue += buttonText; - screen.value = screenValue; - } - else if (buttonText == 'C') { - screenValue = ""; - screen.value = screenValue; - } - else if (buttonText == '=') { - screen.value = eval(screenValue); - } - else { - screenValue += buttonText; - screen.value = screenValue; - } - - }) -} @@ -79,4 +53,5 @@ const getResult = () => { document.getElementById('percentage').innerHTML = percentage; document.getElementById('total').innerHTML = total; -} \ No newline at end of file + +} diff --git a/Grade-Calc/volume.generator.py b/Grade-Calc/volume.generator.py new file mode 100644 index 00000000..0dca884e --- /dev/null +++ b/Grade-Calc/volume.generator.py @@ -0,0 +1,14 @@ +# Function to calculate the volume of a rectangular prism +def calculate_volume(length, width, height): + return length * width * height + +# Get user input for dimensions +length = float(input("Enter the length of the rectangular prism: ")) +width = float(input("Enter the width of the rectangular prism: ")) +height = float(input("Enter the height of the rectangular prism: ")) + +# Calculate the volume +volume = calculate_volume(length, width, height) + +# Display the result +print(f"The volume of the rectangular prism is: {volume} cubic units") diff --git a/Guess the number.py b/Guess the number.py new file mode 100644 index 00000000..b5ad696b --- /dev/null +++ b/Guess the number.py @@ -0,0 +1,34 @@ +import random + +def number_guessing_game(): + # Generate a random number between 1 and 100 + number_to_guess = random.randint(1, 100) + attempts = 0 + print("Welcome to the Number Guessing Game!") + print("I have picked a number between 1 and 100.") + print("Can you guess what it is?") + + while True: + # Ask the player for a guess + player_guess = input("Enter your guess: ") + + try: + # Convert the guess to an integer + player_guess = int(player_guess) + except ValueError: + print("Please enter a valid number.") + continue + + attempts += 1 + + # Check the player's guess + if player_guess < number_to_guess: + print("Too low! Try again.") + elif player_guess > number_to_guess: + print("Too high! Try again.") + else: + print(f"Congratulations! You've guessed the number in {attempts} attempts.") + break + +# Start the game +number_guessing_game() diff --git a/Guess the number/index.html b/Guess the number/index.html new file mode 100644 index 00000000..2cbeac68 --- /dev/null +++ b/Guess the number/index.html @@ -0,0 +1,18 @@ + + + + + + Guess the Number Game + + + + +

    Try to guess the number between 0 and 100.

    + + + + + + + diff --git a/Guess the number/number.guessing.game.py b/Guess the number/number.guessing.game.py new file mode 100644 index 00000000..488f748c --- /dev/null +++ b/Guess the number/number.guessing.game.py @@ -0,0 +1,29 @@ +import random + +def number_guessing_game(): + print("Welcome to the Number Guessing Game!") + print("I have selected a number between 1 and 100. Try to guess it!") + + # Generate a random number between 1 and 100 + secret_number = random.randint(1, 100) + attempts = 0 + + while True: + # Get the user's guess + try: + guess = int(input("Enter your guess: ")) + attempts += 1 + + # Check if the guess is too low, too high, or correct + if guess < secret_number: + print("Too low! Try again.") + elif guess > secret_number: + print("Too high! Try again.") + else: + print(f"Congratulations! You've guessed the number {secret_number} in {attempts} attempts.") + break + except ValueError: + print("Invalid input. Please enter a number between 1 and 100.") + +if __name__ == "__main__": + number_guessing_game() diff --git a/Guess the number/script.js b/Guess the number/script.js new file mode 100644 index 00000000..db171eb9 --- /dev/null +++ b/Guess the number/script.js @@ -0,0 +1,10 @@ + + +document.getElementById('reset').addEventListener('click', function() { + randomNumber = Math.floor(Math.random() * 101); + attempts = 0; + document.getElementById('result').textContent = ''; + document.getElementById('guess').value = ''; + document.getElementById('submit').disabled = false; + this.style.display = 'none'; +}); diff --git a/Guess the number/style.css b/Guess the number/style.css new file mode 100644 index 00000000..05a24e49 --- /dev/null +++ b/Guess the number/style.css @@ -0,0 +1,71 @@ +body { + font-family: 'Arial', sans-serif; + background: linear-gradient(to right, #6a11cb, #2575fc); + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; + color: #000000; +} + +.container { + background: rgba(255, 255, 255, 0.9); + padding: 30px; + border-radius: 12px; + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2); + text-align: center; + width: 300px; +} + +h1 { + margin-bottom: 20px; + font-size: 24px; +} + +p { + margin: 10px 0; + font-size: 16px; +} + +input { + padding: 10px; + border: 2px solid #6a11cb; + border-radius: 5px; + width: calc(100% - 24px); + font-size: 16px; + margin-bottom: 10px; + transition: border-color 0.3s; +} + +input:focus { + border-color: #2575fc; + outline: none; +} + +button { + padding: 10px 15px; + border: none; + border-radius: 5px; + background: #6a11cb; + color: #fff; + font-size: 16px; + cursor: pointer; + transition: background 0.3s, transform 0.3s; +} + +button:hover { + background: #2575fc; + transform: scale(1.05); +} + +button:disabled { + background: #ccc; + cursor: not-allowed; +} + +#result { + font-size: 1.2em; + margin-top: 20px; + font-weight: bold; +} diff --git a/Guess the word game/Main.java b/Guess the word game/Main.java new file mode 100644 index 00000000..c27b7052 --- /dev/null +++ b/Guess the word game/Main.java @@ -0,0 +1,41 @@ +```java +import java.util.Random; +import java.util.Scanner; + +class Main { + public static void main(String[] args) { + Hangman game = new Hangman(); + game.start(); + } +} + +class Hangman { + private static final String ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + private static final int WORD_LENGTH = 6; + private final Random random = new Random(); + private final Scanner scanner = new Scanner(System.in); + private final char[] word = new char[WORD_LENGTH]; + private final char[] display = new char[WORD_LENGTH]; + private int attemptsRemaining = 6; + + public void start() { + generateWord(); + System.out.println("Guess the " + WORD_LENGTH + "-letter word:"); + displayWord(); + play(); + } + + private void generateWord() { + for (int i = 0; i < WORD_LENGTH; i++) { + word[i] = ALPHABET.charAt(random.nextInt(ALPHABET.length())); + display[i] = '_'; + } + } + + private void displayWord() { + for (int i = 0; i < WORD_LENGTH; i++) { + System.out.print(display[i] + " "); + } + System.out.println(); + } +``` diff --git a/HTML Website/simpleweb.html b/HTML Website/simpleweb.html new file mode 100644 index 00000000..f724ad18 --- /dev/null +++ b/HTML Website/simpleweb.html @@ -0,0 +1,82 @@ + + + + + + Simple Website + + + + + + + + + + + +
    + + +
    +

    Home project

    +

    Welcome to our website! Here, we share tips, resources, and inspiration for beginners learning web development.

    +
    + + + + + + + + +
    +

    What Our Visitors Say

    +
    + "This website made learning HTML so much easier!" – Alex +
    + +
    + + +
    +

    Frequently Asked Questions

    +

    Q: Do I need any prior experience?

    +

    A: No prior experience is needed. We guide you through everything step-by-step.

    +

    Q: Can I access resources for free?

    +

    A: Yes, all our beginner resources are free and easy to follow.

    +
    + + +
    +

    Contact Us

    +

    If you have any questions or would like to leave feedback, please fill out the form below:

    +
    +
    +
    + +
    +
    + +
    +
    + + +
    +
    +
    + + +
    +

    © 2024 Simple Website. All rights reserved.

    +
    + + + diff --git a/HTML-TRICKS/Datalist/index.html b/HTML-TRICKS/Datalist/index.html new file mode 100644 index 00000000..0207bae2 --- /dev/null +++ b/HTML-TRICKS/Datalist/index.html @@ -0,0 +1,34 @@ + + + + + + + HTML Tips and Tricks - Datalist Tag + + + + + + +
    + + home + +

    Datalist Tag

    +
    + + + + + +
    +
    + + + diff --git a/HTML-TRICKS/Dialog/index.html b/HTML-TRICKS/Dialog/index.html new file mode 100644 index 00000000..b2720b5d --- /dev/null +++ b/HTML-TRICKS/Dialog/index.html @@ -0,0 +1,49 @@ + + + + + + + HTML Tips and Tricks - Dialog Tag + + + + + + +
    + + home + +

    Dialog Tag

    + + + + +
    +

    I'm a Dialog

    +

    What do you think of me?

    + + + +
    +
    + +
    + + + + + diff --git a/HTML-TRICKS/Inputs/index.html b/HTML-TRICKS/Inputs/index.html new file mode 100644 index 00000000..6c29f0a2 --- /dev/null +++ b/HTML-TRICKS/Inputs/index.html @@ -0,0 +1,79 @@ + + + + + + + HTML Tips and Tricks - Inputs + + + + + + + + +
    + + home + +

    All about Inputs

    + + +
    +

    Required

    +
    + + + +
    +
    + +
    +

    Autofocus

    +
    + + + +
    +
    + +
    +

    Placeholder

    +
    + + + +
    +
    + +
    +

    E-mail

    +
    + + + +
    +
    + +
    +

    Regex validations

    +
    + + + +
    +
    +
    + + + diff --git a/HTML-TRICKS/README.md b/HTML-TRICKS/README.md new file mode 100644 index 00000000..50334439 --- /dev/null +++ b/HTML-TRICKS/README.md @@ -0,0 +1,25 @@ +Here’s a clear and concise explanation in English of the given text: + +- **Original text**: + - `# html-tips-tricks` + - `Guys, feel free to add here more cool html demos and tricks to help newbies..` +- **What it communicates**: + - The line `# html-tips-tricks` is a heading, likely indicating a section or repository titled “html-tips-tricks.” + - The sentence invites people (informally addressed as “Guys”) to contribute additional interesting HTML demos and tricks. + - The goal is to help beginners or newbies by sharing useful, cool examples. + +- **Key ideas expressed**: + - A community or collaborative space for HTML tips. + - Encouragement for others to add new demos and tricks. + - The target audience is beginners/newbies, aiming to assist them. + +- **Suggestions to improve clarity (optional)**: + - Use more inclusive language: replace “Guys” with “Everyone” or “Hello everyone.” + - Add a brief example or guidelines for contributions. + - Correct the trailing period to a single period for punctuation consistency. + +- **Example revised version**: + - `# html-tips-tricks` + - “Everyone is welcome to add more cool HTML demos and tricks here to help beginners.” + +If you’d like, I can tailor this message for a specific platform (GitHub README, Markdown post, or a forum thread) and add contribution guidelines. diff --git a/HTML-TRICKS/main.css b/HTML-TRICKS/main.css new file mode 100644 index 00000000..71d466cd --- /dev/null +++ b/HTML-TRICKS/main.css @@ -0,0 +1,77 @@ +body { + background-color: #000000; + color: #ffffff; + font-family: 'Chilanka', cursive; +} + +a { + color: #61dafb; +} + +table { + border-collapse: collapse; + width: 100%; +} + +th, +td { + padding: 8px; + text-align: left; + border-bottom: 1px solid #ddd; +} + +li { + list-style: none; +} + +.home { + text-decoration: none; +} + +.home span { + font-size: 25px;; +} + +.box { + border: 1px dotted; + border-radius: 5px; + padding: 10px; + width: 80%; + margin: 10px; +} +.demo { + margin: 10px auto 30px auto; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; +} + +.demo .list li{ + padding: 10px; +} + +.demo .content-editable { + border: 1px solid; + border-radius: 5px; + padding: 10px; +} + +.demo .data-attribute { + padding: 10px; +} + +.demo .range output { + font-size: 62px; +} + +dialog::backdrop { + background: repeating-linear-gradient( + 45deg, + rgba(0, 0, 0, 0.2), + rgba(0, 0, 0, 0.2) 1px, + rgba(0, 0, 0, 0.3) 1px, + rgba(0, 0, 0, 0.3) 20px + ); + backdrop-filter: blur(3px); +} diff --git a/HTML_BORDER/index.css b/HTML_BORDER/index.css new file mode 100644 index 00000000..7208d885 --- /dev/null +++ b/HTML_BORDER/index.css @@ -0,0 +1,48 @@ +h2 { + margin: 10px 20px; + } + .border-box { + display: flex; + flex-direction: column; + margin: 10px 20px; + } + .box-style { + background-color: rgb(186, 85, 211, 0.1); + padding: 1rem; + width: 200px; + margin-bottom: 1rem; + } + .b-t-s { + border: 4px #ba55d3; + border-top-style: solid; + } + .b-r-s { + border: 4px #ba55d3; + border-right-style: solid; + } + + .b-bt-s { + border: 4px #ba55d3; + border-bottom-style: solid; + } + .b-l-s { + border: 4px #ba55d3; + border-left-style: solid; + } + .one-value { + border: 4px #ba55d3; + border-style: solid; + } + .two-value { + border: 4px #ba55d3; + border-style: inset outset; + } + .three-value { + border: 4px #ba55d3; + border-style: dashed hidden double; + } + .four-value { + border: 4px #ba55d3; + border-style: dashed groove dotted ridge; + } + \ No newline at end of file diff --git a/HTML_BORDER/index.html b/HTML_BORDER/index.html new file mode 100644 index 00000000..0af91d50 --- /dev/null +++ b/HTML_BORDER/index.html @@ -0,0 +1,45 @@ + + + + + + + Document + + + +

    Border style properties

    +
    +
    + border-top-style +
    + +
    + border-right-style +
    + +
    + border-bottom-style +
    + +
    + border-left-style +
    +
    +

    Border style short-hand properties

    +
    +
    + One value +
    +
    + top-bottom right-left +
    +
    + top right-left bottom +
    +
    + top right bottom left +
    +
    + + \ No newline at end of file diff --git a/HTML_BORDER/prince_verma/home.css b/HTML_BORDER/prince_verma/home.css new file mode 100644 index 00000000..b9177721 --- /dev/null +++ b/HTML_BORDER/prince_verma/home.css @@ -0,0 +1,6 @@ +p { + margin-top: 100px; + margin-bottom: 100px; + margin-right: 150px; + margin-left: 80px; + } \ No newline at end of file diff --git a/HTML_BORDER/prince_verma/home.html b/HTML_BORDER/prince_verma/home.html new file mode 100644 index 00000000..d63b7078 --- /dev/null +++ b/HTML_BORDER/prince_verma/home.html @@ -0,0 +1,62 @@ + + + + + + + Document + + + + +
    +
    + + + + + + + + + + + Document + + + + +
    +
    + + + + + + + + + + + Document + + + + +
    +
    + + + \ No newline at end of file diff --git a/Hamburger-menu-animation/index.html b/Hamburger-menu-animation/index.html new file mode 100644 index 00000000..f6fee8e4 --- /dev/null +++ b/Hamburger-menu-animation/index.html @@ -0,0 +1,10 @@ + + +
    +
    +
    +
    +
    +
    +
    + diff --git a/Hamburger-menu-animation/style.css b/Hamburger-menu-animation/style.css new file mode 100644 index 00000000..a8ea86e0 --- /dev/null +++ b/Hamburger-menu-animation/style.css @@ -0,0 +1,43 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} +.container { + width: 100%; + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + background-color: beige; +} +.burger { + width: 120px; + height: 120px; + background-color: beige; + box-shadow: 0px 10px 10px rgba(0, 0, 0, 0.1); + /* box shadow -> right left blur color(percent) */ + border-radius: 8px; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + cursor: pointer; +} +.container .burger .bar { + width: 80px; + height: 6px; + background-color: rgb(47, 47, 47); + margin: 12px; + border-radius: 6px; + transition: all 200ms ease-in-out; +} +.burger:hover .bar1 { + transform: translateY(30px) rotateZ(45deg); +} +.burger:hover .bar3 { + transform: translateY(-30px) rotateZ(-45deg); +} +.burger:hover .bar2 { + transform: scale(0); +} diff --git a/Hiding_content/index.css b/Hiding_content/index.css new file mode 100644 index 00000000..3fd42cb8 --- /dev/null +++ b/Hiding_content/index.css @@ -0,0 +1,44 @@ +body { + font-family: sans-serif; + text-align: center; + padding: 3rem; + font-size: 1.125rem; + line-height: 1.5; + transition: all 725ms ease-in-out; +} + +h1 { + font-size: 2rem; + font-weight: bolder; + margin-bottom: 1rem; +} + +p { + margin-bottom: 1rem; + color: tomato; +} + +p.hidden { + opacity: 0; + animation: hiding 1s; +} + +@keyframes hiding { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } +} + +button { + cursor: pointer; + appearance: none; + border-radius: 4px; + font-size: 1.25rem; + padding: 0.75rem 1rem; + border: 1px solid navy; + background-color: dodgerblue; + color: white; +} diff --git a/Hiding_content/index.html b/Hiding_content/index.html new file mode 100644 index 00000000..5f44a3e4 --- /dev/null +++ b/Hiding_content/index.html @@ -0,0 +1,24 @@ + + + + + + + Project + + + +

    I am a headline made with HTML

    +

    + And I am a simple text paragraph. The color of this text is styled with + CSS. Click the button below to remove me through the power JavaScript. +

    + + + + diff --git a/Hiding_content/index.js b/Hiding_content/index.js new file mode 100644 index 00000000..c6eb60fd --- /dev/null +++ b/Hiding_content/index.js @@ -0,0 +1,3 @@ +$("#btn").click(function () { + ("#Hiding").addClass("hidden"); +}); \ No newline at end of file diff --git a/HotelBooking/Home.jsx b/HotelBooking/Home.jsx new file mode 100644 index 00000000..346fbc46 --- /dev/null +++ b/HotelBooking/Home.jsx @@ -0,0 +1,30 @@ +import React from "react"; +import "./home.css"; + +import NavBar from "../../components/navBar/NavBar"; +import Header from "../../components/header/Header"; +import Featured from "../../components/featured/Featured"; +import PropertyList from "../../components/propertyList/PropertyList"; +import FeaturedProperty from "../../components/featuredProperty/FeaturedProperty"; +import MailList from "../../components/mailList/MailList"; +import Footer from "../../components/footer/Footer"; + +const Home = () => { + return ( + <> + +
    +
    + +

    Browse by property type

    + +

    Homes guests love...!

    + + +
    +
    + + ); +}; + +export default Home; diff --git a/HotelBooking/Hotel.jsx b/HotelBooking/Hotel.jsx new file mode 100644 index 00000000..07fe4575 --- /dev/null +++ b/HotelBooking/Hotel.jsx @@ -0,0 +1,158 @@ +import React, { useState } from "react"; +import "./hotel.css"; + +import Header from "../../components/header/Header"; +import NavBar from "../../components/navBar/NavBar"; +import MailList from "../../components/mailList/MailList"; +import Footer from "../../components/footer/Footer"; + +import { + faLocationDot, + faCircleXmark, + faArrowLeft, + faArrowRight, +} from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { useLocation, useNavigate } from "react-router-dom"; +import useFetch from "../../hooks/useFetch"; +import { useContext } from "react"; +import { SearchContext } from "../../context/SearchContext"; +import { AuthContext } from "../../context/AuthContext"; +import { setDayWithOptions } from "date-fns/fp"; +import Reserve from "../../components/reserve/Reserve"; + +const Hotel = () => { + const [open, setOpen] = useState(false); + const [openModel, setOpenModel] = useState(false); + const [slideIdx, setSlideIdx] = useState(0); + + const { dates, options } = useContext(SearchContext); + const { user } = useContext(AuthContext); + + const MILLISECONDS_PER_DAY = 1000 * 60 * 60 * 24; + function dayDifference(date1, date2) { + const timeDiff = Math.abs(date2.getTime() - date1.getTime()); + const diffDays = Math.ceil(timeDiff / MILLISECONDS_PER_DAY); + return diffDays; + } + const days = dayDifference(dates[0].endDate, dates[0].startDate) + 1; + + const navigate = useNavigate(); + + const location = useLocation(); + const id = location.pathname.split("/")[2]; + + const { data, error, loading, reFetch } = useFetch( + `http://localhost:8800/api/hotels/find/${id}` + ); + + const handleClick = (idx) => { + setSlideIdx(idx); + setOpen(true); + }; + + const handleSlider = (direction) => { + let newIdx; + if (direction === "l") { + newIdx = slideIdx === 0 ? data.photos.length - 1 : slideIdx - 1; + } else { + newIdx = slideIdx === data.photos.length - 1 ? 0 : slideIdx + 1; + } + setSlideIdx(newIdx); + }; + + const handlecc = () => { + if (user) { + setOpenModel(true); + } else { + navigate("/login"); + } + }; + + return ( + <> + +
    + {loading ? ( + "loading... " + ) : ( +
    + {open && ( +
    + setOpen(!open)} + /> + handleSlider("l")} + /> +
    + +
    + handleSlider("r")} + /> +
    + )} +
    + +

    {data.name}

    +
    + + {data.address} +
    + + Excellent location - {data.distance} from center + + + Book a stay over ${data.cheapestPrice} at this property and get a + free airport taxi + + {data.photos && ( +
    + {data.photos.map((photo, i) => ( +
    + handleClick(i)} + alt="" + className="hotelImg" + /> +
    + ))} +
    + )} +
    +
    +

    {data.title}

    +

    {data.desc}

    +
    +
    +

    Perfect for a {days}-night stay!

    + + Located at the hreat of Jaipur,this property has an excellent + location and rating of 8.9 + +

    + ${data.cheapestPrice * options.room * days} ({days}{" "} + nights) +

    + +
    +
    +
    +
    + )} + +