📄 hamster.h
字号:
/*---------------------------------------------------------------------- File : hamster.h Contents: hamster control functions Author : Christian Borgelt History : 14.10.1997 file created 16.10.1997 first version completed 18.10.1997 type HAMSTER made opaque 21.10.1997 definitions of maximal maze extensions added 15.01.1998 definitioan of maximal size of corn heap added----------------------------------------------------------------------*/#ifndef __HAMSTER__#define __HAMSTER__/*---------------------------------------------------------------------- Preprocessor Definitions----------------------------------------------------------------------*/#define HMS_MAXXEXT 64 /* maximal x-extension of maze */#define HMS_MAXYEXT 64 /* maximal y-extension of maze */#define HMS_MAXCORN 255 /* maximal size of corn heap */#define HMS_MAXLOAD 12 /* maximal load of corn in cheeks *//* --- results of hms_dir() --- */#define HMS_EAST 0 /* hamster is looking east */#define HMS_NORTH 1 /* hamster is looking north */#define HMS_WEST 2 /* hamster is looking west */#define HMS_SOUTH 3 /* hamster is looking south *//* --- results of hms_look() --- */#define HMS_EMPTY 0 /* there is an empty field ahead */#define HMS_CORN 1 /* there is a field with corn ahead */#define HMS_WALL 2 /* there is a wall ahead *//* --- parameters of hms_turn() --- */#define HMS_POS 1 /* positive turn (counterclockwise) */#define HMS_NEG -1 /* negative turn (clockwise) */#define HMS_LEFT 1 /* left turn (counterclockwise) */#define HMS_RIGHT -1 /* right turn (clockwise) *//*---------------------------------------------------------------------- Type Definitions----------------------------------------------------------------------*/typedef struct hamster HAMSTER; /* a hamster *//*---------------------------------------------------------------------- Functions----------------------------------------------------------------------*//* --- enquiries --- */extern void hms_pos (HAMSTER *hms, int *x, int *y);extern int hms_dir (HAMSTER *hms);extern int hms_look (HAMSTER *hms);extern int hms_corn (HAMSTER *hms);extern int hms_load (HAMSTER *hms);/* --- actions --- */extern int hms_move (HAMSTER *hms);extern void hms_turn (HAMSTER *hms, int turn);extern int hms_take (HAMSTER *hms, int amount);extern int hms_drop (HAMSTER *hms, int amount);/* --- function to be provided by user --- */extern void hms_ctrl (HAMSTER *hms);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -