About the Portfolio Project: Python Terminal Game

class Starship:
def init(self, name, classtype, registry, max_warp_speed):
self.name = name
self.classtype = classtype
self.registry = registry
self.max_warp_speed = max_warp_speed

def __repr__(self):
    return f"Space, The Final Frontier. These are the voyages of the Starship {self.name}. Its continuing mission: to explore strange new worlds, to seek out new life and new civilizations, TO BOLDLY GO WHERE NO MAN HAS GONE BEFORE!"

class Captain:
def init(self, name, age, rank, years_of_experience):
self.name = name
self.age = age
self.rank = rank
self.years_of_experience = years_of_experience

def __repr__(self):
    return f"Captain {self.name}, {self.rank}, with {self.years_of_experience} years of experience."

class Planet:
def init(self, name, description):
self.name = name
self.description = description

def explore(self):
    print(f"You have arrived at {self.name}. {self.description}")

def trade(self):
    print(f"You initiate a trade with the locals on {self.name}.")
    # Add trade logic here

def __repr__(self):
    return f"Planet: {self.name}"

def play_game():
# Create Starship
starship_name = input("Enter the name of the starship: ")
classtype = input("Enter the class type of the starship: ")
registry = input("Enter the registry number of the starship: ")
max_warp_speed = float(input("Enter the maximum warp speed of the starship: "))

starship = Starship(starship_name, classtype, registry, max_warp_speed)

# Create Captain
captain_name = input("Enter the name of the captain: ")
age = int(input("Enter the age of the captain: "))
rank = input("Enter the rank of the captain: ")
years_of_experience = int(input("Enter the years of experience of the captain: "))

captain = Captain(captain_name, age, rank, years_of_experience)

print(starship)
print(captain)

# Create Planets
planets = []
num_planets = int(input("Enter the number of planets to explore: "))
for i in range(num_planets):
    planet_name = input(f"Enter the name of planet {i+1}: ")
    planet_desc = input(f"Enter the description of planet {i+1}: ")
    planet = Planet(planet_name, planet_desc)
    planets.append(planet)

print("Starting the adventure!\n")

for planet in planets:
    print(f"Captain {captain.name}, you have arrived at {planet.name}.\n")
    planet.explore()

    while True:
        action = input("What do you want to do? (Trade/Next planet/Quit): ")
        if action.lower() == "trade":
            planet.trade()
        elif action.lower() == "next planet":
            break
        elif action.lower() == "quit":
            print("Exiting the game...")
            return
        else:
            print("Invalid action! Please try again.")

    print("Moving to the next planet...\n")

print("Congratulations, you have explored all the planets!\nGame Over!")

Start the game

play_game()

git hub link: https://github.com/saifeldeen2007/tic-tac-toe-python-game

I’ve just created tic-tac-toe game

Here’s a medium blog which also contains a link to my project. I created a World Cup Trivia game for two players. Thanks for the feedback.

1 Like

I decided to make a blackjack game. This is the code https://github.com/Jeetp45/TerminalGame/blob/main/terminal_game.py

Thanks!

I made a simple game where you play 5 rounds. The player chooses a number 1-5 and the dealer (computer) chooses a random number 1-5. Depending on how close you are to the dealer’s number, you get a certain number of points. At the end of each round, you see a tally of your points. At the end of the game, you see your final score. I see various ways I can tighten up things (like adding a restriction so you can’t pick other numbers outside of the range 1-5) and maybe adding choosing a level of difficulty, where the higher the difficulty the larger the range is. But this is my initial iteration.

Beam Analysis Calculator

I’m a structural engineer learning how to code on the side so I made a quick calculator for calculating the shear and moment of a beam (probably super boring for most people). I experimented with checking multiple user inputs for errors without having a bunch of code, and I implemented a graphing function by importing matplotlib. Not too sure how this library works when sharing a repo so please provide feedback if the graphing function doesn’t work or if I missed something.

Hey everyone. I decided to do my project based on the Game Show “Who Wants to be a millionaire?”
I went with this because it seemed fun to do while at the same time it felt like a good way to utilize a lot of the crucial parts that were taught throughout the course.

The game only has a total of 15 questions and shows the value of each question just like the game show.

Nice code. Especially the part where you implemented the picture of the suits on there to show during the game.

Game about Secret Numbers, took a few days to bulid and is my first project made in python.

Regards.

Hi all,

I chose to create a black jack game for this project. This was a fun experience and a good intro to object oriented programming. This program took a few hours to create. I am looking forward to the future content.

Here is the link to my GitHub repo : GitHub - dmobley0608/black_jack_python)
I appreciate any feed back.

Thanks,
Dwight

Hello! Creating my first ever project was a lot of fun :smiley: although at times…just a tad fustrating haha.
Below is a link to my Git repository, any feedback would be greatly appreciated!

A simple terminal game thats tests type speed

Hi I am with Codecademy from Japan. This is my first portfolio project.

here is my code below

it was hard to built interactive Class between Task and Task manegement

Thanks Seiya

Creating a Financial Math Calculator

Since I love Financial Math and investing, I thought about creating a program that would help me in the near future to make my calculations without having to do them manually with pen and paper as I usually like to do them. I know there are a lot of programs out there that help you calculate things like interest, account worth, periods, etcetera. I wanted to create something that is more descriptive and user-friendly avoiding as much financial jargon as possible and guiding the user through the calculations. So far what I accomplished now is a fully functional calculator that provides you with the account worth after a given number of years investing a certain amount at an interest rate compounded every ‘n’ periods. In the future, I am planning to give it more functionality like calculating the number of years it will take to reach a certain amount in your account or calculating how much you would need to invest to obtain a certain amount of money.

Here is an example of what it does for now and the link to my project in GitHub:

I will keep you posted about new features added :).

Sebastian

Just ended my first Python Project! I would love some feedback! :smiley:

https://github.com/micaels94/whowantstobeamillionaire.git