亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? demo12_7.cpp

?? 游戲的聲音圖像演示程序
?? CPP
?? 第 1 頁 / 共 5 頁
字號(hào):
               // 16 memory cells from the matrix of 16x16 and then averages
               // the info, that is, they exchange information
               // this takes 1 unit of energy

               // time to exchange memory?
               if (++ants[index].counter_2 >= 3)
                  {
                  // reset counter
                  ants[index].counter_2 = 0;
                  
                  // select cell to exchange and exchange memory imprints
                  int memx = rand()%16;
                  int memy = rand()%16;

                  // sum with partners experience
                  ants_mem[index].cell[memx][memy] += 
                    0.5*ants_mem[ants[index].varsI[ANT_INDEX_LAST_TALKED_WITH]].cell[memx][memy];
     
                  // illuminate green to show communication
                  ants_mem[index].ilayer[memx][memy] = 250;
             
                  } // end if

               // test if we are done with this state and need a new one?
               if (--ants[index].counter_1 < 0 || 
                ants[ants[index].varsI[ANT_INDEX_LAST_TALKED_WITH]].varsI[ANT_INDEX_AI_STATE]!=ANT_COMMUNICATING)                                        
                  {
                  // select either rest or wander, search will pre-empt with logic following
                  // if hungry, state, probability of state, must sum to 100
                  select_new_state = Select_State_Rand(ANT_WANDERING,     90,            
                                                       ANT_EATING,        0,                
                                                       ANT_RESTING,       10,              
                                                       ANT_SEARCH_FOOD,   0,           
                                                       ANT_COMMUNICATING, 0,         
                                                       ANT_DEAD,          0);                    
                   } // end if


               // burn food
               ants[index].varsI[ANT_INDEX_HUNGER_LEVEL]++;

               // test for pre-empt into search mode if hunger is 50% tolerance
               if (ants[index].varsI[ANT_INDEX_HUNGER_LEVEL] > (ants[index].varsI[ANT_INDEX_HUNGER_TOLERANCE] >> 1) )
                  {
                  select_new_state = ANT_SEARCH_FOOD;
                  } // end if    

               } break;

          case ANT_DEAD:           // this guy is dead, got too hungry
               {
               // the any just sits there and is worm food, no enery expended          

 
               } break;

          default: break;

          } // end switch

    // was there a forced state transition?
if (ants[index].varsI[ANT_INDEX_AI_STATE]!=ANT_DEAD && 
   (ants[index].varsI[ANT_INDEX_HUNGER_LEVEL] >= ants[index].varsI[ANT_INDEX_HUNGER_TOLERANCE]))
   {
   // dead ant
   select_new_state = ANT_DEAD;

   } // end if

///////////////////////////////////////////////////////////////////////////

        // add a little forgetfulness, select a memory at random and weaken it
        int memx = rand()%16;
        int memy = rand()%16;

       ants_mem[index].ilayer[memx][memy] = 249; // illuminate red to show degradation

        if (ants_mem[index].cell[memx][memy] > 5)
           {
           ants_mem[index].cell[memx][memy]-=rand()%5;
           } // end if

//////////////////////////////////////////////////////////////////////////

// set new state if needed 
    if (select_new_state >= 0)
       {
       // set the state
       Set_New_State(select_new_state, index);
     
       } // end if
////////////////////////////////////////////////////

   // clear the memory matrix
   if (clear_ilayer >= 5)
      memset(ants_mem[index].ilayer,0, 1024);


   // this point is where the "physics" system need to operate
   // have any of the state changes or motions caused a physical problem
   // in the universe, we could do it in each state, but this is simpler

   // test for out of bounds
   if (ants[index].x > 472)
       {
       // bounce back a bit
       ants[index].x-=4;

       // turn to new heading
       switch(rand()%3)
             {
             case 0: ants[index].varsI[ANT_INDEX_DIRECTION] = ANT_ANIM_LEFT; break;
             case 1: ants[index].varsI[ANT_INDEX_DIRECTION] = ANT_ANIM_UP; break;
             case 2: ants[index].varsI[ANT_INDEX_DIRECTION] = ANT_ANIM_DOWN; break;
             default: break;
             } // end switch
     
       // add a little time to counters     
       ants[index].counter_2 += RAND_RANGE(30, 60);
       ants[index].counter_1 += RAND_RANGE(15, 30);

       // start animation
       Set_Animation_BOB(&ants[index], ants[index].varsI[ANT_INDEX_DIRECTION]);

       } // end if
else
if (ants[index].x <= 16)
    {
    // bounce back a bit
    ants[index].x+=4;

    // turn to new heading
    switch(rand()%3)
          {
          case 0: ants[index].varsI[ANT_INDEX_DIRECTION] = ANT_ANIM_RIGHT; break;
          case 1: ants[index].varsI[ANT_INDEX_DIRECTION] = ANT_ANIM_UP; break;
          case 2: ants[index].varsI[ANT_INDEX_DIRECTION] = ANT_ANIM_DOWN; break;
          default: break;
          } // end switch
     
    // add a little time to counter     
    ants[index].counter_2 += RAND_RANGE(30, 60);
    ants[index].counter_1 += RAND_RANGE(15, 30);

    // start animation
    Set_Animation_BOB(&ants[index], ants[index].varsI[ANT_INDEX_DIRECTION]);

    } // end if

if (ants[index].y < 0)
    ants[index].y = screen_height;
else
if (ants[index].y > screen_height)
    ants[index].y = 0;

///////////////////////////////////////////////////////////////////////////////////

    } // end for index

// update global memory clear counter
if (++clear_ilayer > 5)
    clear_ilayer= 0;



} // end Move_Ants

///////////////////////////////////////////////////////////////////

void Draw_Food(void)
{
// draw the food

int index;

for (index=0; index<NUM_MNMS; index++)
    {
    if (food[index].energy > 0)
       {
       // set position of mnm
       Set_Pos_BOB(&mnm, food[index].x-4, food[index].y-4);
       Draw_BOB(&mnm, lpddsback);
       } // end if

    } // end for index

} // end Draw_Food

///////////////////////////////////////////////////////////////////

void Draw_Info(void)
{
// this function draws the state information for 8 ants

static char *state_to_text[6] = {"Wander", "Eating", "Resting", "Srchfood", "Talking", "Dead"};         

static int intensity_to_index[16] = {0,65,94,151,166,175,203,208,221,227,233,236,239,242,245,245};

#define DELTA_LINE 14

for (int index=0; index < NUM_ANTS; index++)
    {
    int px = 480;
    int py = 8+index * 60;


    // only show infor for first 8 ants
    if (index < 8 )
    {
    // print name of ant and state
    sprintf(buffer,"Ant%d=%s,%d", index, state_to_text[ants[index].varsI[ANT_INDEX_AI_STATE]], ants[index].varsI[ANT_INDEX_AI_SUBSTATE]);    
    Draw_Text_GDI(buffer,px, py, RGB(0,255,0),lpddsback);


    // print counters
    sprintf(buffer, "C1:%d,C2:%d", ants[index].counter_1, ants[index].counter_2);
    Draw_Text_GDI(buffer,px, py+DELTA_LINE, RGB(0,255,0),lpddsback);

    // print hunger level and tolerance
    sprintf(buffer,"Hungr:%d,Tol:%d", ants[index].varsI[ANT_INDEX_HUNGER_LEVEL],
                                      ants[index].varsI[ANT_INDEX_HUNGER_TOLERANCE]);

    Draw_Text_GDI(buffer,px, py+2*DELTA_LINE, RGB(0,255,0),lpddsback);

    // draw memory, the brighter the green dot, the stronger the memory
    Draw_Rectangle(px+124, py, px+124+18, py+18, 0, lpddsback);

    // dont draw memory if ant dead
    if (ants[index].varsI[ANT_INDEX_AI_STATE]!=ANT_DEAD)
    {
    DDraw_Lock_Back_Surface();
    for (int x = 0; x<16; x++)
        for (int y=0; y<16; y++)
            {
            // get memory and convert into pixel value to disply
            // dark means low recall, bright white means strong memory of food
            float mem_strength = ants_mem[index].cell[x][y];

            // each mnm is worth on average 500, so if a cell has a 2500 then we know there is 
            // a lot of food, use this as the highest strength
            if (mem_strength > 2500)
               mem_strength = 2500;

            // normalize and scale to color range
            int color_intensity = (int)((mem_strength/2500)*15);
            Draw_Pixel(px+124+x+1,py+y+1, intensity_to_index[color_intensity], back_buffer, back_lpitch);
      
            int active_pixel = ants_mem[index].ilayer[x][y];

            if (active_pixel)
               // scan input layer to see where degradation and communication have taken place
               Draw_Pixel(px+124+x+1,py+y+1, active_pixel, back_buffer, back_lpitch);
            } // end for

        DDraw_Unlock_Back_Surface();
       } // end if
       else
           // draw flat line :)
           {
           DDraw_Lock_Back_Surface();
           HLine(px+124,px+124+18, py+9, 249, back_buffer, back_lpitch);
           DDraw_Unlock_Back_Surface();
           } // end else

       } // end if < 8

    } // end for index

} // end Draw_Info


////////////////////////////////////////////////////////////////////

int Game_Main(void *parms)
{
// this is the workhorse of your game it will be called
// continuously in real-time this is like main() in C
// all the calls for you game go here!

int index; // looping var


// start the timing clock
Start_Clock();

// clear the drawing surface
DDraw_Fill_Surface(lpddsback, 0);

// lock back buffer and copy background into it
DDraw_Lock_Back_Surface();

// draw background
Draw_Bitmap(&background_bmp, back_buffer, back_lpitch,0);

// unlock back surface
DDraw_Unlock_Back_Surface();

// read keyboard
DInput_Read_Keyboard();

// move ants and perform ai
Move_Ants();

// draw the food
Draw_Food();

// draw ants and animate imagery
Draw_Ants(); 

// draw info
Draw_Info();


sprintf(buffer,"Artificial Intelligence Memory Demo. Press <ESC> to Exit.");
Draw_Text_GDI(buffer,8, 8,RGB(255,255,255),lpddsback);

// flip the surfaces
DDraw_Flip();

// sync to 30ish fps
Wait_Clock(30);

// check of user is trying to exit
if (KEY_DOWN(VK_ESCAPE) || keyboard_state[DIK_ESCAPE])
    {
    PostMessage(main_window_handle, WM_DESTROY,0,0);

    // stop all sounds
    DSound_Stop_All_Sounds();

    // do a screen transition
    Screen_Transitions(SCREEN_DARKNESS,NULL,0);

    } // end if

// return success
return(1);

} // end Game_Main

