def runSimulation(numberOfCustomers, numberOfWaitingSeats, nextCustomerWaitTime, hairTrimTime): worldToShop = Channel() shopToBarber = Channel() barberToShop = Channel() shopToWorld = Channel() Parallel( barber(hairTrimTime, shopToBarber.reader(), barberToShop.writer()), shop(numberOfWaitingSeats, worldToShop.reader(), shopToBarber.writer(), barberToShop.reader(), shopToWorld.writer()), worldSink(shopToWorld.reader()), worldSource(numberOfCustomers, nextCustomerWaitTime, worldToShop.writer()))
def main(numberOfCustomers, numberOfWaitingSeats, numberOfBarbers, nextCustomerWaitTime, hairTrimTime): worldToShopIn = Channel() shopOutToShopIn = Channel() toBarber = Channel() toShopOut = Channel() shopInToAccounts = Channel() shopOutToAccounts = Channel() Parallel( shopIn(numberOfWaitingSeats, worldToShopIn.reader(), toBarber.writer(), shopInToAccounts.writer()), shopOut(toShopOut.reader(), shopOutToAccounts.writer()), accounts(shopInToAccounts.reader(), shopOutToAccounts.reader()), world(numberOfCustomers, nextCustomerWaitTime, worldToShopIn.writer()), *[barber(i, hairTrimTime, toBarber.reader(), toShopOut.writer()) for i in range(numberOfBarbers)] )
def main(numberOfCustomers, numberOfWaitingSeats, numberOfBarbers, nextCustomerWaitTime, hairTrimTime): worldToShopIn = Channel() shopOutToShopIn = Channel() toBarber = Channel() toShopOut = Channel() shopInToAccounts = Channel() shopOutToAccounts = Channel() Parallel( shopIn(numberOfWaitingSeats, worldToShopIn.reader(), toBarber.writer(), shopInToAccounts.writer()), shopOut(toShopOut.reader(), shopOutToAccounts.writer()), accounts(shopInToAccounts.reader(), shopOutToAccounts.reader()), world(numberOfCustomers, nextCustomerWaitTime, worldToShopIn.writer()), *[ barber(i, hairTrimTime, toBarber.reader(), toShopOut.writer()) for i in range(numberOfBarbers) ])