📄 wupus.h
字号:
#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;//纪录英雄所在位置
int direction;//英雄的方向
Object **image;//英雄心中的地图
bool arrow;
bool gold;
Percept percept;//英雄属性
bool escaped;
bool alive;
};
class Wupus_World
{
private:
Object **world;//二维数组指针
HERO hunter;
void init_agent(); //初始化英雄属性
void init_map(); //初始化地图
bool adjacent(const Object OBJECT);//判断相邻
bool current(const Object OBJECT);//判断重合
void set_percepts(); //维护英雄属性
bool Forward();//向前走
void Backward();//后退
void Turn_left();
void Turn_right();
void Grab();
void Shoot();
void Climb();
void turn(int);//转向指定方向
bool move(int);//转向指定方向并前进
public:
Wupus_World();
~Wupus_World();
void show(bool);
void action();//指导英雄的行动
int score();//记分
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -