Repository navigation
init commit #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ModestoT
wants to merge
13
commits into
master
Choose a base branch
from
modesto-tamayo
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
init commit #1
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d9f3468
installed pipenv
ModestoT ca6a264
set up basic Room class
ModestoT ff51138
created a basic player class
ModestoT f2faa95
Created the items file as well as got the loop working for going from…
ModestoT 8c8d50e
fixed issues that didn't allow the user to be able to quit in certain…
ModestoT a6876ca
Updated how the items are displayed as well as made it to where the i…
ModestoT 95e1cc5
Updated the word checks to support two words instead of just one
ModestoT 0aabf3f
made it to where the user can type in the letters uppercase or lowercase
ModestoT 6e401df
Added ability for players to drop items onto the floor of the room
ModestoT a57ae2f
Created a monsters class, and randomly adds monsters to the room
ModestoT 2952169
adjusted the amount of monsters per room
ModestoT e98f2d9
Adjusted the way the list of monsters is printed out
ModestoT 76c89c7
Added the index in which the monster is in the list when printing the…
ModestoT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Class to hold item information | ||
|
|
||
| class Item: | ||
| def __init__(self, name, desc): | ||
| self.name = name | ||
| self.desc = desc | ||
|
|
||
| def __repr__(self): | ||
| return ''+self.name+' '+self.desc+'' | ||
|
|
||
| def __str__(self): | ||
| return ''+self.name+' '+self.desc+'' | ||
|
|
||
| def on_take(self): | ||
| print(f'You added the {self.name} to your inventory!') | ||
|
|
||
| def on_drop(self): | ||
| print(f'You dropped the {self.name} onto the floor') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| class Monster: | ||
| def __init__(self, name, attack, defense, health): | ||
| self.name = name | ||
| self.attack = attack | ||
| self.defense = defense | ||
| self.health = health | ||
|
|
||
| def __repr__(self): | ||
| return f'Name: '+self.name+'\nAttack: '+str(self.attack)+'\nDefense: '+str(self.defense)+'\nHealth: '+str(self.health)+'' | ||
|
|
||
| def __str__(self): | ||
| return f'Name: '+self.name+'\nAttack: '+str(self.attack)+'\nDefense: '+str(self.defense)+'\nHealth: '+str(self.health)+'' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,33 @@ | ||
| # Write a class to hold player information, e.g. what room they are in | ||
| # currently. | ||
|
|
||
| class Player: | ||
| def __init__(self, name, current_room): | ||
| self.name = name | ||
| self.current_room = current_room | ||
| self.inventory = [] | ||
|
|
||
| def __repr__(self): | ||
| return ''+self.name+'' | ||
|
|
||
| def __str__(self): | ||
| return ''+self.name+'' | ||
|
|
||
| def addItem(self, item): | ||
| item.on_take() | ||
| self.inventory.append(item) | ||
|
|
||
| def removeItem(self, item): | ||
| if item in self.inventory: | ||
| self.inventory.remove(item) | ||
| item.on_drop() | ||
| else: | ||
| print("You don't have that item") | ||
| return False | ||
|
|
||
| def getInventory(self): | ||
| inventory = [str(i.name) for i in self.inventory] | ||
|
|
||
| res = ' '.join(inventory) | ||
|
|
||
| return res |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i love that you kept the items as dicts rather than making it an array. Makes lookup time faster. (We will get into this more)