-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rob Gardner
committed
Jun 2, 2024
1 parent
9e81ec6
commit 2f0bb54
Showing
8 changed files
with
252 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
TheBalladOfAllanMush/Ventures/III - GalaxyZ/IAlertService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace TheBalladOfAllanMush.Ventures.III___GalaxyZ | ||
{ | ||
public interface IAlertService | ||
{ | ||
public Task EnterAlertState(string alertLevel); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
TheBalladOfAllanMush/Ventures/III - GalaxyZ/ILifeSupportService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace TheBalladOfAllanMush.Ventures.III___GalaxyZ | ||
{ | ||
public interface ILifeSupportService | ||
{ | ||
public Task<List<string>> TestMainPower(); | ||
public Task<List<string>> TestAuxPower(); | ||
public Task<List<string>> TestOxygen(); | ||
public Task<List<string>> TestTemperature(); | ||
public Task RebootLifeSupport(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
TheBalladOfAllanMush/Ventures/III - GalaxyZ/IRocketTelemetryService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace TheBalladOfAllanMush.Ventures.III___GalaxyZ | ||
{ | ||
public interface IRocketTelemetryService | ||
{ | ||
public Task<int> GetFuelLinePressureById(string Id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Implement a new class called TrolleyProblem.cs in the "II - Edison" folder. | ||
|
||
This class will consume ISelfDriveService and ISteering as a dependency. | ||
|
||
There will be one public method in the new class named "MinimiseCasualties". | ||
|
||
This method will be asynchronous and return a Task<Direction>. | ||
It will take a collection (list) of Pedestrians as an input. | ||
|
||
The behaviour of this method has the following requirements- | ||
|
||
It calls ISelfDriveService.AccelerateToSpeed with a target speed of 30. | ||
|
||
For each pedestrian in our collection, we call ISelfDriveService.AvoidPedestrian() on it. | ||
We ignore any calls that return 'Center' (pedestrians behind). | ||
We tally any calls that return left or right. | ||
|
||
Once tallies are done, we call ISteering.SteeringOverride with the direction | ||
that has the highest tally. | ||
|
||
Eg. We have 3 returns from avoid pedestrian with Direction.Right | ||
But we have only 2 returns from avoid pedestrian with Direction.Left | ||
|
||
Therefore we call ISteering.OverrideSteering with Direction.Right | ||
We then return the chosen direction. | ||
|
||
In the event of a tie (equal tally of left and right), we throw a SelfDriveException . | ||
|
||
Once you have written the class, verify its behaviour with unit tests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters