Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * One car from EAST, One car from WEST, then 2 cars from EAST
- */
- void run11() {
- if (Fork() == 0) {
- Delay(10);
- driveRoad(WEST, 60);
- Exit();
- }
- //the following two child cars should go back to back
- if (Fork() == 0) {
- Delay(200);
- driveRoad(EAST, 60);
- Exit();
- }
- if (Fork() == 0) {
- Delay(200);
- driveRoad(EAST, 60);
- Exit();
- }
- driveRoad(EAST, 60);
- return;
- }
- /*
- * 2 cars showing up at once and both yielding to the same car
- * on the opposite side
- */
- void run12() {
- if (Fork() == 0) {
- driveRoad(EAST, 60);
- Exit();
- }
- if (Fork() == 0) {
- driveRoad(EAST, 60);
- Exit();
- }
- if (Fork() == 0) {
- Delay(100);
- driveRoad(WEST, 60);
- Exit();
- }
- driveRoad(EAST, 10);
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement