Skip to content

About

Final project for Harvard's CS50's Programming with Python (CS50P).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

CS50P Street Pyghter

Description:

CS50P Street Pyghter is a 1-v-1 turn based fighting game, based on CS50's Introduction to Programming with Python course. Players fight through a gauntlet of 10 enemies, with each enemy being based on a weekly topic of CS50P. If the player successfully beats the game, they are rewarded with their very own CS50P Street Pyghter Shirtificate!

Features

  • Character selection and difficulty levels: The user can choose from 3 different characters to play as. Each character has different attributes. These act as a gameplay difficulty setting, offering easy, normal, and hard difficulties. The difficulty levels are based on the real-world Python coding abilities of the 3 characters. The 3 characters are:

    • David Malan (Easy mode: High HP and attack power)
    • Student (Normal mode: Moderate HP and attack power)
    • Muppet (Hard mode: Low HP and attack power)
  • 10 rounds of combat: Users fight a gauntlet of 10 different enemies. These are all based on the weekly topics of the CS50P Python course. For example, the first round is called "Week 0" and the enemy is called "Functions". This adds a sense of progression and achievement for the user, especially for those who have completed CS50P, who will be very familiar with the names of these rounds and enemies.

  • Level up system: The user's HP and attack power increase by 10% after each successfully completed round.

  • Enemy scaling: Enemies become progressively more difficult, with their HP and attack power increasing each round.

  • "Shirtificate" reward: If the user successfully defeats all enemies, the program will prompt the user for their name and then make a customised PDF "Shirtificate".

  • Help command: Detailed help is available to the user at any time during combat. This provides the user with more information on what each available action does.

Gameplay

  • User has 4 abilities:

    • Attack (Attacks enemy, doing damage equal to the user's current attack power).
    • Defend (Reduces damage taken by 50% for one turn).
    • Buff (Increases the user's attack power to 150% for one turn).
    • Heal (Restores the user's health by 35% of their current HP).
  • Enemies have 2 abilities:

    • Attack (Damages the user for damage equal to the enemy's attack power).
    • Defend (Reduces the damage taken by the enemy for 50% for one turn).

Files

  • project.py: Contains the code for the CS50P Street Pyghter game.
  • test_project.py: Test file to test functions in project.py using pytest. I have created the following test functions to ensure project.py works as intended:
    • test_player_stats: This test checks that the character attributes (HP and attack power) are correct for the selected character.
    • test_enemy_to_fight: This test checks that the enemy attributes (HP and attack power) are correct for the enemy in that round of the game.
    • test_enemy_actions: This test checks that the enemy performs the desired action when the user is either buffing or healing. It also checks that when the user is attacking the enemy chooses an action at random from a list of possible actions.
    • test_level_up: This test checks that the characters attributes (HP and attack power) for the selected character are correctly increased by 10% after each successfully completed round of combat.
  • shirtificate.png: This file is the image of the "shiritificate" that is used by the FPDF2 module in project.py to generate the customised shirtificate image if the user successfully completes the game. You can download it from here https://cs50.harvard.edu/python/psets/8/shirtificate/shirtificate.png

About

Final project for Harvard's CS50's Programming with Python (CS50P).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages