?? wupus.h
字號(hào):
#ifndef WUPUS_H
#define WUPUS_H
#include<math.h>
#include<stdlib.h>
#include <time.h>
#include<windows.h>
#include <iostream.h>
#include<stdio.h>
#define E 0
#define N 1
#define W 2
#define S 3
#define LEFT 1
#define RIGHT -1
#define FORWARD 0
#define BACKWARD 2
#define MAX_X 6
#define MAX_Y 6
enum Object{Wall,Living_Wupus, Dead_Wupus, Gold,
Pit, Empty,FOG,SAFE,WUPUS_DANGER_POS};
extern int step;
typedef Object *Object_Column;
struct Percept
{
bool stench;
bool breeze;
bool glitter;
bool bump;
bool scream;
};
typedef struct Position
{
int x;
int y;
Position* parent;//上一步的位置
}Position;
extern Position WupusPos;
struct HERO
{
Position* pos;//紀(jì)錄英雄所在位置
int direction;//英雄的方向
Object **image;//英雄心中的地圖
bool arrow;
bool gold;
Percept percept;//英雄屬性
bool escaped;
bool alive;
};
class Wupus_World
{
private:
Object **world;//二維數(shù)組指針
HERO hunter;
void init_agent(); //初始化英雄屬性
void init_map(); //初始化地圖
bool adjacent(const Object OBJECT);//判斷相鄰
bool current(const Object OBJECT);//判斷重合
void set_percepts(); //維護(hù)英雄屬性
bool Forward();//向前走
void Backward();//后退
void Turn_left();
void Turn_right();
void Grab();
void Shoot();
void Climb();
void turn(int);//轉(zhuǎn)向指定方向
bool move(int);//轉(zhuǎn)向指定方向并前進(jìn)
public:
Wupus_World();
~Wupus_World();
void show(bool);
void action();//指導(dǎo)英雄的行動(dòng)
int score();//記分
};
#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -