void *sellTickets(void *param) {
	// threaded method for seller

	Person *p;
	int tl, th;
	Seller *s = (Seller *) param;
	while (!(hall.hasStarted || hall.isSoldOut)) {
		if(isSoldOut(&hall)){

			LOCK(&outputLock);
			printf("%6s |           |             ", getTime());
			printf("| Event: Tickets Sold Out\n");
			UNLOCK(&outputLock);
			LOCK(hall.lock);
			hall.isSoldOut = TRUE;
			UNLOCK(hall.lock);
		}
		if (s->que != NULL) {
			p = removePerson(s->que);

			LOCK(hall.lock);
			getSeat(&hall, p, s->price);
			UNLOCK(hall.lock);

			switch (s->price) {
			case HIGH:
				tl = 1;
				th = 2;
				break;
			case MEDIUM:
				tl = 2;
				th = 4;
				break;
			case LOW:
				tl = 4;
				th = 7;
				break;
			default: // broken code
				printf("Error, we've been hacked Price is %d", s->price);
				exit(-1);
			}
			PRINTEVENT(s,p,"Customer Served");

			LOCK(&outputLock);
			output();
			UNLOCK(&outputLock);

			sleep(getRandomTime(tl, th)); // random time based on price
			// this code needed to handle frustrated customers safely

			LOCK(garbage->lock);
			queAdd(garbage, p);
			UNLOCK(garbage->lock);
			PRINTEVENT(s,p,"Customer Purchase Complete - Leaves Seller");
		}
	}
	s->open = FALSE;
	return NULL;
	// thread finished
}
DaySimulator::DaySimulator(QObject *parent) : EventSimulator(parent)
{
    this->setCycle(kDayCycle);
    this->setDuration(kDayEventDuration);
    setRandomTime(kDayRandom);
    setTiming( ((kDayCycle-kDayRandom) / 2.0) / kDayCycle);
    qDebug() << "Random time for day is " << getRandomTime() <<", timing is " << getTiming();

}
void DaySimulator::setCycle(const uint &cycle)
{
    EventSimulator::setCycle(cycle);
    setTiming( ((cycle-getRandomTime()) / 2.0) / cycle);

}
/**
 * シーン変更処理
 */
void RandomWalker::sceneChangeAction() {
    mSimpleTimer->setTime(getRandomTime());
    mSimpleTimer->start();
}