Commit e55cdbf6 authored by areej.mohammad's avatar areej.mohammad

step 5

parent 55577373
......@@ -2,18 +2,18 @@ package hackingrace;
public class VaultHackingRace {
public static void main(String[] args){
// 1. Create a Vault with a random password
Vault vault=new Vault();
// 2. Instantiate the three threads
Thread ascendingHacker = new AscendingHackerThread(vault);
Thread descendingHacker = new DescendingHackerThread(vault);
Thread policeThread = new PoliceThread();
// 3. يستخدم أولوية Thread.MAX_PRIORITY لنياسب القراصنة [cite: 28, 45]
// 3. Set the priority of the hacker threads to maximum
ascendingHacker.setPriority(Thread.MAX_PRIORITY);
descendingHacker.setPriority(Thread.MAX_PRIORITY);
// نيسب الشرطة يعمل بالأولوية الافتراضية (عادةً NORM_PRIORITY)
// 4. يُطلق النياسب الثلاثة في نفس الوقت [cite: 27]
// 4. Start all three threads simultaneously
policeThread.start();
ascendingHacker.start();
descendingHacker.start();
......@@ -21,8 +21,8 @@ public static void main(String[] args){
System.out.println("Two hackers are competing to find the password (0-9999).");
System.out.println("Police arrive in 10 seconds. Hackers have MAX_PRIORITY.");
System.out.println("------------------------------------");
// البرنامج ينتظر حتى يُنهي System.exit(0)
// البرنامج ينتظر حتى يُنهي System.exi
}
}
}ls
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment