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
Compare revisions
cec26e5f3b8c6ed2b62aebbe2302b4e1ec506a52 to f59b4ae5e4f914d064655df5a585be3feacdc5f4
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
c22027697/group-project
Select target project
No results found
f59b4ae5e4f914d064655df5a585be3feacdc5f4
Select Git revision
Branches
main
Swap
Target
c22027697/group-project
Select target project
c22027697/group-project
1 result
cec26e5f3b8c6ed2b62aebbe2302b4e1ec506a52
Select Git revision
Branches
main
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
Integrated Leaderboard to end of level 1
· a8b74d37
Adriel Nuqui
authored
2 years ago
a8b74d37
Integrated Leaderboard to Level 1
· f59b4ae5
Adriel Nuqui
authored
2 years ago
f59b4ae5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Group_game/game.py
+4
-0
4 additions, 0 deletions
Group_game/game.py
Group_game/leaderboard.py
+20
-9
20 additions, 9 deletions
Group_game/leaderboard.py
with
24 additions
and
9 deletions
Group_game/game.py
View file @
f59b4ae5
...
...
@@ -205,6 +205,10 @@ def unlock_door():
if
location_door
[
"
locked
"
]:
if
item_key
in
inventory
:
while
True
:
totalseconds
=
(
minutes
*
60
)
+
seconds
append_leaderboard
(
totalseconds
,
'
Times.csv
'
)
print
(
"
WELL DONE! You
'
ve escaped LEVEL 1 in a time of
"
,
minutes
,
"
minutes and
"
,
seconds
,
"
seconds
"
)
print
(
"
Type CONTINUE to begin the next level
"
)
response
=
input
()
...
...
This diff is collapsed.
Click to expand it.
Group_game/leaderboard.py
View file @
f59b4ae5
...
...
@@ -5,6 +5,11 @@ from csv import reader
def
view_leaderboard
(
filename
):
if
filename
==
'
Times.csv
'
:
print
(
'
LEVEL 1
\n
'
)
else
:
print
(
'
LEVEL 2
\n
'
)
print
(
"
________Leaderboard________
\n
"
)
with
open
(
str
(
filename
))
as
csv_file
:
...
...
@@ -15,15 +20,13 @@ def view_leaderboard(filename):
pass
line_count
+=
1
else
:
time
=
row
[
2
]
#00:00:00 format
minutes
=
time
//
60
seconds
=
time
%
60
time
=
[
round
(
minutes
),
round
(
seconds
)]
time
=
row
[
2
]
time
=
int
(
time
)
minutes
=
round
(
time
//
60
)
seconds
=
round
(
time
%
60
)
time
=
[
str
(
minutes
),
str
(
seconds
)]
name
=
row
[
1
]
if
minutes
[
0
]
==
'
0
'
:
minutes
=
minutes
[
1
]
print
(
f
'
{
row
[
1
]
}
escaped in
{
time
[
0
]
}
minutes and
{
time
[
1
]
}
seconds!
'
)
line_count
+=
1
...
...
@@ -55,11 +58,19 @@ def append_leaderboard(seconds_used,filename): #time_used = 20 minutes - time r
for
row
in
list_of_rows
:
newRecord
=
str
(
row
[
0
])
+
"
,
"
+
str
(
row
[
1
])
+
"
,
"
+
str
(
row
[
2
])
+
"
\n
"
file
.
write
(
newRecord
)
print
(
newRecord
)
file
.
write
(
newRecord
)
lastRecord
=
str
(
newindex
)
+
"
,
"
+
str
(
name
)
+
"
,
"
+
str
(
seconds_used
)
+
"
\n
"
file
.
write
(
str
(
lastRecord
))
#Writes data into the file
file
.
close
()
print
(
"
Input
'
Yes
'
or
'
No
'"
)
userinput
=
input
(
"
Would you live to view the leaderboard? :
"
)
userinput
=
userinput
.
lower
()
if
userinput
==
'
yes
'
:
view_leaderboard
(
filename
)
elif
userinput
==
'
no
'
:
print
(
"
Continuing back into the game...
"
)
print
(
'
Returning back to the game...
'
)
This diff is collapsed.
Click to expand it.