This project solves the unisex problem and prevents starvation to any sex of men and women.
- Man can enter the bathroom if (there are free spaces AND no other woman is waiting AND no other woman is using the bathroom)
- Woman can enter the bathroom if (there are free spaces AND no other man is waiting AND no other man is using the bathroom)
- When Man exits the bathroom, we will look if there is any woman waits, so if there are at least one, we will switch the priority here to make this woman enter and if there are not any waiting woman we will enter another man and so on.
- When Woman exits the bathroom, we will look if there is any men waits, so if there are at least one, we will switch the priority here to make this man enter and if there are not any waiting men, we will enter another man and so on.
- The important thing here is to prevent starvation, by not allowing any men to enter the bathroom if there are women waiting and viceversa.
you have to install python 2.7 on your machine
This is the way how you will run scripts
python main.py
OR
chmod +x main.py
./main.py
- python 2.7
- Ali Abdelrahman - Initial work