Twmabysjzna / Hi

Hi
MIT License
0 stars 0 forks source link

Hi #2

Open Twmabysjzna opened 1 year ago

Twmabysjzna commented 1 year ago

import random

def encounter_monster(): monsters = ["Goblin", "Orc", "Troll", "Werewolf"] monster = random.choice(monsters) print(f"A wild {monster} appears!")

action = input("Do you want to [F]ight or [R]un? ").lower()

if action == "f":
    if random.random() < 0.5:  # 50% chance of winning
        print(f"You defeated the {monster}!")
    else:
        print(f"The {monster} defeated you. Game over!")
elif action == "r":
    print("You managed to escape.")
else:
    print("Invalid choice. Please select 'F' to fight or 'R' to run.")

def main(): print("Welcome to the Local Monster Game!") print("You're exploring your town and encounter various monsters.")

while True:
    encounter_monster()
    play_again = input("Do you want to play again? (yes/no) ").lower()
    if play_again != "yes":
        print("Thanks for playing!")
        break

if name == "main": main()

Twmabysjzna commented 1 year ago

Local "Monster"

Twmabysjzna commented 1 year ago

import random

def encounter_monster(): monsters = ["Goblin", "Orc", "Troll", "Werewolf"] monster = random.choice(monsters) print(f"A wild {monster} appears!")

action = input("Do you want to [F]ight or [R]un? ").lower()

if action == "f":
    if random.random() < 0.5:  # 50% chance of winning
        print(f"You defeated the {monster}!")
    else:
        print(f"The {monster} defeated you. Game over!")
elif action == "r":
    print("You managed to escape.")
else:
    print("Invalid choice. Please select 'F' to fight or 'R' to run.")

def main(): print("Welcome to the Local Monster Game!") print("You're exploring your town and encounter various monsters.")

while True:
    encounter_monster()
    play_again = input("Do you want to play again? (yes/no) ").lower()
    if play_again != "yes":
        print("Thanks for playing!")
        break

if name == "main": main()

Twmabysjzna commented 1 year ago

class Kingdom: def init(self, name, ruler, main_city, resources): self.name = name self.ruler = ruler self.main_city = main_city self.resources = resources

def describe(self):
    print(f"Welcome to the Kingdom of {self.name}!")
    print(f"Ruled by {self.ruler}, this kingdom is centered around the city of {self.main_city}.")
    print(f"The kingdom is known for its abundant {', '.join(self.resources)}.")

Create an instance of the Kingdom class

kingdom = Kingdom( name="Eldoria", ruler="Queen Isabella", main_city="Eldorium", resources=["rich farmlands", "sparkling rivers", "dense forests"] )

Describe the kingdom

kingdom.describe() Run code () Run () Run code () Run fly ()

Twmabysjzna commented 1 year ago

.gradle /build/ !src//build/

Ignore Gradle GUI config

gradle-app.setting

Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)

!gradle-wrapper.jar

Avoid ignore Gradle wrappper properties

!gradle-wrapper.properties

Cache of project

.gradletasknamecache

Eclipse Gradle plugin generated files

Eclipse Core

.project

JDT-specific (Eclipse Java Development Tools)

.classpath

Twmabysjzna commented 1 year ago

/build/

Twmabysjzna commented 1 year ago

.gradle /Build/