Example #1
0
void Stage3_03Layer::initPlanets()
{
	m_pCat1 = makePlanet(kForceSideCat, ccp(593, 56), 8, 0);

	m_pDog1 = makePlanet(kForceSideDog, ccp(403,56), 16, 1);
	m_pDog2 = makePlanet(kForceSideDog, ccp(593,229), 16, 1);

	makePlanet(kForceSideMiddle, ccp(192,377), 2, 2)->stopIncrease();
	makePlanet(kForceSideMiddle, ccp(94,221), 2, 2)->stopIncrease();
	makePlanet(kForceSideMiddle, ccp(384,377), 2, 2)->stopIncrease();

	makeStar(ccp(334, 244));
	makeStar(ccp(153, 93));
	makeStar(ccp(570, 412));

	// 这一关里一开始将AI停掉,过一段时间手动发起进攻
	m_bIsAIStopped = true;	
}
Example #2
0
void generate_init_values(int number_of_stars, struct star* star_array)
{
  time_t t;
  srand((unsigned) time(&t));
  for(int i = 0; i < number_of_stars; ++i){
    star_array[i] = makeStar();
    prec angle = 360 * newRand();
    prec radius = 100 * newRand();
    newPos(&star_array[i],  radius * cos(angle) + 350, 0.5 * radius * sin(angle) + 350);
    newSpeed(&star_array[i], 0.4*(star_array[i].ypos - 350), (-0.4)*(star_array[i].xpos - 350));
    newMass(&star_array[i], 2*newRand() + 2);
  }

}
Example #3
0
void makeWheel(int n, edgefn ef)
{
    int i;

    if (n < 4) {
	fprintf(stderr, "Warning: degenerate wheel of %d vertices\n", n);
	makeComplete(n, ef);
	return;
    }

    makeStar(n, ef);

    for (i = 2; i < n; i++)
	ef( i, i + 1);
    ef (2, n);
}
Example #4
0
YY_ACTION(void) yy_2_suffix(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_2_suffix\n"));
   push(makeStar (pop())); ;
}
Example #5
0
YY_ACTION(void) yy_2_suffix(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_2_suffix\n"));
   push(makeStar (pop())); ;
}
Example #6
0
int main(int argc, char *argv[])
{
    GraphType graphType;
    edgefn ef;

    opts.pfx = "";
    opts.name = "";
    opts.cnt = 1;
    graphType = init(argc, argv, &opts);
    if (opts.directed) {
	fprintf(opts.outfile, "digraph %s{\n", opts.name);
	ef = dirfn;
    }
    else {
	fprintf(opts.outfile, "graph %s{\n", opts.name);
	ef = undirfn;
    }

    switch (graphType) {
    case grid:
	makeSquareGrid(opts.graphSize1, opts.graphSize2,
		       opts.foldVal, opts.isPartial, ef);
	break;
    case circle:
	makeCircle(opts.graphSize1, ef);
	break;
    case path:
	makePath(opts.graphSize1, ef);
	break;
    case tree:
	if (opts.graphSize2 == 2)
	    makeBinaryTree(opts.graphSize1, ef);
	else
	    makeTree(opts.graphSize1, opts.graphSize2, ef);
	break;
    case trimesh:
	makeTriMesh(opts.graphSize1, ef);
	break;
    case ball:
	makeBall(opts.graphSize1, opts.graphSize2, ef);
	break;
    case torus:
	if ((opts.parm1 == 0) && (opts.parm2 == 0))
	    makeTorus(opts.graphSize1, opts.graphSize2, ef);
	else
	    makeTwistedTorus(opts.graphSize1, opts.graphSize2, opts.parm1, opts.parm2, ef);
	break;
    case cylinder:
	makeCylinder(opts.graphSize1, opts.graphSize2, ef);
	break;
    case mobius:
	makeMobius(opts.graphSize1, opts.graphSize2, ef);
	break;
    case sierpinski:
	makeSierpinski(opts.graphSize1, ef);
	break;
    case complete:
	makeComplete(opts.graphSize1, ef);
	break;
    case randomg:
	makeRandom (opts.graphSize1, opts.graphSize2, ef);
	break;
    case randomt:
	{
	    int i;
	    treegen_t* tg = makeTreeGen (opts.graphSize1);
	    for (i = 1; i <= opts.cnt; i++) {
		makeRandomTree (tg, ef);
		if (i != opts.cnt) closeOpen ();
	    }
	    freeTreeGen (tg);
	}
	makeRandom (opts.graphSize1, opts.graphSize2, ef);
	break;
    case completeb:
	makeCompleteB(opts.graphSize1, opts.graphSize2, ef);
	break;
    case hypercube:
	makeHypercube(opts.graphSize1, ef);
	break;
    case star:
	makeStar(opts.graphSize1, ef);
	break;
    case wheel:
	makeWheel(opts.graphSize1, ef);
	break;
    default:
	/* can't happen */
	break;
    }
    fprintf(opts.outfile, "}\n");

    exit(0);
}