Fishing -Frenzy


When the coding project is announced, my mind went blank. After sometime, figured that I would make something related to my interests.

I thought about making a sports game that would allow the player to make a team and earn money fighting against other layers, but I soon realized that it will be difficult to complete with Python and my existing knowledge base.

Shifting the gears, I decided to focus on another of my hobbies, fishing. A game that will combine mysteriousness, surprises, and most importantly money$$$!


And here is my masterpiece:


Code:

https://colab.research.google.com/drive/15x2X9p3_MtEyr3D5FrMhJc9bTKJeLkzr


Flowchart:


1. The Game Setup:

import random

fish_values = {
    "Tuna": 20,
    "Salmon": 15,
    "Sardine": 5,
    "Pufferfish": -5,
    "Shark": -10,
    "an soggy boot": 0
}

This is all the kinds of fish you will be able to fish from the ocean, some of them more desirable than others.

If you caught a pufferfish, unfortunately, you are not able to eat it and it is a waste of time, making you lose $5.

If you fished a shark, well good luck! He is going to take your fishing rod with him and maybe some of your bait as well. A shark will make you lose $10.

If you fished out a boot… well I dont know what to say about that, improve our fishing skills dude. You will not get anything form it.

Other than the 3 mentioned above, all others have positive values, meaning you can sell them and earn money (Sardine: $5, Salmon: $15, and Tuna: $20.)


2. Initial Conditions:

player_score = 0
total_tries = 6

available_fish = list(fish_values.keys())

This part of the code sets up the game.

It is saying that the player will start with $0, since he did not cast his line yet.

It is also saying that the player has 6 tries to fish out as much value as possible and the available fish = the list of all possible catches.


3. Game Intro:

print("What a nice day! I think I will go fishing beside the ocean...")
print("-" * 50)

This will display a short message to the player at the start of the game.


4. The Fishing Loop

for try_number in range(1, total_tries + 1):
    input(f"\nPress Enter to cast the line... (Try {try_number} of {total_tries})")

    caught_fish = random.choice(available_fish)

    fish_worth = fish_values[caught_fish]

The player presses “Enter” to cast the line.

A random fish is chosen from the list of available fish.

The worth of the fish is looked up from the code before.


5. The Value of The Catch

if fish_worth > 0:
        print(f"Casting the line... AYYY! What a dime! I caught a {caught_fish}! It's worth ${fish_worth}.")
    elif fish_worth < 0:
        print(f"Oh shoot! A freaking {caught_fish}. Man, what a bad cast! I lost freaking ${abs(fish_worth)}!")
    else:
        print(f"Damn, {caught_fish}... To the garbage it goes.")

If the value of the fish caught is positive, its a good catch (Earns money).

If the fish has a negative value, its a bad catch (money lost).

If the value is 0, its worthless (no money earned or lost).


6. Total Up the Score

player_score += fish_worth

print(f"${player_score} in the bank!")

Adds/subtracts fish value from the total score.

Prints the updated balance after each cast.


7. The Game Ends

print("\n" + "=" * 50)
print("Well, I better get back before lunch!")
print(f"Today's catch is worth a whooping: ${player_score}")
print("=" * 50)

After the player casted 6 times, the game ends.

Then the total value of the cast will be displayed.

8. Calling the Function

def go_fishing():
...

go_fishing()

These 2 lines of codes allow me to name and call the function, which is the whole process form casting to getting the fish.


Reflection:

In summary I think I did a great job on the project.

Although it is a simple game, I think I came up with a pretty interesting idea.

I think instead of making something to do with math or things that require great mental power, a game that is interesting and simple to play is a great way for you to relax after a long day of hard work.


Comments

3 Responses to “Fishing -Frenzy”

  1. mcrompton Avatar
    mcrompton

    Good job, Jack. You’ve demonstrated a decent level of Python skills. I am comfortable saying that if you had another project that involved programming, you would have a good starting base to learn what you need to know for that project. I have one comment and a requirement. Your Gemini transcript is a bit hard to follow. I’m not always sure where your prompt ends and where the reponse begins. A reformat would help clarify that. I’m not asking you to do this for this assignment, but keep this in mond for the future. What I will ask you to do is edit your code to include the required definition and calling of a function. Please resubmit with the published URL of your blog post when you have done this. Thank you!

    1. jackd Avatar
      jackd

      Hi Mr.Crompton, I have changed my code to incuide the calling of functions and I have also added a new paragraph explaining so.

  2. mcrompton Avatar
    mcrompton

    Thanks, Jack!

Leave a Reply

Your email address will not be published. Required fields are marked *