Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. If the train driver from Peru is asking to use the pass then they will state their interest by placing a stone in the basket. If the train driver from Bolivia is interested too then to get out of the deadlock it is automatically set to the Bolivian trains turn, the Peru train driver removes his stone from the basket. Once the Bolivian train driver has left the pass and taken his stone out of the basket, then the Peruvian train driver puts his stone back in to the basket and goes through the pass. Once the Peruvian train has left the pass the driver removes his stone from the basket.
  2.  
  3. While(true) {
  4. Peru train driver put stone in basket
  5. While(Bolivia train driver has stone in basket)
  6. {
  7. If it is Bolivia trains turn to use the pass
  8. {
  9. Peru train takes stone out of basket
  10. While(it is Bolivia trains turn)
  11. Wait
  12. Peru Train driver puts stone in basket
  13. }
  14. }
  15. Turn = Bolivia Train Driver
  16. Peru train driver takes stone out of basket
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement