/** * This function is used to allocate the unit simulated that you want to run. * Any parameters or other experimental setup can be done at this time. */ void CreateSimulation(int id) { Map *map; if (gDefaultMap[0] == 0) { //ht_chantry.arl.map // map = new Map("/Users/nathanst/hog2/maps/dao/lak503d.map"); //map = new Map("/Users/nathanst/hog2/maps/da2/ht_chantry.arl.map"); // map = new Map("/Users/nathanst/hog2/maps/bgmaps/AR0011SR.map"); //map = new Map("/Users/nathanst/hog2/maps/rooms/8room_000.map"); //map = new Map("/Users/nathanst/hog2/maps/mazes/maze512-16-0.map"); //map = new Map("/Users/nathanst/hog2/maps/local/weight.map"); //map = new Map("weight.map"); map = new Map(mazeSize, mazeSize); MakeMaze(map, 5); // map->Scale(512, 512); } else { map = new Map(gDefaultMap); //map->Scale(512, 512); } map->SetTileSet(kWinter); msa = new MapSectorAbstraction(map, 8); msa->ToggleDrawAbstraction(1); //msa->ToggleDrawAbstraction(2); // ->ToggleDrawAbstraction(3); unitSims.resize(id+1); unitSims[id] = new UnitSimulation<xyLoc, tDirection, MapEnvironment>(new MapEnvironment(map)); unitSims[id]->SetStepType(kMinTime); SetNumPorts(id, 1); }
void MyWindowHandler(unsigned long windowID, tWindowEventType eType) { if (eType == kWindowDestroyed) { printf("Window %ld destroyed\n", windowID); RemoveFrameHandler(MyFrameHandler, windowID, 0); delete ma1; ma1 = 0; delete ma2; ma2 = 0; delete gdh; gdh = 0; delete unitSims[windowID]; unitSims[windowID] = 0; runningSearch1 = false; runningSearch2 = false; mouseTracking = false; } else if (eType == kWindowCreated) { printf("Window %ld created\n", windowID); InstallFrameHandler(MyFrameHandler, windowID, 0); CreateSimulation(windowID); SetNumPorts(windowID, 1); } }
void MyWindowHandler(unsigned long windowID, tWindowEventType eType) { if (eType == kWindowDestroyed) { printf("Window %ld destroyed\n", windowID); RemoveFrameHandler(MyFrameHandler, windowID, 0); mouseTracking = false; delete map; delete me; map = 0; me = 0; } else if (eType == kWindowCreated) { printf("Window %ld created\n", windowID); InstallFrameHandler(MyFrameHandler, windowID, 0); SetNumPorts(windowID, 1); delete map; delete me; //map = new Map("/Users/nathanst/hog2/maps/dao/lak308d.map"); //map = new Map("/Users/nathanst/hog2/maps/da2/ht_chantry.map"); //map = new Map("/Users/nathanst/hog2/maps/random/random512-35-6.map"); //map = new Map("/Users/nathanst/hog2/maps/da2/lt_backalley_g.map"); //map = new Map("/Users/nathanst/hog2/maps/bgmaps/AR0011SR.map"); map = new Map("/Users/nathanst/hog2/maps/bgmaps/AR0012SR.map"); //map = new Map("/Users/nathanst/hog2/maps/rooms/8room_000.map"); //map = new Map("/Users/nathanst/hog2/maps/mazes/maze512-16-0.map"); //map = new Map("/Users/nathanst/hog2/maps/dao/orz107d.map"); map->SetTileSet(kWinter); me = new MapEnvironment(map); } }
void MyDisplayHandler(unsigned long windowID, tKeyboardModifier mod, char key) { switch (key) { case 'w': if (searchWeight == 0) searchWeight = 1.0; else if (searchWeight == 1.0) searchWeight = 10.0; else if (searchWeight == 10.0) searchWeight = 0; break; case '[': if (gStepsPerFrame >= 2) gStepsPerFrame /= 2; break; case ']': gStepsPerFrame *= 2; break; case '{': if (gdh && ((GraphMapInconsistentHeuristic*)gdh)->GetMode() == kCompressed) ((GraphMapInconsistentHeuristic*)gdh)->SetMode(kMax); else ((GraphMapInconsistentHeuristic*)gdh)->SetMode(kCompressed); break; case '}': if (gdh) ((GraphMapInconsistentHeuristic*)gdh)->IncreaseDisplayHeuristic(); break; case 'q': if (mod != kShiftDown) SetActivePort(windowID, (GetActivePort(windowID)+1)%GetNumPorts(windowID)); else { SetNumPorts(windowID, 1+(GetNumPorts(windowID)%MAXPORTS)); } break; case 'p': unitSims[windowID]->SetPaused(!unitSims[windowID]->GetPaused()); break; case 'o': { if (runningSearch1) { if (a1.DoSingleSearchStep(path)) { printf("Solution: moves %d, length %f, %lld nodes\n", (int)path.size(), ma1->GetPathLength(path), a1.GetNodesExpanded()); runningSearch1 = false; } } if (runningSearch2) { if (a2.DoSingleSearchStep(path)) { printf("Solution: moves %d, length %f, %lld nodes\n", (int)path.size(), ma1->GetPathLength(path), a2.GetNodesExpanded()); runningSearch2 = false; } } } break; default: break; } }
/** * This function is used to allocate the unit simulated that you want to run. * Any parameters or other experimental setup can be done at this time. */ void CreateSimulation(int id) { //Graph *g; if (gDefaultMap[0] != 0) { mp = new Map(gDefaultMap); mp->Scale(512, 512); grp = GraphSearchConstants::GetGraph(mp); env = new GraphEnvironment(mp, grp, new GraphMapInconsistentHeuristic(mp, grp)); while(gFrom==gTo) { gFrom = grp->GetRandomNode()->GetNum(); gTo = grp->GetRandomNode()->GetNum(); } } else if (fig == 0) { grp = BuildInconsistentGraph(5, N, N); // gFrom = 5*N*N-1; // to = 0; env = new GraphEnvironment(grp, new GraphLabelHeuristic(grp, gTo)); env->SetDirected(true); } else if (fig == 1) { grp = PropUtil::graphGenerator::genFig1(N); gFrom = N; gTo = 0; env = new GraphEnvironment(grp, new GraphLabelHeuristic(grp, gTo)); } else if(fig == 2) { grp = PropUtil::graphGenerator::genFig2(N); gFrom = N; gTo = 0; env = new GraphEnvironment(grp, new GraphLabelHeuristic(grp, gTo)); } else if (fig == 3){ grp = PropUtil::graphGenerator::genFig3(N); gFrom = 0; gTo = 2*N - 1; env = new GraphEnvironment(grp, new GraphLabelHeuristic(grp, gTo)); } else { grp = PropUtil::graphGenerator::genFig4(N); gFrom = 0; gTo = 2*N + 1; env = new GraphEnvironment(grp, new GraphLabelHeuristic(grp, gTo)); } printf("Environment ready.\n"); unitSims.resize(id+1); unitSims[id] = new GraphSimulation(env); unitSims[id]->SetStepType(kMinTime); SetNumPorts(id, 1); }
void MyDisplayHandler(unsigned long windowID, tKeyboardModifier mod, char key) { switch (key) { case 'r': recording = !recording; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': ts->ApplyAction(s, key-'0'); break; case '\t': if (mod != kShiftDown) SetActivePort(windowID, (GetActivePort(windowID)+1)%GetNumPorts(windowID)); else { SetNumPorts(windowID, 1+(GetNumPorts(windowID)%MAXPORTS)); } break; case 'p': break; case 'o': { if (!ts) break; if (mod == kShiftDown) { IDAStar<TopSpinState, TopSpinAction> ida; std::vector<TopSpinAction> path1; std::vector<TopSpinState> path2; TopSpinState s(4, 4); TopSpinState g(4, 4); for (unsigned int x = 0; x < 500; x++) { std::vector<TopSpinAction> acts; ts->GetActions(s, acts); ts->ApplyAction(s, acts[random()%acts.size()]); } std::cout << "Searching from: " << std::endl << s << std::endl << g << std::endl; Timer t; t.StartTimer(); ida.GetPath(ts, s, g, path1); t.EndTimer(); std::cout << "Path found, length " << path1.size() << " time:" << t.GetElapsedTime() << std::endl; } } break; default: break; } }
void MyWindowHandler(unsigned long windowID, tWindowEventType eType) { if (eType == kWindowDestroyed) { printf("Window %ld destroyed\n", windowID); RemoveFrameHandler(MyFrameHandler, windowID, 0); } else if (eType == kWindowCreated) { printf("Window %ld created\n", windowID); InstallFrameHandler(MyFrameHandler, windowID, 0); SetNumPorts(windowID, 1); } }
/** * This function is used to allocate the unit simulated that you want to run. * Any parameters or other experimental setup can be done at this time. */ void CreateSimulation(int id) { //Graph *g; if (gDefaultMap[0] != 0) { mp = new Map(gDefaultMap); grp = GraphSearchConstants::GetGraph(mp); env = new GraphEnvironment(grp, new GraphMapInconsistentHeuristic(mp, grp)); while(from==to) { from = grp->GetRandomNode()->GetNum(); to = grp->GetRandomNode()->GetNum(); } } else if (fig == 1) { grp = PropUtil::graphGenerator::genFig1(N); from = N; to = 0; env = new GraphEnvironment(grp, new GraphLabelHeuristic(grp, to)); } else { grp = PropUtil::graphGenerator::genFig2(N); from = 0; to = 2*N - 1; env = new GraphEnvironment(grp, new GraphLabelHeuristic(grp, to)); } printf("Environment ready.\n"); unitSims.resize(id+1); unitSims[id] = new GraphSimulation(env); unitSims[id]->SetStepType(kMinTime); SetNumPorts(id, 1); }
void MyDisplayHandler(unsigned long windowID, tKeyboardModifier mod, char key) { switch (key) { case '\t': if (mod != kShiftDown) SetActivePort(windowID, (GetActivePort(windowID)+1)%GetNumPorts(windowID)); else { SetNumPorts(windowID, 1+(GetNumPorts(windowID)%MAXPORTS)); } break; case 'p': unitSims[windowID]->SetPaused(!unitSims[windowID]->GetPaused()); break; case 'o': { // if (CFOR == 0) // { // CFOR = new CFOptimalRefinement(); // while (!CFOR->InitializeSearch(unitSims[windowID]->GetEnvironment()->GetMapAbstraction(), // unitSims[windowID]->GetEnvironment()->GetMapAbstraction()->GetAbstractGraph(0)->GetRandomNode(), // unitSims[windowID]->GetEnvironment()->GetMapAbstraction()->GetAbstractGraph(0)->GetRandomNode())) // {} // } // if (CFOR->DoOneSearchStep()) // printf("DONE!!!\n"); if(ALG == 0) { ALG = new Prop(vid,delta); ALG->InitializeSearch(env,grp,from,to,thePath); } if(!done && ALG->DoSingleSearchStep(thePath)) { printf("\nDone! Nodes expanded=%ld, Nodes touched=%ld, Reopenings=%d.\n",ALG->GetNodesExpanded(),ALG->GetNodesTouched(),ALG->GetReopenings()); printf("Algorithm %s, solution cost=%lf, solution edges=%d.\n", ALG->algname,ALG->GetSolutionCost(),(int)thePath.size()); done = true; } } if (unitSims[windowID]->GetPaused()) { unitSims[windowID]->SetPaused(false); unitSims[windowID]->StepTime(1.0/30.0); unitSims[windowID]->SetPaused(true); } break; case 'k': ALG = new Prop(0); ALG->GetPath(env,grp,from,to,thePath); printf("\n"); ALG = new Prop(1); ALG->GetPath(env,grp,from,to,thePath); printf("\n"); ALG = new Prop(2,delta); ALG->GetPath(env,grp,from,to,thePath); printf("\n"); ALG = new Prop(3); ALG->GetPath(env,grp,from,to,thePath); printf("\n"); ALG = new Prop(4); ALG->GetPath(env,grp,from,to,thePath); printf("\n"); break; case ']': absType = (absType+1)%3; break; case '[': absType = (absType+4)%3; break; // case '{': unitSim->setPaused(true); unitSim->offsetDisplayTime(-0.5); break; // case '}': unitSim->offsetDisplayTime(0.5); break; default: // set N to be whatever size I press //GraphSizeN = key-'0'; //if (GraphSizeN == 0) // GraphSizeN = 10; break; } }
void MyRandomUnitKeyHandler(unsigned long windowID, tKeyboardModifier mod, char) { // if (mod == kShiftDown) // { // RunWorkMeasureTest(); // return; // } Map *m = unitSims[windowID]->GetEnvironment()->GetMap(); unitSims[windowID]->ClearAllUnits(); m->SetTileSet(kFast); // recording = true; // startRecording(); int x1, y1, x2, y2; if (mod == kShiftDown) { x1 = 0; y1 = 0; x2 = m->GetMapWidth()-1; // x2 = 0;//m->GetMapWidth()-1; y2 = m->GetMapHeight()-1; } else { do { x2 = random()%m->GetMapWidth(); y2 = random()%m->GetMapHeight(); x1 = random()%m->GetMapWidth(); y1 = random()%m->GetMapHeight(); } while ((m->GetTerrainType(x1, y1) != kGround) || (m->GetTerrainType(x2, y2) != kGround)); do { x2 = random()%m->GetMapWidth(); y2 = random()%m->GetMapHeight(); x1 = random()%m->GetMapWidth(); y1 = random()%m->GetMapHeight(); } while ((m->GetTerrainType(x1, y1) != kGround) || (m->GetTerrainType(x2, y2) != kGround)); } //x1 = 6; y1 = 3; x2 = 15; y2 = 72; xySpeedHeading a(x1, y1), b(x2, y2); //xySpeedHeading a(0, 0), b(mazeSize-1, mazeSize-1); // xySpeedHeading a(0, 0), b(mazeSize-1, 0); a1.GetPath(unitSims[windowID]->GetEnvironment(), a, b, path); std::cout << "Found path -- " << a1.GetNodesExpanded() << " nodes expanded; length: " << unitSims[windowID]->GetEnvironment()->GetPathLength(path) << std::endl; std::cout << "Solving " << a << " to " << b << std::endl; stepsPerFrame = 1.0/120.0; // GLdouble a1, b1, c1, r1; // m->GetOpenGLCoord((x1+x2)/2, (y1+y2)/2, a1, b1, c1, r1); // cameraMoveTo(a1, b1, c1-600*r1, 1.0); // cameraLookAt(a1, b1, c1, 1.0); // measure.MeasureDifficultly(unitSims[windowID]->GetEnvironment(), a, b); // measure.ShowHistogram(); // LocalSensing::RIBS<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment> *u1 = new LocalSensing::RIBS<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(a, b); // u1->SetWeight(1.0); // u1->SetSpeed(0.02); // unitSims[windowID]->AddUnit(u1); // LSSLRTAStarUnit<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment> *u2 = new LSSLRTAStarUnit<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(a, b, new LSSLRTAStar<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(1)); // u2->SetSpeed(0.02); // unitSims[windowID]->AddUnit(u2); LSSLRTAStarUnit<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment> *u2 = new LSSLRTAStarUnit<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(a, b, new LSSLRTAStar<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(10)); u2->SetSpeed(0.02); unitSims[windowID]->AddUnit(u2); // LSSLRTAStarUnit<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment> *u3 = new LSSLRTAStarUnit<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(a, b, new LSSLRTAStar<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(10)); // u3->SetSpeed(0.02); // unitSims[windowID]->AddUnit(u3); // FLRTAStarUnit<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment> *u4 = new FLRTAStarUnit<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(a, b, new FLRTA::FLRTAStar<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(10, 1.5)); // u4->SetSpeed(0.02); // unitSims[windowID]->AddUnit(u4); // // FLRTAStarUnit<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment> *u5 = new FLRTAStarUnit<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(a, b, new FLRTA::FLRTAStar<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(10, 5.5)); // u5->SetSpeed(0.02); // unitSims[windowID]->AddUnit(u5); // FLRTA::FLRTAStar<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment> *f; FLRTAStarUnit<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment> *u6 = new FLRTAStarUnit<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(a, b, f = new FLRTA::FLRTAStar<xySpeedHeading, deltaSpeedHeading, Directional2DEnvironment>(10, 1.5)); f->SetOrderRedundant(false); f->SetUseLocalGCost(true); u6->SetSpeed(0.02); unitSims[windowID]->AddUnit(u6); unitSims[windowID]->GetStats()->AddFilter("trialDistanceMoved"); unitSims[windowID]->GetStats()->AddFilter("TotalLearning"); unitSims[windowID]->GetStats()->AddFilter("nodesExpanded"); unitSims[windowID]->GetStats()->EnablePrintOutput(true); unitSims[windowID]->SetTrialLimit(50000); SetNumPorts(windowID, 1+(unitSims[windowID]->GetNumUnits()-1)%MAXPORTS); }
void MyDisplayHandler(unsigned long windowID, tKeyboardModifier mod, char key) { switch (key) { case '[': stepsPerFrame/=2.0; break; case ']': stepsPerFrame*=2.0; break; case '|': unitSims[windowID]->ClearAllUnits(); break; case '\t': if (mod != kShiftDown) SetActivePort(windowID, (GetActivePort(windowID)+1)%GetNumPorts(windowID)); else { SetNumPorts(windowID, 1+(GetNumPorts(windowID)%MAXPORTS)); } break; case 'p': unitSims[windowID]->SetPaused(!unitSims[windowID]->GetPaused()); break; case 'o': { if (unitSims[windowID]->GetPaused()) { unitSims[windowID]->SetPaused(false); unitSims[windowID]->StepTime(.02); unitSims[windowID]->SetPaused(true); } else unitSims[windowID]->StepTime(1.0/30.0); } break; case 'd': { printf("First travel:\n"); for (unsigned int x = 0; x < unitSims[windowID]->GetNumUnits(); x++) { statValue v; int choice = unitSims[windowID]->GetStats()->FindNextStat("trialDistanceMoved", unitSims[windowID]->GetUnit(x)->GetName(), 0); unitSims[windowID]->GetStats()->LookupStat(choice, v); printf("%s\t%f\n", unitSims[windowID]->GetUnit(x)->GetName(), v.fval); } printf("First nodes:\n"); for (unsigned int x = 0; x < unitSims[windowID]->GetNumUnits(); x++) { statValue v; int choice = unitSims[windowID]->GetStats()->FindNextStat("nodesExpanded", unitSims[windowID]->GetUnit(x)->GetName(), 0); unitSims[windowID]->GetStats()->LookupStat(choice, v); printf("%s\t%ld\n", unitSims[windowID]->GetUnit(x)->GetName(), v.lval); } printf("First Nodes/travel:\n"); for (unsigned int x = 0; x < unitSims[windowID]->GetNumUnits(); x++) { statValue v1; int choice = unitSims[windowID]->GetStats()->FindNextStat("nodesExpanded", unitSims[windowID]->GetUnit(x)->GetName(), 0); unitSims[windowID]->GetStats()->LookupStat(choice, v1); statValue v2; choice = unitSims[windowID]->GetStats()->FindNextStat("trialDistanceMoved", unitSims[windowID]->GetUnit(x)->GetName(), 0); unitSims[windowID]->GetStats()->LookupStat(choice, v2); printf("%s\t%f\n", unitSims[windowID]->GetUnit(x)->GetName(), v1.lval/v2.fval); } printf("Total travel:\n"); for (unsigned int x = 0; x < unitSims[windowID]->GetNumUnits(); x++) { printf("%s\t%f\n", unitSims[windowID]->GetUnit(x)->GetName(), SumStatEntries(unitSims[windowID]->GetStats(), "trialDistanceMoved", unitSims[windowID]->GetUnit(x)->GetName())); } printf("Total nodes:\n"); for (unsigned int x = 0; x < unitSims[windowID]->GetNumUnits(); x++) { printf("%s\t%f\n", unitSims[windowID]->GetUnit(x)->GetName(), SumStatEntries(unitSims[windowID]->GetStats(), "nodesExpanded", unitSims[windowID]->GetUnit(x)->GetName())); } printf("Nodes/travel:\n"); for (unsigned int x = 0; x < unitSims[windowID]->GetNumUnits(); x++) { printf("%s\t%f\n", unitSims[windowID]->GetUnit(x)->GetName(), SumStatEntries(unitSims[windowID]->GetStats(), "nodesExpanded", unitSims[windowID]->GetUnit(x)->GetName())/ SumStatEntries(unitSims[windowID]->GetStats(), "trialDistanceMoved", unitSims[windowID]->GetUnit(x)->GetName()) ); } } default: break; } }
void MyDisplayHandler(unsigned long windowID, tKeyboardModifier mod, char key) { switch (key) { case '\t': if (mod != kShiftDown) SetActivePort(windowID, (GetActivePort(windowID)+1)%GetNumPorts(windowID)); else { SetNumPorts(windowID, 1+(GetNumPorts(windowID)%MAXPORTS)); } break; case 'p': unitSims[windowID]->SetPaused(!unitSims[windowID]->GetPaused()); break; case 'o': { if (ALG == 0) { if (vid != 6) ALG = new Prop(vid,delta); else ALG = new AStarDelay(); ALG->InitializeSearch(env,grp,gFrom,gTo,gPath); } if(!done && ALG->DoSingleSearchStep(gPath)) { printf("\nDone! Nodes expanded=%lld, Nodes touched=%lld, Reopenings=%lld.\n",ALG->GetNodesExpanded(),ALG->GetNodesTouched(),ALG->GetNodesReopened()); printf("Algorithm %s, solution cost=%lf, solution edges=%d.\n", ALG->GetName(),ALG->GetSolutionCost(),ALG->GetSolutionEdges()); done = true; } } if (unitSims[windowID]->GetPaused()) { unitSims[windowID]->SetPaused(false); unitSims[windowID]->StepTime(1.0/30.0); unitSims[windowID]->SetPaused(true); } break; case 'k': RunInconsistencyExperiment(); break; ALG = new Prop(0); ALG->GetPath(env,grp,gFrom,gTo,gPath); printf("\n"); ALG = new Prop(1); ALG->GetPath(env,grp,gFrom,gTo,gPath); printf("\n"); ALG = new Prop(2,delta); ALG->GetPath(env,grp,gFrom,gTo,gPath); printf("\n"); // ALG = new Prop(3); // ALG->GetPath(env,grp,gFrom,gTo,gPath); // printf("\n"); // ALG = new Prop(4); // ALG->GetPath(env,grp,gFrom,gTo,gPath); // printf("\n"); // ALG = new Prop(5); // ALG->GetPath(env,grp,gFrom,gTo,gPath); // printf("\n"); ALG = new AStarDelay(); ALG->GetPath(env,grp,gFrom,gTo,gPath); printf("Delay\t%lld\t%lld\t%lld\n",ALG->GetNodesExpanded(),ALG->GetNodesTouched(),ALG->GetNodesReopened()); // ALG = new Prop(7); // ALG->GetPath(env,grp,gFrom,gTo,gPath); // printf("\n"); // // ALG = new Prop(8); // ALG->GetPath(env,grp,gFrom,gTo,gPath); // printf("\n"); // // ALG = new Prop(9); // ALG->GetPath(env,grp,gFrom,gTo,gPath); // printf("\n"); break; case ']': absType = (absType+1)%3; break; case '[': absType = (absType+4)%3; break; // case '{': unitSim->setPaused(true); unitSim->offsetDisplayTime(-0.5); break; // case '}': unitSim->offsetDisplayTime(0.5); break; default: // set N to be whatever size I press //GraphSizeN = key-'0'; //if (GraphSizeN == 0) // GraphSizeN = 10; break; } }