Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Group Project
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ahmed Yusuf
Group Project
Commits
d010e132
Commit
d010e132
authored
2 years ago
by
Ahmed Yusuf
Browse files
Options
Downloads
Patches
Plain Diff
bug fixes
parent
e9858366
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Group_game/game.py
+7
-5
7 additions, 5 deletions
Group_game/game.py
Group_game/level_1.py
+8
-7
8 additions, 7 deletions
Group_game/level_1.py
with
15 additions
and
12 deletions
Group_game/game.py
+
7
−
5
View file @
d010e132
...
...
@@ -106,10 +106,12 @@ def execute_take(item_id):
found
=
False
for
items
in
current_room
[
"
items
"
]:
if
item_id
==
items
[
"
id
"
]:
inventory
.
append
(
items
)
current_room
[
"
items
"
].
remove
(
items
)
found
=
True
if
len
(
inventory
)
<
3
:
inventory
.
append
(
items
)
current_room
[
"
items
"
].
remove
(
items
)
else
:
print
(
"
Your inventory is full, Drop an item to free some space.
"
)
if
not
found
:
print
(
"
You cannot take that.
"
)
...
...
@@ -193,9 +195,9 @@ def execute_command(command):
elif
command
[
0
]
==
"
open
"
:
if
command
[
1
]
==
"
diary
"
:
open_diary
()
open_diary
(
current_room
[
"
items
"
]
)
elif
command
[
1
]
==
"
safe
"
:
open_safe
()
open_safe
(
current_room
[
"
items
"
]
)
else
:
print
(
"
open what?
"
)
...
...
This diff is collapsed.
Click to expand it.
Group_game/level_1.py
+
8
−
7
View file @
d010e132
...
...
@@ -2,25 +2,28 @@ from items import *
from
player
import
*
from
map
import
*
def
open_diary
():
def
open_diary
(
room_items
):
if
item_diary
in
inventory
:
print
(
"
You opened the diary and found a hidden note.
"
)
inventory
.
append
(
item_note
)
room_items
.
append
(
item_note
)
item_diary
.
update
({
"
open
"
:
True
})
else
:
print
(
"
You cannot open that.
"
)
def
open_safe
():
global
safe_opened
def
open_safe
(
room_items
):
print
(
"
To open this safe you need a passcode
"
)
print
(
"
please enter the passcode
"
)
passcode
=
input
()
if
passcode
==
"
042
"
:
print
(
"
THE PASSCODE WAS CORRECT!
"
)
print
(
"
inside the safe you found a pair of batteries
"
)
inventory
.
append
(
item_batteries
)
room_items
.
append
(
item_batteries
)
item_safe
.
update
({
"
open
"
:
True
})
else
:
print
(
"
you try the code
"
,
passcode
,
"
but the safe wouldn
'
t open
"
)
print
(
"
TRY AGAIN
"
)
def
use_battery
():
...
...
@@ -35,9 +38,7 @@ def use_battery():
def
use_torch
(
room
):
if
powered_torch
in
inventory
:
print
(
room
)
if
room
==
location_dark_corner
:
print
(
"
true
"
)
room
[
"
items
"
].
append
(
item_key
)
else
:
print
(
"
There is no use for the torch in this room
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment