void Garbage::sendSquirrel( Habitat *origin, Habitat *destination ) { squirrel->hide(); squirrel->goodsMarker->hide(); destination->incomingSquirrels++; glm::vec3 pos = *squirrel->getPosition(); AdvancedSprite *newSquirrel = spriteGen->createSquirrel( pos.x, pos.y, pos.z ); newSquirrel->setDestination( destination ); if ( hasGoodsToSend ) { newSquirrel->setGoods( true ); hasGoodsToSend = false; garbageBag->hide(); } PathFinder path; glm::vec3 destPosition = destination->getPosition(); newSquirrel->path = *path.groundPath(origin->getPosition(), destPosition); newSquirrel->isMoving = true; newSquirrel->show(); newSquirrel->goodsSprite->show(); newSquirrel->goodsMarker->show(); departure( "squirrel" ); }
void Garbage::sendCrow( Habitat *origin, Habitat *destination ) { crow->hide(); crow->goodsMarker->hide(); destination->incomingCrows++; glm::vec3 pos = *crow->getPosition(); AdvancedSprite *newCrow = spriteGen->createCrow( pos.x, pos.y, pos.z ); newCrow->setDestination( destination ); if ( hasGoodsToSend ) { newCrow->setGoods( true ); newCrow->goodsSprite->show(); hasGoodsToSend = false; garbageBag->hide(); } PathFinder path; glm::vec3 destPosition = destination->getPosition(); destPosition.y += destination->getHitBox().y / 2.0f; newCrow->path = *path.flightPath(origin->getPosition(), destPosition); newCrow->isMoving = true; newCrow->show(); newCrow->goodsMarker->show(); departure( "crow" ); }
main(){ sim_init(); while (narr < TOTAL_EVENTS){ switch (act()){ case ARRIVAL: arrival(); break; case DEPARTURE: departure(); break; default: printf("error in act procedure\n"); exit(1); break; } /* end switch */ } /* end while */ printf("Probablity a packet is blocked: \nbatch arrival: %8.4f \nsingle packet arrival: %8.4f\n", ((float) batch_nloss) / batch_packets, ((float) nloss) / (total_packets - batch_packets)); return(0); } /* end main */
float run() { int i; while (narr < total_events) { switch (act()) { case ARRIVAL: arrival(); break; case DEPARTURE: departure(); break; default: printf("error in act procedure\n"); exit(1); break; } /* end switch */ } /* end while */ /* printf("The mean queue length seen by arriving customers is: %8.4f\n", ((float) q_sum) / narr); printf("Probablity a packet is blocked is: %8.4f\n", ((float) nloss) / narr); */ fprintf (stderr, "%.6f\n", ((float) nloss) / narr); return ((float) nloss) / narr; } /* end main */
QString JourneyInfo::departureText( bool htmlFormatted, bool displayTimeBold, bool showRemainingMinutes, bool showDepartureTime, int linesPerRow ) const { QString sTime, sDeparture = departure().toString( "hh:mm" ); if ( htmlFormatted && displayTimeBold ) { sDeparture = sDeparture.prepend( "<span style='font-weight:bold;'>" ).append( "</span>" ); } if ( departure().date() != QDate::currentDate() ) { sDeparture += ", " + DepartureInfo::formatDateFancyFuture( departure().date() ); } if ( showDepartureTime && showRemainingMinutes ) { QString sText = durationToDepartureString(); if ( htmlFormatted ) { sText = sText.replace( QRegExp( "\\+(?:\\s*| )(\\d+)" ), QString( "<span style='color:%1;'>+ \\1</span>" ) .arg( Global::textColorDelayed().name() ) ); } if ( linesPerRow > 1 ) { sTime = QString( htmlFormatted ? "%1<br>(%2)" : "%1\n(%2)" ) .arg( sDeparture ).arg( sText ); } else { sTime = QString( "%1 (%2)" ).arg( sDeparture ).arg( sText ); } } else if ( showDepartureTime ) { sTime = sDeparture; } else if ( showRemainingMinutes ) { sTime = durationToDepartureString(); if ( htmlFormatted ) { sTime = sTime.replace( QRegExp( "\\+(?:\\s*| )(\\d+)" ), QString( "<span style='color:%1;'>+ \\1</span>" ) .arg( Global::textColorDelayed().name() ) ); } } else { sTime.clear(); } return sTime; }
int main() { int i; initialize(); for (i=0; i<NUM_MAX_EVENTS; i++) { timing(); statistics(); switch(next_event_type) { case 0: arrival(); break; case 1: departure(); break; } } printf("The expected number of customer is queue is %f \n", area_num_in_q/sim_time); return 0; }
double Model_ExternalShading::intermediate(bool state, double Lumint, double Evg) { return departure(state, Lumint, Evg); }