byte GameLogic::opposite_corner_x() { if (open(0) && mine(8)) { return 0; } else if (open(2) && mine(6)) { return 2; } else if (open(6) && mine(2)) { return 6; } else if (open(8) && mine(0)) { return 8; } else { return NO_POSN; } }
void mine_gold() { int seed, input, secret; srand(seed); puts(""); puts("------------------------------------------------------------------"); puts(" Let's start mining! Choose a location by entering a number "); puts("------------------------------------------------------------------"); printf("Location > "); scanf("%d", &input); puts(""); puts("Hold on. Mining takes time..."); secret = rand(); puts(""); mine(3); mine(3); mine(3); puts(""); if(input == secret) { puts("Congrats! You found gold!"); system("cat flag.txt"); } else { puts("You FAILED to mine any gold"); puts("What a pity... maybe consider a career switch?"); } }
void MineField::readConfig(Config& cfg) { cfg.setGroup("Field"); lev = cfg.readNumEntry("Level",1); setup(lev); flagAction = NoAction; ignoreClick = FALSE; currRow = currCol = 0; QString grid = cfg.readEntry("Grid"); int x; if ( !grid.isEmpty() ) { int i=0; minecount=0; mineguess=0; for ( x = 0; x < numCols; x++ ) { for ( int y = 0; y < numRows; y++ ) { char code='A'+(x*17+y*101)%21; // Reduce the urge to cheat int st = (char)(QChar)grid[i++]-code; Mine* m = mine( y, x ); if (!m) continue; if ( st >= 5 ) { st-=5; m->setMined(TRUE); minecount++; mineguess++; } m->setState((Mine::MineState)st); switch ( m->state() ) { case Mine::Flagged: if (m->isMined()) minecount--; mineguess--; break; case Mine::Empty: --nonminecount; break; default: break; } } } for ( x = 0; x < numCols; x++ ) { for ( int y = 0; y < numRows; y++ ) { Mine* m = mine( y, x ); if ( m && m->state() == Mine::Empty ) m->setHint(getHint(y,x)); } } } setState( Playing ); emit mineCount( mineguess ); }
byte GameLogic::second_x_trap() { if ((mine(6) && theirs(5)) || (mine(2) && theirs(7))) { return 0; } else if ((mine(8) && theirs(3)) || (mine(0) && theirs(7))) { return 2; } else if ((mine(8) && theirs(1)) || (mine(0) && theirs(5))) { return 6; } else if ((mine(2) && theirs(3)) || (mine(6) && theirs(1))) { return 8; } else { return NO_POSN; } }
void* work(void* arg){ int i; mine(); return NULL; }
list VISPConverter::convertToBoost(const vpHomogeneousMatrix &cMo) { vpHomogeneousMatrix mine(cMo); std::vector<double> v; mine.convert(v); return std_vector_to_py_list(v); }
int test_colt_nested_cells() { char *outer1[] = { "1962", "1977", "1989", "2010" }; char *outer2[] = { "1990", "2001", "2008", "2015" }; char *outer3[] = { "1993", "2001", "2009", "2013" }; char *inner1[] = { "Jan", "Feb", "March" }; char *inner2[] = { "Apr", "May", "June" }; char *inner3[] = { "July", "August", "September" }; char *inner4[] = { "October", "November", "December" }; char *deep1[] = { "14", "9", "2" }; char *deep2[] = { "25", "4", "0" }; char *head1[] = { "Birth", "start", "better", "bests" }; char *head2[] = { "Mon1", "mon2", "Month3" }; char *head3[] = { "father", "daughter", "son" }; colt_nested_cells deepest1(deep1, 3, head3, "days"); colt_nested_cells deepest2(deep2, 3, head3, "days"); colt_nested_cells in11(inner1, 3, head2, "Months", &deepest1); colt_nested_cells in12(inner1, 3, head2, "Months", &deepest2); colt_nested_cells in2(inner2, 3, head2, "Months"); colt_nested_cells in3(inner3, 3, head2, "Months"); colt_nested_cells in4(inner4, 3, head2, "Months"); colt_nested_cells out11(outer1, 4, head1, "Dates", &in11); colt_nested_cells out11a(outer1, 4, head1, "Dates", &in12); colt_nested_cells out12(outer1, 4, head1, "Dates", &in2); colt_nested_cells out13(outer1, 4, head1, "Dates", &in3); colt_nested_cells out21(outer2, 4, head1, "Dates", &in4); colt_nested_cells out22(outer2, 4, head1, "Dates", &in3); colt_nested_cells out23(outer2, 4, head1, "Dates", &in11); colt_nested_cells out31(outer3, 4, head1, "Dates", &in2); colt_nested_cells out32(outer3, 4, head1, "Dates", &in11); colt_nested_cells out33(outer3, 4, head1, "Dates", &in4); std::ofstream mine("mine.yml"); // out11.start(); out11.nested_output(NULL, 0, &mine); out11a.nested_output(&out11, 0, &mine); out12.nested_output(&out11a, 0, &mine); out23.nested_output(&out12, 0, &mine); out21.nested_output(&out23, 0, &mine); out22.nested_output(&out21, 0, &mine); out31.nested_output(&out22, 0, &mine); out32.nested_output(&out31, 0, &mine); out33.nested_output(&out32, 0, &mine); // out13.end(xxx+1); // out11.end(); }
void play(void) { /*points[CAPTURE] = 100; points[DUMP] = 40; points[EXPLORE] = 30; points[MINE] = 40;*/ act = ACT_EXPLORE; //main game loop while(true) { switch(act) { case ACT_EXPLORE: mined_balls = 0; explore(); act = 1; break; case ACT_PLAY: //circle finished to 20s left, dump balls if too many. vps_update(); if(vps_get_owner(bot.territory)!=team) { //if not ours yet capture(bot.territory); //capture it } else if(vps_get_balls(bot.territory)>0) { //if it is ours and there are balls mine(bot.territory); //get the balls } else if(mined_balls>=15){ act = 2; } else { //move to different territory NOT containg opponent go_territory(get_best(), MOVE_SPEED); } break; case ACT_DUMP: if(team==TEAM_BLUE) { if(bot.territory>=3) score(bot.territory); else if(bot.territory==2) score(3); else score(5); } else { if(bot.territory<3) score(bot.territory); else if(bot.territory==3) score(2); else score(0); } //TODO emergency ball dump before end //dump balls anyway even if we think we don't have any? act = 1; break; } } }
byte GameLogic::unblocked_corner() { byte move_options[4]; int count = 0; if (open(0) && ((mine(2) && open(1)) || (mine(6) && open(3)))) { move_options[count++] = 0; } if (open(2) && ((mine(0) && open(1)) || (mine(8) && open(5)))) { move_options[count++] = 2; } if (open(6) && ((mine(0) && open(3)) || (mine(8) && open(7)))) { move_options[count++] = 6; } if (open(8) && ((mine(2) && open(5)) || (mine(6) && open(7)))) { move_options[count++] = 8; } if (count) { return move_options[rand() % count]; } else { return NO_POSN; } }
void pfPatcherWorker::ProcessFile() { do { NetCliFileManifestEntry& entry = fQueuedFiles.front(); // eap sucks plFileName clName = plString::FromWchar(entry.clientName); plString dlName = plString::FromWchar(entry.downloadName); // Check to see if ours matches plFileInfo mine(clName); if (mine.FileSize() == entry.fileSize) { plMD5Checksum cliMD5(clName); plMD5Checksum srvMD5; srvMD5.SetFromHexString(plString::FromWchar(entry.md5, 32).c_str()); if (cliMD5 == srvMD5) { WhitelistFile(clName, false); fQueuedFiles.pop_front(); continue; } } // It's different... but do we want it? if (fFileDownloadDesired) { if (!fFileDownloadDesired(clName)) { PatcherLogRed("\tDeclined '%S'", entry.clientName); fQueuedFiles.pop_front(); continue; } } // If you got here, they're different and we want it. PatcherLogYellow("\tEnqueuing '%S'", entry.clientName); plFileSystem::CreateDir(plFileName(clName).StripFileName()); // If someone registered for SelfPatch notifications, then we should probably // let them handle the gruntwork... Otherwise, go nuts! if (fSelfPatch) { if (clName == plFileSystem::GetCurrentAppPath().GetFileName()) { clName += ".tmp"; // don't overwrite myself! entry.flags |= kSelfPatch; } } pfPatcherStream* s = new pfPatcherStream(this, dlName, entry); s->Open(clName, "wb"); hsTempMutexLock lock(fRequestMut); fRequests.push_back(Request(dlName, Request::kFile, s)); fQueuedFiles.pop_front(); if (!fRequestActive) IssueRequest(); } while (!fQueuedFiles.empty()); }
ublas::vector<value_type> heavysideFunction::operator()( nodes_type const& pointsOnRef ) const { ublas::vector<value_type> result( pointsOnRef.size2() ); std::fill( result.begin(), result.end(), 1.0 ); nodes_type pointsHat( transformToReal( pointsOnRef ) ); molecule_type::atoms_const_iterator_type atom( M_molecule->begin() ); int i; if ( atom == M_molecule->end() ) return result; node_type Ellipse( pbeqspace_type::Dim ); node_type point( pbeqspace_type::Dim ); value_type r, dr, dr2; for ( i = 0; i < pointsOnRef.size2(); ++i ) { point = element_prod( *M_stretch,column( pointsHat,i ) ) + ( *M_translation ); node_type mine( column( pointsHat,i ) ); //std::cout << "mine = " << mine(0) << " "<< mine(1) << " " << mine(2) << std::endl; //std::cout << "point = " << point(0) << " "<< point(1) << " " << point(2) << std::endl; for ( atom = M_molecule->begin(); atom != M_molecule->end(); ++atom ) { Ellipse = point - atom->center(); r = norm_2( Ellipse ); if ( r <= atom->radius() - M_sW ) { result( i ) = 0; break; } if ( M_sW == 0 || r >= atom->radius() + M_sW ) continue; dr = r - atom->radius() + M_sW; dr2 = dr*dr; result( i ) *= - M_4sW3 * ( dr*dr2 ) + M_34sW2 * dr2; } //std::cout << "result(" << i << ") = " << result(i) << std::endl; } return result; }
int MineField::getHint( int row, int col ) { int hint = 0; for ( int c = col-1; c <= col+1; c++ ) for ( int r = row-1; r <= row+1; r++ ) { Mine* m = mine( r, c ); if ( m && m->isMined() ) hint++; } return hint; }
void test23(void) { string mine("1020304"); string::size_type pos(0); auto pos2(pos); while (string::npos != (pos2 = mine.find("0", pos))) { cout << "Here: " << mine.substr(pos, pos2 - pos) << endl; pos = pos2 + 1; } cout << "Last: " << mine.substr(pos) << endl; }
void RoboMiner::action() { // if(rand() % 512 < 48) // scan(); // std::cout << "E: " << energy << std::endl; if(ascending){ ascend(); return; } if(drillCell){ --energy; drill(drillCell->getY(), drillCell->getX()); return; } if(cell->mineralCount() > 0 && !isFull()){ --energy; mine(); return; } if(!destCell || exploring){ energy -= 2; scan(); } if(destCell){ navigate(); }else{ int offset_x=0, offset_y=0; int roll = rand() % 512; if(roll >= 255){ offset_y = (roll % 2) ? 1 : -1; }else{ offset_x = (roll % 2) ? 1 : -1; } /* std::cout << "[action] off_x: " << offset_x << " off_y: " << offset_y << " from roll: " << roll << std::endl; */ move(cell_y + offset_y, cell_x + offset_x); } }
void MineField::showMines() { for ( int c = 0; c < numCols; c++ ) for ( int r = 0; r < numRows; r++ ) { Mine* m = mine( r, c ); if ( !m ) continue; if ( m->isMined() && m->state() == Mine::Hidden ) m->setState( Mine::Mined ); if ( !m->isMined() && m->state() == Mine::Flagged ) m->setState( Mine::Wrong ); updateCell( r, c ); } }
void MineField::setHint( int row, int col ) { Mine *m = mine( row, col ); if ( !m ) return; int hint = getHint( row, col ); if ( !hint ) { for ( int c = col-1; c <= col+1; c++ ) for ( int r = row-1; r <= row+1; r++ ) { Mine* m = mine( r, c ); if ( m && m->state() == Mine::Hidden ) { m->activate( TRUE ); nonminecount--; setHint( r, c ); updateCell( r, c ); } } } m->setHint( hint ); updateCell( row, col ); }
void MineField::placeMines() { int mines = minecount; while ( mines ) { int col = int((double(rand()) / double(RAND_MAX)) * numCols); int row = int((double(rand()) / double(RAND_MAX)) * numRows); Mine* m = mine( row, col ); if ( m && !m->isMined() && m->state() == Mine::Hidden ) { m->setMined( TRUE ); mines--; } } }
multimap<int , vector<int> > & fp_Tree::fp_mine() { // mine each ST(i) for(int i = item_ord-1 ; i >= 0 ; --i) { if(item_count[i] < freq) continue; item_stack.push(i); output(item_count[i]); // build ST(i) and mine st_build(i); if(exist_node()) mine(); item_stack.pop(); } return result; }
void MineField::writeConfig(Config& cfg) const { cfg.setGroup("Field"); cfg.writeEntry("Level",lev); QString grid=""; if ( stat == Playing ) { for ( int x = 0; x < numCols; x++ ) for ( int y = 0; y < numRows; y++ ) { char code='A'+(x*17+y*101)%21; // Reduce the urge to cheat const Mine* m = mine( y, x ); int st = (int)m->state(); if ( m->isMined() ) st+=5; grid += code + st; } } cfg.writeEntry("Grid",grid); }
void MineField::updateMine( int row, int col ) { Mine* m = mine( row, col ); if ( !m ) return; bool wasFlagged = m->state() == Mine::Flagged; bool wasEmpty = m->state() == Mine::Empty; m->activate( flagAction == NoAction ); if ( m->state() == Mine::Exploded ) { emit gameOver( FALSE ); setState( GameOver ); return; } else if ( m->state() == Mine::Empty ) { setHint( row, col ); if ( !wasEmpty ) nonminecount--; } if ( flagAction != NoAction ) { if ( m->state() == Mine::Flagged ) { if (mineguess > 0) { --mineguess; emit mineCount( mineguess ); if ( m->isMined() ) --minecount; } else { m->setState(Mine::Hidden); } } else if ( wasFlagged ) { ++mineguess; emit mineCount( mineguess ); if ( m->isMined() ) ++minecount; } } updateCell( row, col ); if ( !minecount && !mineguess || !nonminecount ) { emit gameOver( TRUE ); setState( GameOver ); } }
void MineField::drawContents( QPainter * p, int clipx, int clipy, int clipw, int cliph ) { int c1 = clipx / cellSize; int c2 = ( clipx + clipw - 1 ) / cellSize; int r1 = clipy / cellSize; int r2 = ( clipy + cliph - 1 ) / cellSize; for ( int c = c1; c <= c2 ; c++ ) { for ( int r = r1; r <= r2 ; r++ ) { int x = c * cellSize; int y = r * cellSize; Mine *m = mine( r, c ); if ( m ) m->paint( p, colorGroup(), QRect(x, y, cellSize, cellSize ) ); } } }
void test0(void) { class myS { public: myS(int p1) : One(p1), two(p1), three(p1) {} int One; int Two(void) { return two; } int& Three(void) { return three; } private: int two, three; }; myS mine(10); auto& ref(mine.One); auto copy(mine.Two()); //auto& REF(mine.Two()); // won't compile auto& REF(mine.Three()); ref++; copy++; REF++; cout << mine.One << '\t' << mine.Two() << '\t' << mine.Three() << endl; }
void GameLogic::ProcessEvents() { fight(); move(); mine(); enemyTurn(); foreach (GameUnit *unit, gameUnits) { unit->nextFrame(); } foreach (UICooldownButton *button, cooldownButtons) { button->updateCooldownElapsedIfNeeded(); } emit GameUpdated(); }
void MineField::cellClicked( int row, int col ) { if ( state() == GameOver ) return; if ( state() == Waiting ) { Mine* m = mine( row, col ); if ( !m ) return; m->setState( Mine::Empty ); nonminecount--; placeMines(); setState( Playing ); emit gameStarted(); updateMine( row, col ); } else { // state() == Playing holdTimer->stop(); if ( ignoreClick ) ignoreClick = FALSE; else updateMine( row, col ); } }
void rusage(void) { double sys, user, idle; double per; sys = SECS(ru_stop.ru_stime) - SECS(ru_start.ru_stime); user = SECS(ru_stop.ru_utime) - SECS(ru_start.ru_utime); idle = timespent() - (sys + user); per = idle / timespent() * 100; if (!ftiming) ftiming = stderr; fprintf(ftiming, "real=%.2f sys=%.2f user=%.2f idle=%.2f stall=%.0f%% ", timespent(), sys, user, idle, per); fprintf(ftiming, "rd=%d wr=%d min=%d maj=%d ctx=%d\n", mine(ru_inblock), mine(ru_oublock), mine(ru_minflt), mine(ru_majflt), mine(ru_nvcsw) + mine(ru_nivcsw)); }
void fp_Tree::mine() { // storing original data int t = item_stack.top(); list<int> t_branch = stree.branch; list<int> t_base_count = stree.base_count; vector<int> t_count = stree.count; // mine each items in the ST(i) by recursion for(int i = t-1 ; i >= 0 ; --i) { if(stree.count[i] >= freq) { item_stack.push(i); output(stree.count[i]); st_update(i); if(exist_node()) mine(); item_stack.pop(); // restoring stree.branch = t_branch; stree.base_count = t_base_count; stree.count = t_count; } } }
int FlatShadeTexture::draw(CVIEWptr& v) { if (_ctrl) return _ctrl->draw(v); _cb->alpha = alpha(); if (!_patch) return 0; // Don't draw w/ texture maps if there are no uv coords at all. // but don't check every frame whether there are uv coords: if (_check_uv_coords_stamp != _patch->stamp()) { _has_uv_coords = _patch->cur_faces().any_satisfy(HasUVFaceFilter()); _check_uv_coords_stamp = _patch->stamp(); } // Set gl state (lighting, shade model) glPushAttrib(GL_ENABLE_BIT | GL_LIGHTING_BIT | GL_CURRENT_BIT); glEnable(GL_LIGHTING); // GL_ENABLE_BIT glShadeModel(GL_FLAT); // GL_LIGHTING_BIT GL_COL(_patch->color(), alpha()); // GL_CURRENT_BIT if (debug_uv()) { //assign some texture coords if no tex_coord_gen is assigned if (!_patch->tex_coord_gen()) { _patch->set_tex_coord_gen(new GLSphirTexCoordGen); } // decide what image file to use to show the uv-coords: str_ptr debug_uv_tex_name = Config::get_var_str("DEBUG_UV_TEX_MAP", "checkerboard.png",true); static str_ptr pre_path = Config::JOT_ROOT() + "nprdata/other_textures/"; str_ptr path = pre_path + debug_uv_tex_name; // we only try a given pathname once. but if it fails // and they reset DEBUG_UV_TEX_MAP while running the // program we can pick up the change and try again. if (path != _debug_tex_path) { _debug_tex_path = path; TEXTUREglptr tex = new TEXTUREgl(_debug_tex_path); bool do_mipmap = Config::get_var_bool("DEBUG_TEX_USE_MIPMAP",false); tex->set_mipmap(do_mipmap); _debug_uv_tex = tex; _debug_uv_in_dl = false; if (debug) { cerr << "Loading debug uv texture " << **path << " ..." << endl; } if (!_debug_uv_tex->load_texture()) { cerr << "Can't load debug uv texture: " << **_debug_tex_path << endl << "Set environment variable DEBUG_UV_TEX_MAP " << "to an image file in " << **pre_path << " and try again." << endl; _debug_uv_tex = 0; } } // Apply the texture if any faces have uv coordinates: if (_debug_uv_tex /*&& _has_uv_coords*/) //<- using auto UV _debug_uv_tex->apply_texture(); // GL_ENABLE_BIT } else { // XXX - dumb hack check_patch_texture_map(); // if (_has_uv_coords) <- using auto UV _patch->apply_texture(); // GL_ENABLE_BIT } // Set material parameters for OGL: GtexUtil::setup_material(_patch); // Try for the display list if it's valid if (!(_debug_uv == _debug_uv_in_dl && BasicTexture::draw(v))) { // Try to generate a display list int dl = _dl.get_dl(v, 1, _patch->stamp()); if (dl) { glNewList(dl, GL_COMPILE); _debug_uv_in_dl = _debug_uv; } // Set up face culling for closed surfaces if (!set_face_culling()) glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); // GL_LIGHTING_BIT FlatShadeStripCB *flat_cb = dynamic_cast<FlatShadeStripCB*>(_cb); if (flat_cb) { // send texture coordinates? if ((_debug_uv && _debug_uv_tex) || (_has_uv_coords && _patch->has_texture())) { flat_cb->enable_texcoords(); } else { flat_cb->disable_texcoords(); } } err_adv(debug && _debug_uv, " drawing uvs in flat shade"); // draw the triangle strips _patch->draw_tri_strips(_cb); // end the display list here if (_dl.dl(v)) { _dl.close_dl(v); // the display list is built; now execute it BasicTexture::draw(v); } } // restore GL state glPopAttrib(); // Have to move this outside the display list and gl push/pop attrib // or else it's all: /* FlatShadeTexture::draw - End ***NOTE*** OpenGL Error: [500] 'Invalid Enumerator' FlatShadeTexture::draw - End ***NOTE*** OpenGL Error: [500] 'Invalid Enumerator' FlatShadeTexture::draw - End ***NOTE*** OpenGL Error: [500] 'Invalid Enumerator' FlatShadeTexture::draw - End ***NOTE*** OpenGL Error: [500] 'Invalid Enumerator' FlatShadeTexture::draw - End ***NOTE*** OpenGL Error: [500] 'Invalid Enumerator' FlatShadeTexture::draw - End ***NOTE*** OpenGL Error: [500] 'Invalid Enumerator' FlatShadeTexture::draw - End ***NOTE*** OpenGL Error: [500] 'Invalid Enumerator' FlatShadeTexture::draw - End ***NOTE*** OpenGL Error: [500] 'Invalid Enumerator' */ if (_debug_uv) { // Build the edge strip at the current subdivision level Bedge_list edges = _patch->cur_edges(); edges.clear_flags(); // If secondary edges shouldn't be drawn, set their flags // so they won't be drawn: if (!BMESH::show_secondary_faces()) edges.secondary_edges().set_flags(1); // Draw uv-discontinuity boundaries as yellow lines. // Construct filter that accepts unreached uv-discontinuous // edges of this patch: UnreachedSimplexFilter unreached; UVDiscontinuousEdgeFilter uvdisc; PatchEdgeFilter mine(_patch->cur_patch()); EdgeStrip disc_edges(edges, unreached + uvdisc + mine); if (!disc_edges.empty()) { GtexUtil::draw_strip(disc_edges, 3, Color::yellow, 0.8); } } GL_VIEW::print_gl_errors("FlatShadeTexture::draw - End"); return _patch->num_faces(); }
static void makemoves(void) { int i, hitme; char ch; while (TRUE) { /* command loop */ hitme = FALSE; justin = 0; Time = 0.0; i = -1; while (TRUE) { /* get a command */ chew(); skip(1); proutn("COMMAND> "); if (scan() == IHEOL) continue; for (i=0; i < 29; i++) // Abbreviations allowed for the first 29 commands, only. if (isit(commands[i])) break; if (i < 29) break; for (; i < NUMCOMMANDS; i++) if (strcmp(commands[i], citem) == 0) break; if (i < NUMCOMMANDS #ifndef CLOAKING && i != 26 // ignore the CLOAK command #endif #ifndef CAPTURE && i != 27 // ignore the CAPTURE command #endif #ifndef SCORE && i != 28 // ignore the SCORE command #endif #ifndef DEBUG && i != 33 // ignore the DEBUG command #endif ) break; if (skill <= SFAIR) { prout("UNRECOGNIZED COMMAND. LEGAL COMMANDS ARE:"); listCommands(TRUE); } else prout("UNRECOGNIZED COMMAND."); } switch (i) { /* command switch */ case 0: // srscan srscan(1); break; case 1: // lrscan lrscan(); break; case 2: // phasers phasers(); if (ididit) { #ifdef CLOAKING if (irhere && d.date >= ALGERON && !isviolreported && iscloaked) { prout("The Romulan ship discovers you are breaking the Treaty of Algeron!"); ncviol++; isviolreported = TRUE; } #endif hitme = TRUE; } break; case 3: // photons photon(); if (ididit) { #ifdef CLOAKING if (irhere && d.date >= ALGERON && !isviolreported && iscloaked) { prout("The Romulan ship discovers you are breaking the Treaty of Algeron!"); ncviol++; isviolreported = TRUE; } #endif hitme = TRUE; } break; case 4: // move warp(1); break; case 5: // shields sheild(1); if (ididit) { attack(2); shldchg = 0; } break; case 6: // dock dock(); break; case 7: // damages dreprt(); break; case 8: // chart chart(0); break; case 9: // impulse impuls(); break; case 10: // rest waiting(); if (ididit) hitme = TRUE; break; case 11: // warp setwrp(); break; case 12: // status srscan(3); break; case 13: // sensors sensor(); break; case 14: // orbit orbit(); if (ididit) hitme = TRUE; break; case 15: // transport "beam" beam(); break; case 16: // mine mine(); if (ididit) hitme = TRUE; break; case 17: // crystals usecrystals(); break; case 18: // shuttle shuttle(); if (ididit) hitme = TRUE; break; case 19: // Planet list preport(); break; case 20: // Status information srscan(2); break; case 21: // Game Report report(0); break; case 22: // use COMPUTER! eta(); break; case 23: listCommands(TRUE); break; case 24: // Emergency exit clearscreen(); // Hide screen freeze(TRUE); // forced save exit(1); // And quick exit break; case 25: probe(); // Launch probe break; #ifdef CLOAKING case 26: cloak(); // turn on/off cloaking if (iscloaking) { attack(2); // We will be seen while we cloak iscloaking = FALSE; iscloaked = TRUE; } break; #endif #ifdef CAPTURE case 27: capture(); // Attempt to get Klingon ship to surrender if (ididit) hitme = TRUE; break; #endif #ifdef SCORE case 28: score(1); // get the score break; #endif case 29: // Abandon Ship abandn(); break; case 30: // Self Destruct dstrct(); break; case 31: // Save Game freeze(FALSE); if (skill > SGOOD) prout("WARNING--Frozen games produce no plaques!"); break; case 32: // Try a desparation measure deathray(); if (ididit) hitme = TRUE; break; #ifdef DEBUG case 33: // What do we want for debug??? debugme(); break; #endif case 34: // Call for help help(); break; case 35: alldone = 1; // quit the game #ifdef DEBUG if (idebug) score(0); #endif break; case 36: helpme(); // get help break; } for (;;) { if (alldone) break; // Game has ended #ifdef DEBUG if (idebug) prout("2500"); #endif if (Time != 0.0) { events(); if (alldone) break; // Events did us in } if (d.galaxy[quadx][quady] == 1000) { // Galaxy went Nova! atover(0); continue; } if (nenhere == 0) movetho(); if (hitme && justin==0) { attack(2); if (alldone) break; if (d.galaxy[quadx][quady] == 1000) { // went NOVA! atover(0); hitme = TRUE; continue; } } break; } if (alldone) break; } }
void visit_one(unsigned char id) { capture(id); mine(id); }
int bar(int i) { if (i % 2 == 0) even_flag = 1; printf("mine(3) = %d\n",mine(3)); return foo(i); }