//////////////////////////////////////////////////////////

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
不卡视频一二三| 国产精品久久久久一区二区三区共| 日韩一区二区三区视频| 国产精品美日韩| 午夜精品视频一区| 不卡的av中国片| 欧美精品一区二区三区久久久| 亚洲素人一区二区| 精品一区二区三区免费观看| 99re6这里只有精品视频在线观看| 日韩欧美亚洲另类制服综合在线| 日韩一区中文字幕| 国产一区二区三区久久悠悠色av| 欧美精品xxxxbbbb| 亚洲乱码精品一二三四区日韩在线 | 国内精品视频一区二区三区八戒| 色哟哟国产精品免费观看| 精品久久久久久久人人人人传媒| 亚洲一区二区三区小说| 99热在这里有精品免费| 久久婷婷色综合| 三级欧美在线一区| 欧美亚洲一区二区三区四区| 自拍偷自拍亚洲精品播放| 国产成人亚洲综合a∨婷婷| 日韩欧美资源站| 青椒成人免费视频| 7777精品伊人久久久大香线蕉完整版 | 成人97人人超碰人人99| 国产夜色精品一区二区av| 乱一区二区av| 精品久久久久久久久久久久包黑料| 亚洲成人你懂的| 欧美日韩一级片在线观看| 亚洲一区二区三区四区中文字幕| 色婷婷综合五月| 亚洲午夜在线观看视频在线| 91麻豆免费在线观看| 亚洲欧美一区二区久久| 一本到三区不卡视频| 玉米视频成人免费看| 91国偷自产一区二区三区观看| 国产精品网友自拍| 成人黄色小视频| 一区二区中文字幕在线| 94色蜜桃网一区二区三区| 成人欧美一区二区三区白人| 91在线国产福利| 亚洲午夜一二三区视频| 欧美日韩精品欧美日韩精品| 丝袜美腿亚洲一区二区图片| 精品日韩成人av| 国产成人在线观看| 国产精品久久久久久亚洲毛片| 99re成人在线| 午夜视频在线观看一区| 欧美tickling网站挠脚心| 国产酒店精品激情| 中文字幕一区二区三区四区 | 欧美亚洲丝袜传媒另类| 日本午夜精品视频在线观看| 7777精品伊人久久久大香线蕉经典版下载| 丝袜亚洲另类丝袜在线| 久久亚洲一级片| 成人av网站免费观看| 一片黄亚洲嫩模| 日韩小视频在线观看专区| 国产精品一区二区三区网站| 最近日韩中文字幕| 欧美日韩国产中文| 国产一区在线不卡| 亚洲日穴在线视频| 欧美日韩精品免费| 国产激情一区二区三区桃花岛亚洲 | 丁香亚洲综合激情啪啪综合| 中文字幕一区免费在线观看| 欧美精品三级在线观看| 国产成人亚洲综合色影视| 亚洲亚洲精品在线观看| 久久久高清一区二区三区| 91久久线看在观草草青青| 免费高清成人在线| **欧美大码日韩| 精品美女一区二区| 91美女片黄在线| 国产精品91xxx| 亚洲一区二区免费视频| 久久久久国色av免费看影院| 欧美日韩专区在线| 成人污视频在线观看| 奇米影视在线99精品| 日本一二三不卡| 日韩欧美aaaaaa| 欧美日韩一级片网站| 成人av一区二区三区| 精品影院一区二区久久久| 一区二区不卡在线播放| 国产精品亲子伦对白| 日韩欧美国产综合一区 | 欧美日韩免费高清一区色橹橹| 国产最新精品免费| 日韩中文字幕亚洲一区二区va在线 | 97se亚洲国产综合自在线不卡| 久久国产精品99久久人人澡| 亚洲综合在线第一页| 国产精品丝袜一区| 精品成a人在线观看| 欧洲视频一区二区| 成人99免费视频| 国产福利91精品一区二区三区| 日本视频免费一区| 亚洲国产乱码最新视频| 亚洲特级片在线| 成人欧美一区二区三区黑人麻豆| 国产亚洲成av人在线观看导航 | 成a人片国产精品| 国产精品亚洲第一区在线暖暖韩国| 青草av.久久免费一区| 日韩精品一级中文字幕精品视频免费观看| 亚洲欧洲美洲综合色网| 中文字幕精品一区二区三区精品| 久久蜜桃av一区二区天堂| 欧美精品一区二区三区高清aⅴ | 国产乱码精品一品二品| 国精品**一区二区三区在线蜜桃| 免费成人深夜小野草| 免费观看成人av| 精品一区二区在线播放| 蜜桃视频一区二区三区在线观看| 日韩va欧美va亚洲va久久| 日韩av一二三| 久久99久久精品欧美| 国产一区二区三区免费看| 国产在线视频一区二区三区| 国产一区在线精品| 丁香激情综合国产| 91免费视频大全| 在线观看91视频| 69久久99精品久久久久婷婷| 欧美一级在线免费| 精品国产第一区二区三区观看体验| 日韩精品一区二区三区在线观看 | 国产欧美视频在线观看| 国产精品天天看| 一区二区三区产品免费精品久久75| 一区二区三区四区激情| 亚洲成a人片在线观看中文| 美女一区二区三区在线观看| 国产美女视频91| 色哟哟在线观看一区二区三区| 91福利小视频| 精品国产亚洲在线| 国产精品婷婷午夜在线观看| 亚洲欧美福利一区二区| 婷婷久久综合九色综合绿巨人| 麻豆精品在线播放| 成人黄色综合网站| 欧美日韩一区二区三区不卡| 精品国产一区二区精华| 综合色中文字幕| 婷婷六月综合亚洲| 高清久久久久久| 欧美日韩三级视频| 久久久久久久久久久久久夜| 国产精品久久久久aaaa| 午夜精品影院在线观看| 国产成人av福利| 欧美日韩久久久| 国产日韩欧美综合在线| 亚洲国产成人91porn| 国产成人在线视频免费播放| 欧美色综合天天久久综合精品| 精品剧情v国产在线观看在线| 自拍av一区二区三区| 激情欧美一区二区三区在线观看| 99久久免费国产| 欧美成人a∨高清免费观看| 亚洲免费三区一区二区| 国产一区二区三区电影在线观看 | 欧美一二三四区在线| 国产精品国产自产拍高清av | 91国产福利在线| 国产欧美精品一区二区色综合| 亚洲美女偷拍久久| 国产在线播放一区三区四| 在线免费不卡视频| 日本一二三四高清不卡| 琪琪一区二区三区| 欧美影院精品一区| 成人欧美一区二区三区黑人麻豆| 韩国中文字幕2020精品| 欧美伦理电影网| 亚洲欧美自拍偷拍色图| 国产精品夜夜爽| 日韩一区二区三区视频在线观看| 亚洲一区精品在线| 91免费看`日韩一区二区| 国产日韩亚洲欧美综合| 黄一区二区三区| 日韩免费视频一区|