?? arsthiefrandom.cpp
字號:
#include "StdAfx.h"
#include "ARSThiefRandom.h"
#include <stdlib.h>
#include <time.h>
ARSAction* ARSThRandom::CreateAction()
{
ARSThRandom * tmp = new ARSThRandom;
return tmp;
}
bool ARSThRandom::ExecuteAction(const ARSSTUATION & stSituation, MOVEDIRECTION & nextDirection)
{
srand(time(NULL));
// switch(rand()%9+1) {
// case 1:
// nextDirection = LEFTDOWN;
// break;
// case 2:
// nextDirection = DOWN;
// break;
// case 3:
// nextDirection = RIGHTDOWN;
// break;
// case 4:
// nextDirection = LEFT;
// break;
// case 5:
// nextDirection = STILL;
// break;
// case 6:
// nextDirection = RIGHT;
// break;
// case 7:
// nextDirection = LEFTUP;
// break;
// case 8:
// nextDirection = UP;
// break;
// case 9:
// nextDirection = RIGHTUP;
// break;
// }
switch(rand()%5+1) {
case 1:
nextDirection = DOWN;
break;
case 2:
nextDirection = LEFT;
break;
case 3:
nextDirection = STILL;
break;
case 4:
nextDirection = RIGHT;
break;
case 5:
nextDirection = UP;
break;
}
// nextDirection = STILL;///
return true;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -