//Break into the vault public void Heist() { int heldLockpicks = 0; //lockpicks in hand //start the heist while (this.pickedLocks < this.totalLocks) { //fill in the code to actually pick the locks and perform the heist here. int leftVar = 0; int rightVar = 0; if (this._index - 1 < 0) { leftVar = 4; } rightVar = this._index; lockpicks.Get(leftVar, rightVar); //When the Thief is picking the lock please add the following line Console.WriteLine("Thief " + (this._index + 1) + " is picking locks"); Thread.Sleep(500); lockpicks.Put(leftVar, rightVar); Thread.Sleep(500); this.pickedLocks++; } //display that this Thief has picked the required amount of locks Console.WriteLine("Thief " + (this._index + 1) + " has finished picking locks"); }
//Break into the vault public void Heist() { int heldLockpicks = 0; //lockpicks in hand //start the heist int counter = _index; while (this.pickedLocks < this.totalLocks) { //fill in the code to actually pick the locks and perform the heist here. //When the Thief is picking the lock please add the following line //Console.WriteLine("Thief " + (this._index + 1) + " is picking locks"); lockpicks.Get(counter, (counter + 1) % 5); Console.WriteLine("Thief " + (this._index + 1) + " is picking locks"); pickedLocks = pickedLocks + 1; lockpicks.Put(counter, (counter + 1) % 5); } //display that this Thief has picked the required amount of locks Console.WriteLine("Thief " + (this._index + 1) + " has finished picking locks"); }
//Break into the vault public void Heist() { int heldLockpicks = 0; //lockpicks in hand //start the heist while (this.pickedLocks < this.totalLocks) { //fill in the code to actually pick the locks and perform the heist here. //When the Thief is picking the lock please add the following line //Console.WriteLine("Thief " + (this._index + 1) + " is picking locks"); //Using index find two closest locks. int left = 0; int right = 0; //Automated assuming _index is between [0, lockpicks.Length) if (_index == lockpicks.lockpicks.Length - 1) { right = _index; left = _index - 1; } else { left = _index; right = _index + 1; } lockpicks.Get(left, right); Console.WriteLine("Thief " + (this._index + 1) + " is picking locks"); //Pick the lock Thread.Sleep(100); //Gives me time to read the console. lockpicks.Put(left, right); pickedLocks++; } //display that this Thief has picked the required amount of locks Console.WriteLine("Thief " + (this._index + 1) + " has finished picking locks"); }