/** * Allows you to install any keyboard handlers needed for program interaction. */ void InstallHandlers() { InstallKeyboardHandler(MyDisplayHandler, "Cycle Viewports", "Cycle number/which viewport (via shift)", kAnyModifier, 'q'); InstallKeyboardHandler(MyDisplayHandler, "Pause Simulation", "Pause simulation execution.", kNoModifier, 'p'); InstallKeyboardHandler(MyDisplayHandler, "Step Simulation", "If the simulation is paused, step forward .1 sec.", kNoModifier, 'o'); InstallKeyboardHandler(MyDisplayHandler, "Change weight", "Change the search weight", kNoModifier, 'w'); InstallKeyboardHandler(MyDisplayHandler, "Rotate Compression", "Rotate Compression being shown in heuristic", kAnyModifier, '}'); InstallKeyboardHandler(MyDisplayHandler, "Rotate Displayed Heuristic", "Rotate which heuristic is shown", kAnyModifier, '{'); InstallKeyboardHandler(MyDisplayHandler, "Step Abs Type", "Increase abstraction type", kAnyModifier, ']'); InstallKeyboardHandler(MyDisplayHandler, "Step Abs Type", "Decrease abstraction type", kAnyModifier, '['); InstallKeyboardHandler(MyPathfindingKeyHandler, "Mapbuilding Unit", "Deploy unit that paths to a target, building a map as it travels", kNoModifier, 'd'); InstallKeyboardHandler(MyRandomUnitKeyHandler, "Add A* Unit", "Deploys a simple a* unit", kNoModifier, 'a'); InstallKeyboardHandler(MyRandomUnitKeyHandler, "Add simple Unit", "Deploys a randomly moving unit", kShiftDown, 'a'); InstallKeyboardHandler(MyRandomUnitKeyHandler, "Add simple Unit", "Deploys a right-hand-rule unit", kControlDown, '1'); // InstallCommandLineHandler(MyCLHandler, "-testHeuristic", "-testHeuristic scenario", "measure the ratio of the heuristic to the optimal dist"); InstallWindowHandler(MyWindowHandler); InstallMouseClickHandler(MyClickHandler); }
/** * Allows you to install any keyboard handlers needed for program interaction. */ void InstallHandlers() { InstallKeyboardHandler(MyDisplayHandler, "Toggle Abstraction", "Toggle display of the ith level of the abstraction", kAnyModifier, '0', '9'); InstallKeyboardHandler(MyDisplayHandler, "Cycle Abs. Display", "Cycle which group abstraction is drawn", kAnyModifier, '\t'); InstallKeyboardHandler(MyDisplayHandler, "Pause Simulation", "Pause simulation execution.", kNoModifier, 'p'); InstallKeyboardHandler(MyDisplayHandler, "Step Simulation", "If the simulation is paused, step forward .1 sec.", kNoModifier, 'o'); InstallKeyboardHandler(MyDisplayHandler, "Step History", "If the simulation is paused, step forward .1 sec in history", kAnyModifier, '}'); InstallKeyboardHandler(MyDisplayHandler, "Step History", "If the simulation is paused, step back .1 sec in history", kAnyModifier, '{'); InstallKeyboardHandler(MyDisplayHandler, "Step Abs Type", "Increase abstraction type", kAnyModifier, ']'); InstallKeyboardHandler(MyDisplayHandler, "Step Abs Type", "Decrease abstraction type", kAnyModifier, '['); InstallKeyboardHandler(MyPathfindingKeyHandler, "Mapbuilding Unit", "Deploy unit that paths to a target, building a map as it travels", kNoModifier, 'd'); InstallKeyboardHandler(MyRandomUnitKeyHandler, "Add A* Unit", "Deploys a simple a* unit", kNoModifier, 'a'); InstallKeyboardHandler(MyRandomUnitKeyHandler, "Add simple Unit", "Deploys a randomly moving unit", kShiftDown, 'a'); InstallKeyboardHandler(MyRandomUnitKeyHandler, "Add simple Unit", "Deploys a right-hand-rule unit", kControlDown, 1); //InstallCommandLineHandler(MyCLHandler, "-map", "-map filename", "Selects the default map to be loaded."); InstallWindowHandler(MyWindowHandler); InstallMouseClickHandler(MyClickHandler); }
/** * Allows you to install any keyboard handlers needed for program interaction. */ void InstallHandlers() { InstallKeyboardHandler(MyDisplayHandler, "Record", "Record a movie", kAnyModifier, 'r'); InstallKeyboardHandler(MyDisplayHandler, "Toggle Abstraction", "Toggle display of the ith level of the abstraction", kAnyModifier, '0', '9'); InstallKeyboardHandler(MyDisplayHandler, "Cycle Abs. Display", "Cycle which group abstraction is drawn", kAnyModifier, '\t'); InstallKeyboardHandler(MyDisplayHandler, "Pause Simulation", "Pause simulation execution.", kNoModifier, 'p'); InstallKeyboardHandler(MyDisplayHandler, "Step Simulation", "If the simulation is paused, step forward .1 sec.", kAnyModifier, 'o'); InstallKeyboardHandler(MyDisplayHandler, "Step History", "If the simulation is paused, step forward .1 sec in history", kAnyModifier, '}'); InstallKeyboardHandler(MyDisplayHandler, "Step History", "If the simulation is paused, step back .1 sec in history", kAnyModifier, '{'); InstallKeyboardHandler(MyDisplayHandler, "Step Abs Type", "Increase abstraction type", kAnyModifier, ']'); InstallKeyboardHandler(MyDisplayHandler, "Step Abs Type", "Decrease abstraction type", kAnyModifier, '['); InstallKeyboardHandler(TSTest, "TS Test", "Test the TS PDBs", kNoModifier, 'd'); InstallKeyboardHandler(BuildTS_PDB, "Build TS PDBs", "Build PDBs for the TS", kNoModifier, 'a'); InstallKeyboardHandler(ValidateCompressionIdeas, "Validate", "Run experiment to validate compression ideas", kNoModifier, 'v'); InstallCommandLineHandler(MyCLHandler, "-run", "-run", "Runs pre-set experiments."); InstallWindowHandler(MyWindowHandler); InstallMouseClickHandler(MyClickHandler); }
/** * Allows you to install any keyboard handlers needed for program interaction. */ void InstallHandlers() { InstallKeyboardHandler(MyDisplayHandler, "Toggle Abstraction", "Toggle display of the ith level of the abstraction", kAnyModifier, '0', '9'); InstallKeyboardHandler(MyDisplayHandler, "Cycle Abs. Display", "Cycle which group abstraction is drawn", kAnyModifier, '\t'); InstallKeyboardHandler(MyDisplayHandler, "Pause Simulation", "Pause simulation execution.", kNoModifier, 'p'); InstallKeyboardHandler(MyDisplayHandler, "Step Simulation", "If the simulation is paused, step forward .1 sec.", kNoModifier, 'o'); InstallKeyboardHandler(MyDisplayHandler, "Sum Distance", "Print total distance travelled by each unit", kNoModifier, 'd'); InstallKeyboardHandler(MyDisplayHandler, "Step History", "If the simulation is paused, step forward .1 sec in history", kAnyModifier, '}'); InstallKeyboardHandler(MyDisplayHandler, "Step History", "If the simulation is paused, step back .1 sec in history", kAnyModifier, '{'); InstallKeyboardHandler(MyDisplayHandler, "Increase Sim Speed", "Increase Sim Speed", kAnyModifier, ']'); InstallKeyboardHandler(MyDisplayHandler, "Decrease Sim Speed", "Decrease Sim Speed", kAnyModifier, '['); InstallKeyboardHandler(MyDisplayHandler, "Clear units", "Clear all units from sim", kAnyModifier, '|'); InstallKeyboardHandler(MyRandomUnitKeyHandler, "Add A* Unit", "Deploys a simple a* unit", kNoModifier, 'a'); InstallKeyboardHandler(MyRandomUnitKeyHandler, "Add simple Unit", "Deploys a randomly moving unit", kShiftDown, 'a'); InstallKeyboardHandler(MyRandomUnitKeyHandler, "Add simple Unit", "Deploys a right-hand-rule unit", kControlDown, '1'); InstallCommandLineHandler(MyCLHandler, "-map", "-map filename", "Selects the default map to be loaded."); InstallCommandLineHandler(MyCLHandler, "-size", "-size <integer>", "If size is set, we create a square maze with the x and y dimensions specified."); InstallCommandLineHandler(MyCLHandler, "-scenario", "-scenario <file>", "Load and run a scenario offline."); InstallCommandLineHandler(MyCLHandler, "-scaleTest", "-scaleTest <size>", "Run a scaling test with local minima <size>."); InstallCommandLineHandler(MyCLHandler, "-STPTest", "-STPTest", "Run a STP test."); InstallWindowHandler(MyWindowHandler); InstallMouseClickHandler(MyClickHandler); }
/** * Allows you to install any keyboard handlers needed for program interaction. */ void InstallHandlers() { InstallKeyboardHandler(MyDisplayHandler, "Record", "Record a movie", kAnyModifier, 'r'); InstallKeyboardHandler(MyDisplayHandler, "Toggle Abstraction", "Toggle display of the ith level of the abstraction", kAnyModifier, '0', '9'); InstallKeyboardHandler(MyDisplayHandler, "Cycle Abs. Display", "Cycle which group abstraction is drawn", kAnyModifier, '\t'); InstallKeyboardHandler(MyDisplayHandler, "Pause Simulation", "Pause simulation execution.", kNoModifier, 'p'); InstallKeyboardHandler(MyDisplayHandler, "Step Simulation", "If the simulation is paused, step forward .1 sec.", kAnyModifier, 'o'); InstallKeyboardHandler(MyDisplayHandler, "Step History", "If the simulation is paused, step forward .1 sec in history", kAnyModifier, '}'); InstallKeyboardHandler(MyDisplayHandler, "Step History", "If the simulation is paused, step back .1 sec in history", kAnyModifier, '{'); InstallKeyboardHandler(MyDisplayHandler, "Step Abs Type", "Increase abstraction type", kAnyModifier, ']'); InstallKeyboardHandler(MyDisplayHandler, "Step Abs Type", "Decrease abstraction type", kAnyModifier, '['); InstallKeyboardHandler(STPTest, "STP Test", "Test the STP PDBs", kNoModifier, 'd'); InstallKeyboardHandler(BuildSTP_PDB, "Build STP PDBs", "Build PDBs for the STP", kNoModifier, 'a'); InstallCommandLineHandler(MyCLHandler, "-map", "-map filename", "Selects the default map to be loaded."); InstallWindowHandler(MyWindowHandler); InstallMouseClickHandler(MyClickHandler); }
void main(void) { int j,k; long xp=6*CELL_WIDTH, yp=6*CELL_HEIGHT,dx,dy, angle = 500; char key; float rad; clrscr(); SetMode(); LoadMap("RayMap.Dat"); Wall = (unsigned char *)malloc(64*64); Wall1 = (unsigned char *)malloc(64*64); ClearScreen(SCREEN); MakeTables(); // get mem for double buffer. VSCREEN = (char far*)farmalloc(64000); Fondo = (char far*)farmalloc(64000); LoadImage(Fondo,"fondo.cel"); LoadImage(Wall,"walltext.cel"); LoadImage(Wall1,"wall1.cel"); InstallKeyboardHandler(); while (!keypress[ESC]) { Dest = VSCREEN; Source = Fondo; ShowPage32(); RayCast(xp,yp,angle); Dest = SCREEN; Source = VSCREEN; ShowPage32(); dx=dy=0; if (keypress[RIGHT]) if ((angle += WorldAngles[6]) > WorldAngles[360]) angle = WorldAngles[0]; if (keypress[LEFT]) if ((angle -=WorldAngles[6]) < WorldAngles[0]) angle = WorldAngles[360]; if (keypress[UP]) { rad = 6.28*angle/WorldAngles[360]; dx=cos(rad)*30; dy=sin(rad)*30; } if (keypress[DOWN]) { rad = 6.28*angle/WorldAngles[360]; dx=-cos(rad)*30; dy=-sin(rad)*30; } // move player xp+=dx; yp+=dy; } RemoveKeyboardHandler(); SetText(); farfree(VSCREEN); farfree(Fondo); FreeTables(); // if (Wall != NULL) free(Wall); free(Wall1); // farfree(Wall1); }
/** * Allows you to install any keyboard handlers needed for program interaction. */ void InstallHandlers() { InstallKeyboardHandler(MyDisplayHandler, "Toggle Abstraction", "Toggle display of the ith level of the abstraction", kAnyModifier, '0', '9'); InstallKeyboardHandler(MyDisplayHandler, "Cycle Abs. Display", "Cycle which group abstraction is drawn", kAnyModifier, 't'); InstallKeyboardHandler(MyDisplayHandler, "Toggle classifier", "toggle classifier", kAnyModifier, 'c'); InstallKeyboardHandler(MyDisplayHandler, "Toggle Neural Network", "toggle Neural Network", kAnyModifier, 'n'); InstallKeyboardHandler(MyDisplayHandler, "Pause Simulation", "Pause simulation execution.", kNoModifier, 'p'); InstallKeyboardHandler(MyDisplayHandler, "Step Simulation", "If the simulation is paused, step forward .1 sec.", kNoModifier, 'o'); InstallKeyboardHandler(MyDisplayHandler, "Toggle threshold", "Toggle whether output is thresholded for display.", kAnyModifier, ']'); InstallKeyboardHandler(MyDisplayHandler, "Toggle threshold", "Toggle whether output is thresholded for display.", kAnyModifier, '['); InstallKeyboardHandler(MyPathfindingKeyHandler, "Mapbuilding Unit", "Deploy unit that paths to a target, building a map as it travels", kNoModifier, 'd'); InstallKeyboardHandler(MyRandomUnitKeyHandler, "Add A* Unit", "Deploys a simple a* unit", kNoModifier, 'a'); InstallKeyboardHandler(MyRandomUnitKeyHandler, "Add simple Unit", "Deploys a randomly moving unit", kShiftDown, 'a'); InstallKeyboardHandler(MyRandomUnitKeyHandler, "Add simple Unit", "Deploys a right-hand-rule unit", kControlDown, '1'); InstallCommandLineHandler(MyCLHandler, "-map", "-map filename", "Selects the default map to be loaded."); InstallCommandLineHandler(MyCLHandler, "-problems", "-problems filename sectorMultiplier", "Selects the problem set to run."); InstallCommandLineHandler(MyCLHandler, "-problems2", "-problems2 filename sectorMultiplier", "Selects the problem set to run."); InstallCommandLineHandler(MyCLHandler, "-size", "-batch integer", "If size is set, we create a square maze with the x and y dimensions specified."); InstallWindowHandler(MyWindowHandler); InstallMouseClickHandler(MyClickHandler); }