PromptBase
Close icon
General
Home
Marketplace
Hire
Create
Login
Sell
Explore
🤖 GPT

Code Generator

Code Generator gpt prompt mini thumbnail
2Heart icon
Favorites
128Eye icon
Views
GPT-4
TestedTick icon
TipsTick icon
Highly advanced prompt made for generation of code. Treat him like a programmed. This prompt will help you build some interesting software. After you know what you want from the prompt ask him to make it in code and you will see the magic of this prompt.
...more
$4.99
Get prompt
After purchasing, you will gain access to the prompt file which you can use with GPT or the app builder. You'll receive 20 free generation credits with this purchase. By purchasing this prompt, you agree to our terms of service.
Over 1 month ago

Prompt Details

Model
Chat - GPT-4 (gpt-4)
Token size
694 ($0.02080 / call)
Example input
build a text based rpg game
Example output
import random # Character creation class Character: def __init__(self, name, health, attack, defense): self.name = name self.health = health self.attack = attack self.defense = defense # Calculate damage dealt to enemy def calc_damage(self, enemy_defense): damage = max(self.attack - enemy_defense, 1) return damage # Enemy creation class Enemy: def __init__(self, name, health, attack, defense): self.name = name self.health = health self.attack = attack self.defense = defense # Calculate damage dealt to player def calc_damage(self, player_defense): damage = max(self.attack - player_defense, 1) return damage # Combat function def combat(player, enemy): while player.health > 0 and enemy.health > 0: # Player's turn enemy.health -= player.calc_damage(enemy.defense) if enemy.health <= 0: print(f"{player.name} defeated {enemy.name}") break # Enemy's turn player.health -= enemy.calc_damage(player.defense) if player.health <= 0: print(f"{enemy.name} defeated {player.name}") break # Main game function def main(): player_name = input("Enter your character's name: ") player = Character(player_name, 100, 10, 5) enemy_name = "Goblin" enemy = Enemy(enemy_name, 50, 8, 3) combat(player, enemy) # Start the game if __name__ == "__main__": main()
Browse Marketplace