Coding
814 prompts available
1v1 Game Bot Design
Create a fully autonomous 1v1 game bot that can independently analyze the game state, make strategic decisions in real-time, and execute actions to effectively compete against an opponent without human intervention. To achieve this, proceed as follows: 1. Thoroughly analyze and understand the game mechanics and rules that govern a 1v1 match, including permissible actions, win conditions, and any timing constraints. 2. Design the bot's architecture focusing on decision-making algorithms that incorporate strategy development, adaptability to opponent behavior, and responsiveness to real-time changes in the game state. 3. Outline the implementation details emphasizing input processing to accurately capture game state, evaluation methods for assessing opportunities and threats, and action execution procedures. 4. Conduct extensive testing in various simulated 1v1 matchups, collect performance data, and refine the strategy and algorithms to optimize effectiveness. # Output Format Present a comprehensive bot design overview covering system architecture and strategic approach. Include key algorithms expressed in clear pseudocode or relevant code snippets illustrating decision-making, state analysis, and action execution. Provide a concise summary of testing results that showcases the bot's performance metrics and improvements in competitiveness against opponents. Ensure the response is well-structured for clarity and depth, demonstrating reasoned design choices supported by testing evidence.
2D Car Game Development
Create a simple 2D car game using Python where the player's car moves from the bottom of the screen upwards and the camera continuously follows. If the car collides with any obstacles, the game is over. Use the provided 'car.png' for the player's car and 'obstacle.png' for the obstacles. ## Steps 1. Set up a Python environment with the necessary libraries, including a library for handling graphics such as Pygame. 2. Load the 'car.png' and 'obstacle.png' images into your game. 3. Design the game window and initialize the player's car at the bottom center of the screen. 4. Implement controls to move the car upward continuously, and allow it to switch lanes or move side to side. 5. Create a scrolling background or moving obstacles to give the illusion that the car is moving forward. 6. Detect collisions between the player's car and obstacles. If a collision is detected, trigger a game-over state. 7. Continuously move the camera in sync with the car to maintain the player's car as the focus of the screen. 8. Implement a main game loop that updates the screen, handles events, and checks for collisions. ## Output Format - Provide a properly formatted Python script file with comments explaining each section of the code. ## Examples - Example code for loading images and displaying them: ```python import pygame # Initialize Pygame pygame.init() # Load images car_img = pygame.image.load('car.png') obstacle_img = pygame.image.load('obstacle.png') # Create game window screen = pygame.display.set_mode((800, 600)) # Main game loop running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False # Game logic goes here # Blit images to the screen screen.blit(car_img, (400, 500)) screen.blit(obstacle_img, (400, 300)) # Update the display pygame.display.flip() pygame.quit() ``` ## Notes - Ensure to optimize the code for smooth graphics performance. - Structuring the code with functions may improve readability and maintenance. - Consider adding game-over notifications or sounds for a better gaming experience.
2D Traffic Simulation in HTML
Create a realistic 2D traffic simulation within a single HTML file using the HTML5 canvas element for rendering. The simulation should feature basic but clear visuals to depict vehicles and road elements accurately. Implement smooth vehicle movements, realistic traffic flow behavior including acceleration, deceleration, stopping at signals or avoiding collisions, and lane changing if applicable. Use JavaScript embedded directly in the HTML file to manage the simulation logic and rendering. # Steps - Set up an HTML file containing a canvas element sized appropriately for the simulation. - Define roads, lanes, and intersections as part of the simulation environment. - Create vehicle objects with properties such as position, speed, direction, and size. - Implement vehicle behavior including starting, stopping, and lane following. - Add realistic traffic flow dynamics like maintaining distance, reacting to traffic controls, and preventing collisions. - Animate the simulation smoothly using requestAnimationFrame or similar. # Output Format Provide the complete HTML file code as plain text, with embedded JavaScript and CSS if needed, fully self-contained and ready to run in a web browser.
3D Battle Royale Game Dev
Create a comprehensive and detailed guide for developing a complete and functional 3D battle royale game similar to Fortnite using a popular game engine such as Unity or Unreal Engine. The guide should include in-depth explanations, design considerations, and clear code examples demonstrating implementation of each of the following core features: - Designing and building a large, open 3D map that supports player exploration and combat. - Implementing real-time multiplayer functionality that supports numerous players per match, including synchronization and server-client architecture. - Developing building mechanics that allow players to rapidly construct structures during gameplay. - Creating a variety of weapons and items that players can find, pick up, and use. - Programming a shrinking safe zone or storm mechanic to encourage player encounters and game pacing. - Enabling character movement including running, jumping, crouching, and swimming if applicable. - Designing an intuitive user interface that displays health, inventory, map, and other relevant information. - Adding audio-visual effects such as sound effects, music, and dynamic lighting to enhance player immersion. - Implementing game logic for player elimination, scoring, and winning conditions. # Steps 1. Provide an outline of the overall game architecture and key components. 2. Explain the design and creation of the 3D environment and assets. 3. Detail player controls and movement mechanics implementation. 4. Describe the multiplayer networking system setup and coding. 5. Demonstrate how to create building and construction mechanics. 6. Show how to add weapons, items, and manage player inventory. 7. Explain programming of the safe zone shrinking mechanic and how it influences game pacing. 8. Discuss integration of the user interface elements and HUD. 9. Outline how to incorporate audio and visual effects. 10. Recommend thorough game testing strategies and performance optimization techniques. # Output Format Structure the response as a well-organized developer-oriented document with clearly labeled sections corresponding to each step or feature. Include explanatory text, design rationale, and representative code snippets in clear code blocks. Use concise technical language suitable for experienced game developers and maintain modular, scalable best practices throughout. # Notes - Focus on performance optimization and scalability typical for complex 3D multiplayer battle royale games. - Ensure code examples are functional and compatible with the chosen game engine (specify Unity or Unreal Engine). - Provide reasoning and clarifications before presenting implementation details.
2D Two-Player Android Platformer
Create a 2D side-scrolling platformer game for two players within a single HTML file using HTML, CSS, and JavaScript. The game should meet the following requirements: - Controls are touch-based only, optimized for Android devices with multi-touch support; no PC keyboard controls should be implemented. - Each player has three control buttons: move left, move right, and jump. - Design fixed platforms manually within the game (no random generation). - Introduce a goal represented by a flag; when both players reach the flag, display a win condition. - Implement smooth side-scrolling mechanics as players navigate the level. # Steps 1. Set up a single HTML file that includes all required HTML, CSS, and JavaScript for the game. 2. Design and render the game canvas to display the two player characters, platforms, and the flag. 3. Create static platforms at predetermined positions to form the level. 4. Implement touch controls with separate left, right, and jump buttons for each player, ensuring multi-touch works (e.g., each player has control areas on different screen halves). 5. Program player movement, jumping physics, collision detection with platforms, and side-scrolling logic. 6. Detect when each player reaches the flag, and if both have reached it, show a winning message. # Output Format Provide the full source code as a single HTML file that can be opened on Android devices and supports all specified features. The code should be clean, properly commented, and contain all styles and scripts inline.
1v1 Game Code
Create a code implementation for a 1v1 game or contest. Please provide a detailed description of the desired game or contest, including rules, platform, programming language preference, and any specific features or constraints. # Steps 1. Define the type of 1v1 game or contest (e.g., turn-based, real-time, quiz, fighting game). 2. Determine the programming language and platform (web, desktop, mobile). 3. Specify the game rules, win conditions, and any special mechanics. 4. Outline how the two players will interact (local, online multiplayer). 5. Develop the game code accordingly. # Output Format Provide the full source code with comments explaining key parts. Include instructions on how to run or build the code, if necessary. # Notes If the user provides more specific details, tailor the code accordingly. Otherwise, create a simple, illustrative 1v1 example in a commonly used language like Python or JavaScript.
2D Car Game Python
Create a simple 2D car game using Python where the player's car moves continuously upward from the bottom of the screen, with the camera following the car smoothly. The game should use the provided 'car.png' image for the player's car and 'obstacle.png' image for the obstacles. If the player's car collides with any obstacle, the game should end immediately. Use the Pygame library to handle graphics and user input. The player should be able to move the car side to side (switch lanes or move left/right) while the car automatically moves forward (upward). The obstacles should appear and scroll down the screen to simulate forward movement. # Detailed Requirements - Initialize a Pygame window with appropriate dimensions (e.g., 800x600). - Load the 'car.png' as the player's car sprite and position it initially at the bottom center of the window. - Load the 'obstacle.png' for obstacles and generate them at random horizontal positions above the visible screen area so they move downward toward the player. - Implement continuous upward movement for the car by moving obstacles and background downward to simulate forward travel. - Enable player input to move the car left or right smoothly or in lane steps. - Create a scrolling background or moving obstacles to reinforce the sense of movement. - Implement collision detection between the player's car and obstacles using Pygame's collision functions. - If a collision is detected, end the game immediately and optionally display a game-over message. - Keep the camera/view centered on or smoothly following the player's car as it moves upward. - Use a main game loop to handle events, update positions, check collisions, render graphics, and maintain a consistent framerate. # Best Practices - Structure your code with functions and clear comments explaining each section. - Optimize for smooth graphics and responsive controls. - You may include game-over notifications, sounds, or simple UI elements to improve user experience. # Output Format Provide a complete, well-commented Python script file implementing the described game using Pygame. The code should be clean and ready to run assuming the provided images ('car.png' and 'obstacle.png') are in the same directory. # Example Snippet ```python import pygame # Initialize Pygame pygame.init() # Load images car_img = pygame.image.load('car.png') obstacle_img = pygame.image.load('obstacle.png') # Set up game window screen = pygame.display.set_mode((800, 600)) # Main loop running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False # Game logic here # Rendering screen.fill((0,0,0)) # Clear screen with black screen.blit(car_img, (x_pos, y_pos)) screen.blit(obstacle_img, (obs_x, obs_y)) pygame.display.flip() pygame.quit() ``` Implement the full game following this style and requirements, ensuring smooth gameplay and robust collision detection.
1-Minute Trading Script
Create a trading script for buying and selling on a 1-minute chart using guidelines from a provided documentation link. - Access the provided link and thoroughly understand the essentials of the scripting environment from the documentation. - Follow any specific instructions or examples to generate the script. - Implement basic buy and sell commands suitable for a 1-minute timeframe. ## Steps 1. **Visit the Documentation**: Open the provided link and read the relevant sections to understand the scripting environment. 2. **Identify Key Concepts**: Look for specific syntax, functions, and indicators suitable for creating a buy/sell script. 3. **Draft the Script**: - Set up the environment for a 1-minute chart. - Implement basic market conditions to trigger buy and sell commands (for example, moving averages, RSI, or price crossovers). - Ensure the script can handle real-time data efficiently. 4. **Refine and Optimize**: - Make sure the script adheres to best practices as detailed in the documentation. - Test and refine the logic to ensure accuracy and efficiency. ## Output Format - Begin with a brief comment header explaining the functionality of the script. - Write script code using the appropriate syntax from the documentation. - Clearly comment your code for readability. ## Example ```javascript // Trading script for 1-minute buy/sell decisions // Implements a simple moving average crossover ... ``` ## Notes - Specific indicators or market conditions should be adapted from the documentation, when available. - Always ensure the script complies with any legal or exchange regulations as noted in the documentation. - Consider exception handling and logging as part of best practices.
2-MA Crossover EA MQL5
Create a fully functional MetaTrader 5 Expert Advisor (EA) in MQL5 that implements a two moving average crossover trading strategy using the CTrade class for all trade operations. Details and Requirements: - Define input parameters to configure: - Fast MA period and type (e.g., EMA, SMA) - Slow MA period and type - Lot size for position sizing - Stop loss and take profit values (in points or price, clarify within the code) - Symbol to trade (optional, default to the chart symbol) - On each new tick, calculate both the fast and slow moving averages using the specified types and periods. - Detect crossover signals: - A buy signal is generated when the fast MA crosses above the slow MA. - A sell signal is generated when the fast MA crosses below the slow MA. - Before opening a new trade, verify existing positions: - If there is an existing position opposing the new signal, close that position first. - Prevent opening duplicate trades in the same direction. - Use the MQL5 CTrade class exclusively for opening and closing trades with safe and clear commands. - Implement robust error handling around trade operations: - Log detailed messages whether orders are successful or fail, including error codes. - Organize and structure the code clearly with thorough comments explaining each part: - Inputs, initialization, deinitialization, per-tick logic, MA calculation, crossover detection, trade management. - Follow MQL5 best practices for efficiency, safety, and readability. # Steps to Implement: 1. Declare and initialize all input parameters to tune the strategy easily. 2. Calculate current and previous values of both fast and slow moving averages on each tick. 3. Implement logic to detect when the fast MA crosses above or below the slow MA by comparing current and previous values. 4. Detect trade signals based on crossover events. 5. Check current open positions for the trading symbol and determine if any action is required (closing opposite positions). 6. Use CTrade methods to open new buy or sell trades, and close opposing positions as needed. 7. Incorporate error checking after every trade operation and log outcomes with descriptive messages. 8. Add comments throughout to explain purpose and facilitate future adjustments. # Output Format Return a complete .mq5 source code file content that is immediately compilable and ready to deploy as an Expert Advisor in MetaTrader 5. # Notes - Ensure the code respects MetaTrader 5 conventions and runs efficiently on each tick. - All parameter values should be modifiable via input parameters for flexible optimization. - The strategy must handle positions carefully to avoid conflicting open trades. - Logging should be done via Print() or preferably via the ExpertAdvisor logging system for clarity. - The code should be self-contained and require no external libraries beyond standard MQL5.
2D Underground Shooter
Create a simple 2D side-scrolling game where the player explores a mostly underground environment. The main features should include: - The setting is a simple subterranean or cave-like scenario. - The player character can move left and right and jump. - The player can shoot by clicking the mouse; bullets or projectiles should be fired in the direction where the mouse cursor is pointing. Focus on straightforward controls and gameplay mechanics. The visual style should be simple but clear, suitable for a basic exploration game. # Steps 1. Design a 2D side view map that looks underground or cave-like, keeping it minimalistic. 2. Implement player movement: walking left/right and jumping. 3. Capture mouse position and allow shooting projectiles aimed at the mouse cursor on mouse click. 4. Ensure that the shooting direction updates dynamically as the mouse moves. # Output Format Provide either a complete script or a detailed plan for implementing this game, including code snippets, programming language suggestions (e.g., Python with Pygame, JavaScript with Canvas, or another relevant framework), and explanations for each feature. # Notes - The player’s shooting direction must always correspond to the current mouse cursor position. - Make sure the controls feel responsive and intuitive. - Prioritize simplicity and clarity in design and gameplay mechanics.
3D Battle Royale Player Setup
Create a complete 3D Battle Royale-style game featuring a player character inspired by Free Fire with the following specifications: - Character Properties: - Realistic height of 1.75 meters. - Realistic physics including gravity, mass, and collision detection. - Environment: - Tropical island terrain with diverse elements including buildings, trees, mountains, roads, and obstacles. - Spawn points for player or items. - Camera: - Third-person camera that follows the player. - Camera allows free movement and rotation controlled by the mouse. - Player Controls: - Movement: Run using WASD keys. - Sprint with Shift key. - Jump with Space key, with realistic jump height (~1.5 meters). - Crouch using the 'C' key. - Aim and shoot using mouse right-click (aim) and left-click (shoot). - Switch among multiple weapon types: Assault Rifle (AR), Submachine Gun (SMG), and Shotgun. - Interact: Pick up weapons and shields from the environment. - Throw grenades and use healing items during gameplay. - Animations: - Idle animation when standing still. - Running animation during movement. - Jumping animation. - Aiming and shooting animations. - Physics and Collision: - Implement physics-based collision to prevent walking through buildings or obstacles. - Ensure jumping does not cause unnatural flying into the sky. - Development Requirements: - Export all game logic in TypeScript (TSX). - Use React Three Fiber for 3D rendering. - Use @react-three/rapier physics engine for realistic physics. - Structure code to be modular, scalable, and optimized for performance. - Additional Constraints: - Replicate player controls and behaviors similar to Free Fire. # Steps 1. Define the player model with accurate height and realistic physics properties. 2. Generate a detailed tropical island environment including buildings, trees, roads, mountains, spawn points, and obstacles. 3. Implement a third-person camera with flexible movement and rotation controllable via mouse input. 4. Setup player input controls for running, sprinting, jumping, crouching, aiming, shooting, switching weapons, picking up items, throwing grenades, and using healing items. 5. Integrate animations for all player states and actions. 6. Apply physics and collision detection ensuring natural interaction with environment and no unreal jumps. 7. Organize code using TypeScript and React Three Fiber coupled with @react-three/rapier. 8. Ensure modularity, scalability, and optimization throughout the codebase. # Output Format Provide the full game logic code in TypeScript (TSX), compatible with React Three Fiber and @react-three/rapier physics engine, well-commented and modularized for scalability and performance. Include all player control implementations, animations, physics setups, environment generation, and camera controls as described. No additional narrative or explanation—only source code and necessary inline comments. # Notes - The player character and controls should closely emulate the feel and mechanics of Free Fire. - Use realistic physics parameters for gravity, mass, and collisions. - The environment should support gameplay elements such as spawning weapons and items on the ground for pickup. - Camera must allow the player full rotational freedom around the character. - Avoid any physics glitches like unnatural flying or clipping through objects. This prompt is suitable for platforms supporting code or video game generation with detailed 3D and physics capabilities (e.g., Sora or similar).
1-Minute Trading Script
Create a trading script for executing buy and sell operations on a 1-minute chart according to provided documentation. --- ### Steps 1. **Visit the Documentation**: Access the provided link to read and comprehend the scripting environment by reviewing the necessary sections. 2. **Identify Key Concepts**: Extract specific syntax, functions, or indicators from the documentation that are applicable for formulating a buy/sell trading script. 3. **Draft the Script**: - Initialize the script environment tailored for a 1-minute chart. - Code basic trading logic to automatically trigger buy and sell operations. Utilize indicators such as moving averages, RSI, or price crossovers appropriate for rapid execution. - Ensure the capability of processing real-time data efficiently. 4. **Refine and Optimize**: - Confirm that the script aligns with best practices detailed in the documentation. - Perform tests and refine the logic for precision and efficiency, potentially optimizing for speed and resource management. ### Output Format - Start with a brief comment header to outline the script's purpose and functionality. - Script the code employing the correct syntax as derived from the documentation. - Utilize clear and descriptive comments throughout your script for enhanced readability. ### Example ```javascript // Trading script for executing buy/sell orders on a 1-minute chart // Implements a simple moving average crossover strategy // Adjust parameters based on indicators like [Indicator X] and [Indicator Y] from the documentation // Initialize environment setup for 1-minute chart ... // Code logic for buy/sell based on conditions... // Handle real-time data stream... // Provide logging and error handling... ``` ### Notes - Customize indicators or market conditions using examples and suggestions from the documentation. - The script must adhere to any legal or regulatory constraints specified within the documentation. - Implement exception handling and comprehensive logging as part of scripting best practices.