Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CM1101 Team 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
Harry Wyatt
CM1101 Team Project
Commits
a6d4c098
Commit
a6d4c098
authored
2 years ago
by
Harry Wyatt
Browse files
Options
Downloads
Patches
Plain Diff
Tenuously fixed some language usage
parent
c8fad9fb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
game.py
+25
-7
25 additions, 7 deletions
game.py
with
25 additions
and
7 deletions
game.py
+
25
−
7
View file @
a6d4c098
...
...
@@ -17,6 +17,16 @@ import time as t
import
time
import
sys
def
add_article
(
articleless
):
'''
A primative function for taking a string without an article at the start and adding an indefinite article
'''
if
articleless
[:
1
]
in
[
'
a
'
,
'
e
'
,
'
i
'
,
'
o
'
,
'
u
'
]:
return
"
an
"
+
articleless
else
:
return
"
a
"
+
articleless
def
slow_print
(
s
):
for
letter
in
s
:
sys
.
stdout
.
write
(
letter
)
...
...
@@ -37,8 +47,10 @@ def display_inventory():
if
len
(
player
.
inventory
)
>
0
:
print
(
"
You have
"
,
end
=
""
)
for
x
in
range
(
len
(
player
.
inventory
)
-
1
):
print
(
player
.
inventory
[
x
].
name
,
end
=
"
,
"
)
print
(
player
.
inventory
[
len
(
player
.
inventory
)
-
1
].
name
,
end
=
"
.
"
)
final_name
=
add_article
(
player
.
inventory
[
x
].
name
)
print
(
final_name
,
end
=
"
,
"
)
print
(
add_article
(
player
.
inventory
[
len
(
player
.
inventory
)
-
1
].
name
),
end
=
"
.
"
)
print
(
"
\n
"
)
print
(
"
The commands you can use are:
"
)
...
...
@@ -369,16 +381,20 @@ def print_room_items(room):
if
len
(
room
.
items
)
>
0
:
print
(
"
There is
"
,
end
=
""
)
for
x
in
range
(
len
(
room
.
items
)
-
1
):
print
(
room
.
items
[
x
].
name
,
end
=
"
,
"
)
print
(
room
.
items
[
len
(
room
.
items
)
-
1
].
name
,
end
=
"
"
)
final_name
=
add_article
(
room
.
items
[
x
].
name
)
print
(
final_name
,
end
=
"
,
"
)
print
(
add_article
(
room
.
items
[
len
(
room
.
items
)
-
1
].
name
),
end
=
"
"
)
print
(
"
here.
\n
"
)
def
print_inventory_items
(
items
):
if
len
(
items
)
>
0
:
print
(
"
You have
"
,
end
=
""
)
for
x
in
range
(
len
(
items
)
-
1
):
print
(
items
[
x
].
name
,
end
=
"
,
"
)
print
(
items
[
len
(
items
)
-
1
].
name
,
end
=
"
.
"
)
final_name
=
add_article
(
items
[
x
].
name
)
print
(
final_name
,
end
=
"
,
"
)
print
(
add_article
(
items
[
len
(
items
)
-
1
].
name
),
end
=
"
.
"
)
print
(
"
\n
"
)
def
print_room
(
room
):
...
...
@@ -403,7 +419,9 @@ def print_menu(exits, room_items, inv_items):
for
item
in
room_items
:
if
item
.
can_pickup
is
True
:
print
(
"
TAKE
"
,
item
.
id
.
upper
(),
"
to take a(n)
"
,
item
.
name
+
"
.
"
)
final_name
=
add_article
(
item
.
name
)
print
(
"
TAKE
"
,
item
.
id
.
upper
(),
"
to take
"
,
final_name
+
"
.
"
)
elif
item
.
on_interaction
is
not
None
:
# In this case, it's an item we must interact with in the game space as it cannot be picked up
print
(
f
"
INTERACT
{
item
.
id
.
upper
()
}
{
item
.
on_interaction_description
}
.
"
)
...
...
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