//----------------------------------------------------------------------
//
  void	RN_test_basic( void ) {
    // test routine for basic random number generator
    //
    ULONG  seeds[10],  one=1ULL, z=0ULL;  
    int i,j, k=1;
    double s = 0.0;
  
    printf("\n ***** random number - basic test *****\n");
  
    // set seed 
    RN_init_problem( &one,  &k );
  
    // get the    5 seeds, then skip a few, get 5 more - directly
    for( i=0; i<5;      i++ ) { s += rang(); seeds[i] = RN_SEED; }
    for( i=5; i<123455; i++ ) { s += rang(); }
    for( i=5; i<10;     i++ ) { s += rang(); seeds[i] = RN_SEED; }
  
    // compare
    for( i=0; i<10; i++ ) {
      j = (i<5)? i+1 : i+123451;
      printf(" %6d  reference: %20llu  computed: %20llu\n",
               j, RN_CHECK[i], seeds[i] );
      if( seeds[i] != RN_CHECK[i] ) {
        printf(" ***** basic_test of RN generator failed\n");
      }
    }
  }
void ajouterUnArc (GrapheMat* graphe, NomSom somD, NomSom somA, int cout) {
  int nMax = graphe->nMax;
  int rd = rang (graphe, somD);
  int rg = rang (graphe, somA);
  graphe->element [rd*nMax+rg] = vrai;
  graphe->valeur  [rd*nMax+rg] = cout;
}
Beispiel #3
0
//ミシャグジさま
void shot_bullet_H008(int n){
    int t=shot[n].cnt;
    int k;
    if(t>=0 && t<1200 && t%90==0){
        double angle=rang(PI);
        for(int j=0;j<2;j++){//途中から2分裂する分
            for(int i=0;i<60;i++){//一度に60個
                if(shot[n].flag!=2 && (k=shot_search(n))!=-1){
                    shot[n].bullet[k].knd    =8;//8番の弾
                    shot[n].bullet[k].angle  =angle+PI2/60*i;//円形60個
                    shot[n].bullet[k].flag   =1;
                    shot[n].bullet[k].x      =enemy[shot[n].num].x;
                    shot[n].bullet[k].y      =enemy[shot[n].num].y;
                    shot[n].bullet[k].col    =enemy[shot[n].num].col;
                    shot[n].bullet[k].cnt    =0;
                    shot[n].bullet[k].state  =j;//ステータス。0か1かで回転がかわる
                    shot[n].bullet[k].spd    =2;
                    se_flag[0]=1;//発射音鳴らす
                }
            }
        }
    }
    for(int i=0;i<SHOT_BULLET_MAX;i++){//全弾分
        if(shot[n].bullet[i].flag>0){//登録されている弾があれば
            int state=shot[n].bullet[i].state;
            int cnt=shot[n].bullet[i].cnt;
            if(30<cnt && cnt<120){//30〜120カウントなら
                shot[n].bullet[i].spd-=1.2/90.0;//90カウントかけて1.2減らす
                shot[n].bullet[i].angle+=(PI/2)/90.0*(state?-1:1);//90カウントかけて90°傾ける
            }
        }
    }
}
Beispiel #4
0
//ばらまきショット
void shot_bullet_H005(int n){
	int t=shot[n].cnt;
	int k;
	if(t>=0 && t<120 && t%2==0){
		if(shot[n].flag!=2 && (k=shot_search(n))!=-1){
			shot[n].bullet[k].knd	=enemy[shot[n].num].blknd2;
			shot[n].bullet[k].angle	=shotatan2(n)+rang(PI/4);
			shot[n].bullet[k].flag	=1;
			shot[n].bullet[k].x		=enemy[shot[n].num].x;
			shot[n].bullet[k].y		=enemy[shot[n].num].y;
			shot[n].bullet[k].col	=enemy[shot[n].num].col;
			shot[n].bullet[k].cnt	=0;
			shot[n].bullet[k].spd	=3+rang(1.5);
			se_flag[0]=1;
		}
	}
}
Beispiel #5
0
//停滞ばらまき弾
void E5_1(){
	int k;

	if((k=shot_search())!=-1){//弾が登録可能なら
		bullet[k].knd	=11;
		bullet[k].angle	=rang(PI2);//角度
		bullet[k].spd	=0.6+rang(0.2);//スピード
		bullet[k].vx	=0;
		bullet[k].vy	=0;
		bullet[k].flag	=1;//フラグ
		bullet[k].x		=enemy.x;//座標
		bullet[k].y		=enemy.y;
		bullet[k].col	=GetRand(5);//色
		bullet[k].cnt	=0;//カウンタ
		bullet[k].gflag	=0;
		bullet[k].state	=0;
	}
}
Beispiel #6
0
//ランダム落下
void E7_1(){
	int k;

	if((k=shot_search())!=-1){//弾が登録可能なら
		bullet[k].knd	=1;
		bullet[k].angle	=0;//角度
		bullet[k].spd	=0;//スピード
		bullet[k].vx	=rang(0.1);
		bullet[k].vy	=1.5+rang(0.5);
		bullet[k].flag	=1;//フラグ
		bullet[k].x		=FX+(FMX/2)+rang(130);//座標
		bullet[k].y		=FY+10;
		bullet[k].col	=5;//色
		bullet[k].cnt	=0;//カウンタ
		bullet[k].gflag	=0;
		bullet[k].state	=0;
	}
}
Beispiel #7
0
//高速ばらまき弾
void E3(){
	int t=spcount;
	int k;

	if((k=shot_search())!=-1){//弾が登録可能なら
		bullet[k].knd	=7;
		bullet[k].angle	=PI2/10*t+rang(PI2/20);//角度
		bullet[k].spd	=2+rang(0.3);//スピード
		bullet[k].vx	=0;
		bullet[k].vy	=0;
		bullet[k].flag	=1;//フラグ
		bullet[k].x		=enemy.x;//座標
		bullet[k].y		=enemy.y;
		bullet[k].col	=GetRand(4);//色
		bullet[k].cnt	=0;//カウンタ
		bullet[k].gflag	=0;
		bullet[k].state	=0;
	}
}
Beispiel #8
0
//サイレントセレナ
void boss_shot_bulletH001(){
#define TM001 60
    int i,k,t=boss_shot.cnt%TM001,t2=boss_shot.cnt;
    static int cnum;
    double angle;
    if(t2==0)//最初なら
        cnum=0;
    if(t==0){//1周期の最初なら
        boss_shot.base_angle[0]=bossatan2();//基準と成る角度をセット
        if(cnum%4==3){//4回中4回目なら
			//40<x<FMX-40、30<y<120の範囲を60の距離、60カウントで移動
            move_boss_pos(40,30,FMX-40,120,60, 60);
        }
    }
    if(t==TM001/2-1)//周期の半分で角度を変える
        boss_shot.base_angle[0]+=PI2/20/2;
	//円形
	if(t%(TM001/10)==0){//10カウントに1回ずつ
        angle=bossatan2();//ボスと自機との成す角
        for(i=0;i<20;i++){//PI2/20度ずつ1周
            if((k=search_boss_shot())!=-1){
                boss_shot.bullet[k].col   = 4;
                boss_shot.bullet[k].x     = boss.x;
                boss_shot.bullet[k].y     = boss.y;
                boss_shot.bullet[k].knd   = 8;
                boss_shot.bullet[k].angle = boss_shot.base_angle[0]+PI2/20*i;
                boss_shot.bullet[k].flag  = 1;
                boss_shot.bullet[k].cnt   = 0;
                boss_shot.bullet[k].spd   = 2.7;
                se_flag[0]=1;
            }
        }
    }
	//ランダム直下落下
    if(t%4==0){
        if((k=search_boss_shot())!=-1){
            boss_shot.bullet[k].col   = 0;
            boss_shot.bullet[k].x     = GetRand(FMX);
            boss_shot.bullet[k].y     = GetRand(200);
            boss_shot.bullet[k].knd   = 8;
            boss_shot.bullet[k].angle = PI/2;
            boss_shot.bullet[k].flag  = 1;
            boss_shot.bullet[k].cnt   = 0;
            boss_shot.bullet[k].spd   = 1+rang(0.5);
            se_flag[0]=1;
        }
    }
//    for(i=0;i<BOSS_BULLET_MAX;i++){
//        if(boss_shot.bullet[i].flag>0){
//
//        }
//    }
    if(t==TM001-1)
        cnum++;
}
Beispiel #9
0
//高速落下弾
void E1_1(){
	int k;

	for(double i = FX;i<FX+FMX;i+=(60+rang(10))){
		if((k=shot_search())!=-1){//弾が登録可能なら
			bullet[k].knd	=7;
			bullet[k].state =1;
			bullet[k].angle	=0;//角度
			bullet[k].spd	=0;//スピード
			bullet[k].vx	=0;
			bullet[k].vy	=-2;//落下速度
			bullet[k].flag	=1;//フラグ
			bullet[k].x		=i;//座標
			bullet[k].y		=40+rang(30);
			bullet[k].col	=1;//色
			bullet[k].cnt	=0;//カウンタ
			bullet[k].gflag	=0;
		}
	}
}
void ajouterUnSommet (GrapheMat* graphe, NomSom nom) {
  if (rang (graphe, nom) == -1) {
    if (graphe->n < graphe->nMax) {
     strcpy (graphe->nomS [graphe->n++], nom);
    } else {
      printf ("\nNombre de sommets > %d\n", graphe->nMax);
    }
  } else {
    printf ("\n%s déjà défini\n", nom);
  }
}
Beispiel #11
0
//ばらまきショット(減速)
void shot_bullet_H006(int n){
	int t=shot[n].cnt;
	int k;
	if(t>=0 && t<120 && t%2==0){
		if(shot[n].flag!=2 && (k=shot_search(n))!=-1){
			shot[n].bullet[k].knd	=enemy[shot[n].num].blknd2;
			shot[n].bullet[k].angle	=shotatan2(n)+rang(PI/4);
			shot[n].bullet[k].flag	=1;
			shot[n].bullet[k].x		=enemy[shot[n].num].x;
			shot[n].bullet[k].y		=enemy[shot[n].num].y;
			shot[n].bullet[k].col	=enemy[shot[n].num].col;
			shot[n].bullet[k].cnt	=0;
			shot[n].bullet[k].spd	=4+rang(2);
			se_flag[0]=1;
		}
	}
	for(int i=0;i<SHOT_BULLET_MAX;i++){
		if(shot[n].bullet[i].spd>1.5)
			shot[n].bullet[i].spd-=0.04;
	}
}
Beispiel #12
0
void boss_shot_bulletH001(){
#define TM001 60
	int i,k,t=boss_shot.cnt%TM001,t2=boss_shot.cnt;
	static int cnum;
	double angle;
	if(t2==0)
		cnum=0;
	if(t==0){
		boss_shot.base_angle[0]=bossatan2();
		if(cnum%4==3){
			move_boss_pos(40,30,FMX-40,120,60, 60);
		}
	}
	if(t==TM001/2-1)
		boss_shot.base_angle[0]+=PI2/20/2;
	if(t%(TM001/10)==0){
		angle=bossatan2();
		for(i=0;i<20;i++){
			if((k=search_boss_shot())!=-1){
				boss_shot.bullet[k].col	  = 4;
				boss_shot.bullet[k].x     = boss.x;
				boss_shot.bullet[k].y     = boss.y;
				boss_shot.bullet[k].knd   = 8;
				boss_shot.bullet[k].angle = boss_shot.base_angle[0]+PI2/20*i;
				boss_shot.bullet[k].flag  = 1;
				boss_shot.bullet[k].cnt	  = 0;
				boss_shot.bullet[k].spd	  = 2.7;
				se_flag[0]=1;
			}
		}
	}
	if(t%4==0){
		if((k=search_boss_shot())!=-1){
			boss_shot.bullet[k].col	  = 0;
			boss_shot.bullet[k].x     = GetRand(FMX);
			boss_shot.bullet[k].y     = GetRand(200);
			boss_shot.bullet[k].knd   = 8;
			boss_shot.bullet[k].angle = PI/2;
			boss_shot.bullet[k].flag  = 1;
			boss_shot.bullet[k].cnt	  = 0;
			boss_shot.bullet[k].spd	  = 1+rang(0.5);
			se_flag[0]=1;
		}
	}
//	for(i=0;i<BOSS_BULLET_MAX;i++){
//		if(boss_shot.bullet[i].flag>0){
//
//		}
//	}
	if(t==TM001-1)
		cnum++;
}
Beispiel #13
0
/**
 * Barycenter function for node v from connected nodes in current rank
 * All nodes are equal. Some esthetic mass equivalent can be added later.
 * We use here node x coordinate as barycenter value, but in this method
 * it is just a comparative value, not drawable.
 */
int AdjRank::baryValue( NodeAux* v)
{
	int bary = 0;
	int i = 0;
	for ( EdgeAux* iter = v->firstSucc(); iter != NULL; iter = iter->nextSucc())
	{
		if( iter->succ()->rang() == rang()) 
		{
			bary += iter->succ()->x();
			i++;
		}
	}
	for ( EdgeAux* iter = v->firstPred(); iter != NULL; iter = iter->nextPred())
	{
		if( iter->pred()->rang() == rang())
		{
			bary += iter->pred()->x();
			i++;
		}
	}
	if (i == 0) return v->x();
	return bary / i;
}
Beispiel #14
0
//今いる位置からdist離れた位置にtカウントで移動する
int move_boss_pos(double x1,double y1,double x2,double y2,double dist, int t){
	int i=0;
	double x,y,angle;
	for(i=0;i<1000;i++){
		x=boss.x,y=boss.y;//今のボスの位置をセット
		angle=rang(PI);//適当に向かう方向を決める
		x+=cos(angle)*dist;//そちらに移動させる
		y+=sin(angle)*dist;
		if(x1<=x&&x<=x2 && y1<=y&&y<=y2){//その点が移動可能範囲なら
			input_phy_pos(x,y,t);
			return 0;
		}
	}
	return -1;//1000回試してダメならエラー
}
Beispiel #15
0
//停滞ばらまき弾
void E4_1(){
	int k;

	if((k=shot_search())!=-1){//弾が登録可能なら
		bullet[k].knd	=10;
		bullet[k].angle	=rang(PI2);//角度
		bullet[k].spd	=0.5;//スピード
		bullet[k].vx	=0;
		bullet[k].vy	=0;
		bullet[k].flag	=1;//フラグ
		bullet[k].x		=enemy.x;//座標
		bullet[k].y		=enemy.y;
		bullet[k].col	=0;//色
		bullet[k].cnt	=0;//カウンタ
		bullet[k].gflag	=0;
		bullet[k].state	=3;//ダメージ減衰補正
	}
}
Beispiel #16
0
//発射位置設定を含めた波紋の全方位弾
void E9_1(){
	switch(E9_state){
	case 0:
		E9(enemy.x-(FMX/4)+rang(20),enemy.y-50+(rang(25)));
		E9_state=1;
		break;
	case 1:
		E9(enemy.x+(FMX/4)+rang(20),enemy.y+50+(rang(25)));
		E9_state=2;
		break;
	case 2:
		E9(enemy.x-(FMX/4)+rang(20),enemy.y+50+(rang(25)));
		E9_state=3;
		break;
	case 3:
		E9(enemy.x+(FMX/4)+rang(20),enemy.y-50+(rang(25)));
		E9_state=0;
		break;
	}
}
Beispiel #17
0
//縦方向の固定弾
void E8_1(double length,double speed,int sayu){
	int k;

	for(double i = FY+rang(20);i<=FY+FMY+10;i+=length){
		if((k=shot_search())!=-1){//弾が登録可能なら
			bullet[k].knd	=7;
			bullet[k].state =0;
			bullet[k].angle	=0;//角度
			bullet[k].spd	=0;//スピード
			bullet[k].vx	=(sayu)? speed:-speed;
			bullet[k].vy	=0;//落下速度
			bullet[k].flag	=1;//フラグ
			bullet[k].x		=(sayu)? 0:FX+FMX+10;//座標
			bullet[k].y		=i;
			bullet[k].col	=1;//色
			bullet[k].cnt	=0;//カウンタ
			bullet[k].gflag	=0;
		}
	}
}
Beispiel #18
0
//横方向の固定弾
void E8_0(int length,double speed,int joge){
	int k;

	for(double i = FX+rang(17.5);i<=FX+FMX+10;i+=length){
		if((k=shot_search())!=-1){//弾が登録可能なら
			bullet[k].knd	=7;
			bullet[k].state =0;
			bullet[k].angle	=0;//角度
			bullet[k].spd	=0;//スピード
			bullet[k].vx	=0;
			bullet[k].vy	=(joge)? speed:-speed;//落下速度
			bullet[k].flag	=1;//フラグ
			bullet[k].x		=i;//座標
			bullet[k].y		=(joge)? 0:480;
			bullet[k].col	=1;//色
			bullet[k].cnt	=0;//カウンタ
			bullet[k].gflag	=0;
		}
	}
}
Beispiel #19
0
//波紋の全方位弾
void E9(double x,double y){
	int k;
	double angle=rang(PI);

	for(int i=0;i<14;i++){
		if((k=shot_search())!=-1){//弾が登録可能なら
			bullet[k].knd	=8;
			bullet[k].angle	=angle+PI2/14*i;//角度
			bullet[k].spd	=2;//スピード
			bullet[k].vx	=0;
			bullet[k].vy	=0;
			bullet[k].flag	=1;//フラグ
			bullet[k].x		=x+15*cos(bullet[k].angle);//座標
			bullet[k].y		=y+15*sin(bullet[k].angle);
			bullet[k].col	=0;//色
			bullet[k].cnt	=0;//カウンタ
			bullet[k].gflag	=0;
			bullet[k].state	=1;
		}
	}
}
Beispiel #20
0
//大弾全方位弾
void E6(){
	int k;
	double angle=rang(PI);

	for(int i=0;i<8;i++){
		if((k=shot_search())!=-1){//弾が登録可能なら
			bullet[k].knd	=0;
			bullet[k].angle	=angle+PI2/8*i;//角度
			bullet[k].spd	=5;//スピード
			bullet[k].vx	=0;
			bullet[k].vy	=0;
			bullet[k].flag	=1;//フラグ
			bullet[k].x		=enemy.x;//座標
			bullet[k].y		=enemy.y;
			bullet[k].col	=1;//色
			bullet[k].cnt	=0;//カウンタ
			bullet[k].gflag	=0;
			bullet[k].state	=4;//ダメージ増加補正
		}
	}
}
Beispiel #21
0
//交差前の全方位弾
void E2(){
	int k;
	double angle=rang(PI);

	for(int j=0;j<2;j++){//途中から2分裂する分
		for(int i=0;i<30;i++){
			if((k=shot_search())!=-1){
				bullet[k].knd    =8;//8番の弾
				bullet[k].angle  =angle+PI2/30*i;
				bullet[k].spd    =2.5;
				bullet[k].vx	=0;
				bullet[k].vy	=0;
				bullet[k].flag   =1;
				bullet[k].x      =enemy.x;
				bullet[k].y      =enemy.y;
				bullet[k].col    =1;
				bullet[k].cnt    =0;
				bullet[k].state  =j;//ステータス。0か1かで回転がかわる
				se_flag[0]=1;//発射音鳴らす
			}
		}
	}
}
Beispiel #22
0
//パーフェクトフリーズ
void boss_shot_bulletH002(){
#define TM002 650
    int i,k,t=boss_shot.cnt%TM002;
    double angle;
    if(t==0 || t==210){
        //40<x<FMX-40  50<y<150 の範囲で100離れた位置に80カウントで移動する
        move_boss_pos(40,50,FMX-40,150,100, 80);
    }
	//最初のランダム発射
    if(t<180){
        for(i=0;i<2;i++){
            if((k=search_boss_shot())!=-1){
                boss_shot.bullet[k].col   = GetRand(6);
                boss_shot.bullet[k].x     = boss.x;
                boss_shot.bullet[k].y     = boss.y;
                boss_shot.bullet[k].knd   = 7;//弾の種類
                boss_shot.bullet[k].angle = rang(PI2/20)+PI2/10*t;
                boss_shot.bullet[k].flag  = 1;
                boss_shot.bullet[k].cnt   = 0;
                boss_shot.bullet[k].spd   = 3.2+rang(2.1);
                boss_shot.bullet[k].state = 0;//弾のステータス
                boss_shot.bullet[k].kaiten= 1;//弾を回転するかどうかのフラグ
            }
        }
        if(t%10==0)
            se_flag[0]=1;
    }
    if(210<t && t<270 && t%3==0){
        angle=bossatan2();
        for(i=0;i<8;i++){
            if((k=search_boss_shot())!=-1){
                boss_shot.bullet[k].col   = 0;
                boss_shot.bullet[k].x     = boss.x;
                boss_shot.bullet[k].y     = boss.y;
                boss_shot.bullet[k].knd   = 7;
				//自機とボスとの成す角を基準に8方向に発射する
                boss_shot.bullet[k].angle = angle-PI/2*0.8+PI*0.8/7*i+rang(PI/180);
                boss_shot.bullet[k].flag  = 1;
                boss_shot.bullet[k].cnt   = 0;
                boss_shot.bullet[k].spd   = 3.0+rang(0.3);
                boss_shot.bullet[k].state = 2;
                boss_shot.bullet[k].kaiten= 1;
            }
        }
        if(t%10==0)
            se_flag[0]=1;
    }
    for(i=0;i<BOSS_BULLET_MAX;i++){
        if(boss_shot.bullet[i].flag>0){
            //tが190の時に全てストップさせ、白くし、カウントリセット
            if(boss_shot.bullet[i].state==0){
                if(t==190){
                    boss_shot.bullet[i].kaiten=0;//弾の回転を止める
                    boss_shot.bullet[i].spd   =0;
                    boss_shot.bullet[i].col   =9;
                    boss_shot.bullet[i].cnt   =0;
                    boss_shot.bullet[i].state =1;
                }
            }
            //ランダムな方向に移動し始める
            if(boss_shot.bullet[i].state==1){
                if(boss_shot.bullet[i].cnt==200){
                    boss_shot.bullet[i].angle=rang(PI);
                    boss_shot.bullet[i].kaiten=1;
                }
                if(boss_shot.bullet[i].cnt>200)
                    boss_shot.bullet[i].spd+=0.01;
            }
        }
    }
}
int main(void)
{
    ULONG dice1;
    ULONG dice2;
    ULONG R1;
    ULONG R2;

    int Nbin=6;
    int array_sz=13; 

    int counter=1;
    int break_flag=0;

    float Ntry=100000000;
    float N=100000;
    int total=0;

    double tally[array_sz];
    double freq_array[array_sz];
    double theory[array_sz];

    //theoretical probabilities//
    // 			{2,12} P= 1/16
    // 			{3,11} = 1/18
    // P(x)for	{4,10} = 1/12
    // 			{5,9} = 1/9
    // 			{6,8} = 5/36
    // 			{7}   = 1/6
    //			otherwise = 0
    float p_2_12 =0.027777;
    float p_3_11 =0.055555; 
    float p_4_10 =0.083333;
    float p_5_9 =0.111111;
    float p_6_8 =0.138888;
    float p_7 = 0.166666;

    //allocate the theoretical prob arrays//
    theory[2]=theory[12]=p_2_12;
    theory[3]=theory[11]=p_3_11;
    theory[4]=theory[10]=p_4_10;
    theory[5]=theory[9]=p_5_9;
    theory[6]=theory[8]=p_6_8;
    theory[7]=p_7;

    int finished_array[11];

     //initialize tally, frequency arrays//
    for( int q=0; q<array_sz; q++)
    {
      tally[q]=0;
      freq_array[q]=0;
     finished_array[q]=0;
    }

    //calculate the probabilities//
    for(int i=0; i<Ntry; i++)
    {	
    	if(break_flag==0)
    	{
	     R1=rang();
	     R2=rang();

	     dice1 =  floor(Nbin * R1);
	     dice2 =  floor(Nbin * R2);

	     total=dice1 + dice2;

	     tally[total]=tally[total]+1;

	     if(i > N * counter)
	     {
	     	counter=counter+1;
	     	 //print the tally//
		 	for(int j=2; j<array_sz; j++)
		 	{
		 		printf("The number of %d are %f \n",j,tally[j]);
		 	}
	     }
		     //compare theory and calculated probablities//
		    for(int k=2; k<array_sz; k++)
		    {
		      freq_array[k]=tally[k]/Ntry;
		      if(theory[k]-freq_array[k] < 0.0001/100)
		      {
			finished_array[k]=1;
			if(finished_array[k]!=finished_array[0])
			{
			       break_flag=1;
			}
		      	printf("It took %d tries to get 3 decimal point agreement \n",i);
		      }

		    } 
    	}
 	}	

 	//print out the probablity//
    for(int k=2; k<array_sz; k++)
    {
      freq_array[k]=tally[k]/Ntry;
      printf("Calculated probability for %d is %f %%\n",k,freq_array[k]*100);
      printf("Theoretical probability for %d is %f %%\n ",k,theory[k]*100);
    }  

}
Beispiel #24
0
//ケロちゃん風雨にも負けず
void boss_shot_bulletH004(){
#define TM004 200
    int i,j,k,n,t=boss_shot.cnt%TM004,t2=boss_shot.cnt;
    static int tm;
    double angle;
    if(t==0)
        tm=190+rang(30);
	//上からふらす弾を発射する基準の角度をセット
    angle=PI*1.5+PI/6*sin(PI2/tm*t2);
	//ギラギラ光る弾
    if(t2%4==0){
        for(n=0;n<8;n++){//8方向にふる
            if((k=search_boss_shot())!=-1){
                boss_shot.bullet[k].flag=1;
                boss_shot.bullet[k].state=0;
                boss_shot.bullet[k].cnt=0;
                boss_shot.bullet[k].knd=4;
                boss_shot.bullet[k].col=0;
                boss_shot.bullet[k].angle=0;
                boss_shot.bullet[k].eff_detail=1;//ピカピカ光らせる
                boss_shot.bullet[k].x=boss.x;
                boss_shot.bullet[k].y=boss.y;
                boss_shot.bullet[k].vx = cos(angle-PI/8*4+PI/8*n+PI/16)*3;
                boss_shot.bullet[k].vy = sin(angle-PI/8*4+PI/8*n+PI/16)*3;
            }
        }
        se_flag[0]=1;
    }
	//小さい玉
    if(t%1==0 && t2>80){
        int num=1;
        if(t%2)
            num=2;
        for(n=0;n<num;n++){
            if((k=search_boss_shot())!=-1){
                angle=PI*1.5-PI/2+PI/12*(t2%13)+rang(PI/15);
                boss_shot.bullet[k].flag=1;
                boss_shot.bullet[k].state=1;
                boss_shot.bullet[k].cnt=0;
                boss_shot.bullet[k].knd=8;
                boss_shot.bullet[k].eff_detail=0;//ピカピカは光らない
                boss_shot.bullet[k].col=4;
                boss_shot.bullet[k].angle=0;
                boss_shot.bullet[k].x=boss.x;
                boss_shot.bullet[k].y=boss.y;
                boss_shot.bullet[k].vx = cos(angle)*1.4*1.2;
                boss_shot.bullet[k].vy = sin(angle)*1.4;
            }
        }
        se_flag[7]=1;
    }
    for(i=0;i<BOSS_BULLET_MAX;i++){
        if(boss_shot.bullet[i].flag>0){
            if(boss_shot.bullet[i].state==0){//ステータスが0なら
                if(boss_shot.bullet[i].cnt<150)
                    boss_shot.bullet[i].vy+=0.03;//鉛直方向の下向きに加速する
                boss_shot.bullet[i].x+=boss_shot.bullet[i].vx;
                boss_shot.bullet[i].y+=boss_shot.bullet[i].vy;
            }
            if(boss_shot.bullet[i].state==1){//ステータスが1なら
                if(boss_shot.bullet[i].cnt<160)
                    boss_shot.bullet[i].vy+=0.03;//鉛直方向の下向きに加速する
                boss_shot.bullet[i].x+=boss_shot.bullet[i].vx;
                boss_shot.bullet[i].y+=boss_shot.bullet[i].vy;
                boss_shot.bullet[i].angle=atan2(boss_shot.bullet[i].vy,boss_shot.bullet[i].vx);
            }
        }
    }
}