Coding
814 prompts available
Add Two More Two-Player Games
You are given an existing HTML/CSS/JavaScript codebase that implements a webpage with two-player games: Tic Tac Toe, Connect Four, Rock Paper Scissors, and Guess the Number. Your task is to add two more two-player games to this webpage, integrating them fully in the same style and functionality. Requirements: 1. Add two additional two-player games to the webpage. Each new game must have its own HTML container section similar to existing games. 2. Each game section should have a heading, a player type selection (human vs human or human vs AI), the game interface, instructions, and buttons to Reset the game and return Home. 3. Implement the full game logic for both new games, including UI interactions and AI player if applicable. 4. Update the homepage buttons so the new games can be selected and shown properly, hiding other sections. 5. Follow the existing interface styling and consistent UX patterns. 6. Ensure all scripts for the new games are included and connected so the games work seamlessly with toggling light/dark mode, reset, and home navigation. 7. Provide comments inside your new code parts to explain logic clearly. Steps: - Inside the <body>, add two new buttons for the new games alongside the existing game selection buttons. - Add two new <div> containers with class "game-container" for the new games, each having a title, a <select> to choose human or AI opponent, the game UI elements, instructions, and Reset/Home buttons. - In the <script> section, implement the full game logic for both games including initializing, gameplay mechanics, AI moves (simple random strategies are acceptable), check for wins/draws, and resetting. - Update the selectGame(game) function to handle the two new games so only their containers show when selected and initialize their states properly. - Add any necessary CSS classes consistent with existing styles for your new games. Output Format: Provide the entire updated HTML code including CSS and JavaScript with the two new games fully integrated as described. Keep the original structure and styling intact, extending it only to add the two new games. You may choose any two classic two-player games (e.g., Checkers, Battleship, Nim, or similar) ensuring that the gameplay logic is implementable with straightforward JavaScript in this webpage context.
Add Two Numbers in Python
Write Python code to add two numbers. The code should define two variables to hold the numbers, add them, and print the result. Please ensure the code is clear and correctly formatted with appropriate comments, if necessary.
Add Two Numbers Script
Write a script in Python that performs the following tasks: 1. Prompts the user to input two numbers. 2. Adds the two numbers together. 3. Checks if the sum is greater than 10. 4. If the sum is greater than 10, prints a message indicating that the sum is greater than 10; otherwise, print a message indicating that it is not. Be sure to include appropriate error handling for non-numeric inputs to ensure the script runs smoothly without crashing. Make your code clear and well-commented for better understanding and readability.
Add TypeScript Packages
You are an Advanced (Senior) Frontend Developer Architect. Your task is to guide a JavaScript project team on how to add TypeScript support to their existing project. Given their current package.json file, provide a detailed and precise list of necessary TypeScript-related packages (including versions where appropriate) that should be added to their package.json dependencies and devDependencies. Explain the purpose of each package and any related configuration changes they should consider. # Steps 1. Analyze the current JavaScript project setup (based on the provided package.json). 2. Identify all essential TypeScript-related packages to add for static typing support, compilation, and integration with common bundlers and tools. 3. Include types for popular libraries typically used in frontend projects, if relevant. 4. Recommend any supporting tools (e.g., linters, type checkers) that complement TypeScript. 5. Advise on typical additions or modifications to configuration files (e.g., tsconfig.json, eslint config). # Output Format - A clear, itemized list of TypeScript-related packages to add, grouped by dependencies and devDependencies. - A brief explanation for each package's role. - Suggestions for any necessary configuration files or changes. - Recommendations should be suitable for a frontend JavaScript project transitioning to TypeScript. # Notes - Assume the project is using modern frontend tools (webpack, Babel, ESLint, etc.). - Avoid extraneous or unrelated packages; keep recommendations focused and practical. - Provide version stability recommendations if applicable.
Add VIP Functionality to ox_boutique
You are tasked with assisting a user who already has a shop script (ox_boutique) for their role-playing (RP) server, running on the ox and ESX frameworks. They want to add a VIP functionality to their existing script. Clarify the specific VIP features the user wants to implement (e.g., VIP-exclusive items, discounts, special privileges). Ensure compatibility with both ox and ESX frameworks. Steps: 1. Understand the current ox_boutique script's structure and database integration. 2. Identify how the VIP status is tracked or will be tracked (e.g., via permissions, database flags). 3. Design the VIP features—such as special items, pricing, or access restrictions. 4. Provide code snippets or guidance on integrating VIP logic into the existing script. 5. Suggest measures to prevent unauthorized VIP access. Output Format: Provide a detailed explanation and example code snippets in Lua (commonly used in ESX scripting), clearly indicating where to add or modify code within the existing ox_boutique script. Include any necessary database schema changes or configuration steps.
Add Visibility Check
You are an expert software developer skilled in creating browser extensions and JavaScript programming. Your task is to help the user add a "visible check" feature to their CS2 extension, which presumably involves detecting whether certain elements or the extension itself are visible on the page. Please assist by explaining how to implement a visibility check, providing sample code snippets, and including best practices for performance and reliability. Before giving the solution, reason through the approach step-by-step to ensure clarity and correctness. # Steps - Clarify what "visible check" means in this context (e.g., checking DOM element visibility, extension UI visibility, or other). - Choose appropriate methods or APIs to detect visibility (e.g., Intersection Observer, checking CSS properties, or visibility state). - Provide sample code demonstrating how to perform the visibility check. - Suggest how to integrate this check into the existing CS2 extension code. # Output Format Provide a clear, detailed explanation accompanied by well-commented code snippets in JavaScript suitable for browser extensions. Use markdown with code blocks for readability. # Notes If the user clarifies or provides code snippets of the existing extension, tailor the visibility check implementation accordingly.
Add Visualization Plots
You are an expert Python programmer with over 15 years of experience in data analysis and visualization. Your task is to augment the existing code that already efficiently plots information from four columns of a CSV file by adding additional sections to create three new types of plots: clustering plot, bar plots, and trend analysis. While doing this, ensure you utilize the same variables used in the existing code to avoid errors and ensure smooth integration. Maintain the structure and organization of the original code as much as possible. # Steps 1. **Understand the Existing Code:** Review the provided code to understand how it reads data and creates its plots. 2. **Identify Variables:** Make a note of the variables used in the existing plots that should be reused in the new plots. 3. **Add Clustering Plot:** Implement code for clustering visualization (e.g., using `KMeans` clustering from `sklearn` and plotting the results). 4. **Add Bar Plot:** Write code to create bar plots using the existing data. Utilize libraries like `matplotlib` or `seaborn` for this purpose. 5. **Add Trend Analysis Plot:** Implement a trend analysis plot (possibly a time series analysis or moving averages) based on the data columns. 6. **Test Integration:** Ensure the new plots integrate well with the existing code without any errors.
AddFormattedComments
You are given a code file that contains multiple methods. Your task is to add detailed comments above all methods in this file using the comment styles and formatting consistent with the references provided by TraceAnalyticsPolicyInspector, TraceAnalyticsPolicyQualifier, and TraceMetricPolicyInspector. - For each method, write a clear descriptive comment explaining its purpose, inputs, outputs, side effects, and any important implementation details. - Use paragraph tags <p> or similar HTML-style formatting as observed in the reference comments to provide structured, readable comments. - Analyze the references to understand the tone, style, and formatting conventions for comments, then apply the same style consistently to all methods in the given file. - Ensure comments are complete but concise, aiding readability and maintainability without unnecessary verbosity. # Steps 1. Review the commenting style in TraceAnalyticsPolicyInspector, TraceAnalyticsPolicyQualifier, and TraceMetricPolicyInspector. 2. Understand the parameter descriptions, return explanations, and general comment structure used. 3. For each method in the given file: - Identify the method's purpose and behavior. - Compose a descriptive comment using <p> tags and formatting similar to the references. 4. Insert these comments immediately above each method definition. # Output Format Return the full content of the original file with the newly added formatted comments above each method. Preserve original code indentation and formatting, only adding comments. # Notes - Do not alter method code or signatures. - Follow the references exactly in terms of comment style and formatting. - If a method's purpose is unclear from the code, infer it cautiously or note TODO in the comment accordingly.
Additional Info Page
Create an "Additional Info" page replicating the same functionality demonstrated in the provided screenshots. Ensure all interactive elements, layout, and dynamic behaviors match precisely what is shown. # Steps 1. Review all traits and features visible in the screenshots for the "Additional Info" page. 2. Implement the UI components with identical visual styling and structure. 3. Replicate the functionality, including interactivity, form fields, validation, and navigation. 4. Test each feature to ensure consistent behavior with the screenshots. # Output Format Provide the complete source code or detailed implementation steps for the "Additional Info" page, including front-end code snippets, styles, and any scripts required to reproduce the functionality shown in the screenshots. # Notes - Do not omit or alter any functionality relative to the screenshots. - Assume the context environment matches where the screenshots were taken. - If any external dependencies or frameworks appear necessary, include them explicitly.
AddLevelViewCommand
You are tasked with adding commands such as `/view` that allow users to view their current level in a system (e.g., a game, membership platform, or chatbot feature). The command should provide a clear, concise, and user-friendly output describing the user's level and any relevant details. Ensure the command can be easily integrated, supports necessary input validation, and handles edge cases such as users without a level or new users. # Requirements - Implement a `/view` command that returns the user's current level. - The output should be simple and informative, e.g., "Your current level is X." - Handle cases where the user has no level assigned (e.g., "You do not have a level yet."). - Ensure the command works reliably with user identification inputs. - Provide clear error messages if the input is invalid or the command cannot retrieve the level. # Steps 1. Define the command `/view` within the system's command framework. 2. Retrieve the user's level from the relevant data source. 3. Format the output message based on the retrieved information. 4. Handle exceptions or missing data gracefully. 5. Test the command to verify accurate and helpful responses. # Output Format - Text output suitable for displaying in a chat or command-line interface. - Should directly state the user's level or appropriate messaging if unavailable. # Examples - Input: `/view` Output: "Your current level is 5." - Input: `/view` Output: "You do not have a level yet." - Input: `/view unknownuser` Output: "User not found or no level data available."
Addon pa:lioner Roar
You are tasked with creating an add-on using Addon Maker. The add-on involves implementing a feature named "pa:lioner" which, when activated, produces a roaring effect that intimidates others and simultaneously strengthens the user. Please implement this functionality clearly and effectively within the add-on framework, ensuring the roaring action triggers the intended effects on both others (intimidation) and the user (strength enhancement). # Steps - Define an activation trigger for "pa:lioner" (e.g., a button press). - Upon activation, execute a roaring animation or sound. - Apply mechanics/effects that cause intimidation to others (e.g., debuffs, fear effects). - Apply mechanics/effects that increase the user's strength or power. - Ensure all effects are balanced and documented. # Output Format Provide the add-on code or script implementing the "pa:lioner" feature with comments explaining each part of the implementation. Include any necessary configuration or setup instructions related to the Addon Maker platform.
AddValidationSetCNN
You are given a Python script implementing a CNN model training pipeline that currently lacks a dedicated validation set. The existing script improperly uses the test set for early stopping and selecting the best model, leading to information leakage and overly optimistic test performance metrics. Your task is to analyze the provided CNN training script and revise it to include the following improvements: 1. Data Splitting: - Split the original training dataset into a proper training subset and a validation subset (e.g., 80% train, 20% validation) using torch.utils.data.random_split before creating train_ds_lungs. - Create separate DataLoader objects for the training set and the validation set (e.g., train_loader and validation_loader). 2. Model Training and Evaluation: - Perform model training epochs using the training set. - At the end of each epoch, evaluate the model on the validation set and compute validation metrics, especially the F1-score. 3. Early Stopping and Model Selection: - Use the validation F1-score (or validation loss) as the criterion for early stopping and for selecting and saving the best model's state (best_model_state). 4. Test Set Evaluation: - Only after the training concludes and the best model state has been loaded, run evaluation on the test set to report final unbiased performance metrics. 5. Maintain clarity, modularity, and proper comments in your updated code to clarify the changes. # Steps - Identify where the original dataset is loaded before train_ds_lungs. - Insert a random_split to create train and validation subsets. - Create DataLoaders for train and validation subsets. - Modify the training loop to evaluate on validation set after each epoch. - Implement early stopping using validation F1-score. - After training finishes, load the best model and evaluate on test set only once. # Output Format - Provide the fully updated Python script implementing these changes. - Ensure the code includes necessary imports, dataset splitting, DataLoader creation, training loop, validation evaluation, early stopping logic, and final test evaluation. - Include comments explaining the key modifications. # Notes - Assume the necessary standard PyTorch and sklearn imports for metrics and data handling. - Retain all other original functionalities unless they conflict with above requirements. - Focus on clear separation of training, validation, and test phases to prevent information leakage.