Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
V
Vault Hacking Race
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tammam.alsoleman
Vault Hacking Race
Commits
fcee38b2
Commit
fcee38b2
authored
Nov 01, 2025
by
tammam.alsoleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build_Main_Class
parent
2b4bbf01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
6 deletions
+65
-6
DescendingHackerThread.java
src/DescendingHackerThread.java
+22
-3
Main.java
src/Main.java
+16
-0
PoliceThread.java
src/PoliceThread.java
+27
-3
No files found.
src/DescendingHackerThread.java
View file @
fcee38b2
package
PACKAGE_NAME
;
public
class
DescendingHackerThread
extends
Thread
{
private
Vault
vault
;
public
class
DescendingHackerThread
{
public
DescendingHackerThread
(
Vault
vault
)
{
}
this
.
vault
=
vault
;
this
.
setName
(
"DescendingHacker"
);
this
.
setPriority
(
Thread
.
MAX_PRIORITY
);
}
@Override
public
void
run
()
{
System
.
out
.
println
(
this
.
getName
()
+
" started hacking from 9999 to 0"
);
// Try every number from 9999 down to 0
for
(
int
guess
=
9999
;
guess
>=
0
;
guess
--)
{
if
(
vault
.
isCorrectPassword
(
guess
))
{
System
.
out
.
println
(
this
.
getName
()
+
" cracked the vault! Password: "
+
guess
);
System
.
exit
(
0
);
}
}
System
.
out
.
println
(
this
.
getName
()
+
" finished but didn't find the password!"
);
}
}
\ No newline at end of file
src/Main.java
View file @
fcee38b2
public
class
Main
{
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"Vault Hacking Race Started!"
);
// Create a vault with random password
Vault
vault
=
new
Vault
();
AscendingHackerThread
ascendingHacker
=
new
AscendingHackerThread
(
vault
);
DescendingHackerThread
descendingHacker
=
new
DescendingHackerThread
(
vault
);
PoliceThread
police
=
new
PoliceThread
();
System
.
out
.
println
(
"Starting all threads..."
);
ascendingHacker
.
start
();
descendingHacker
.
start
();
police
.
start
();
System
.
out
.
println
(
"All threads are running !"
);
}
}
}
\ No newline at end of file
src/PoliceThread.java
View file @
fcee38b2
p
ackage
PACKAGE_NAME
;
p
ublic
class
PoliceThread
extends
Thread
{
public
class
PoliceThread
{
public
PoliceThread
()
{
}
this
.
setName
(
"Police"
);
}
@Override
public
void
run
()
{
System
.
out
.
println
(
"Police are on the way! 10 seconds remaining..."
);
// Countdown from 10 to 1
for
(
int
i
=
10
;
i
>
0
;
i
--)
{
try
{
// Wait for 1 second (1000 milliseconds)
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
i
+
" seconds remaining..."
);
}
catch
(
InterruptedException
e
)
{
System
.
out
.
println
(
"Police thread was interrupted!"
);
e
.
printStackTrace
();
}
}
// If we reach here, time is up and police arrived
System
.
out
.
println
(
"Game over for you hackers! Police arrived!"
);
System
.
exit
(
0
);
// End the entire program
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment