急求C语言程序设计(最少300行的)

来源:百度知道 编辑:UC知道 时间:2024/05/22 23:52:40

#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;

//const variables
const int BOARD_HEIGHT=15; //height of a board
const int BOARD_WIDTH=35; //width of a board

const char PLAYER='P'; //player's face
const int PLAYER_INIT_ROW=0; //player's init position
const int PLAYER_INIT_COL=0; //player's init position

const int START_TIME=60;

const char TARGET='M';

//moving direction
enum direction {UP=0, DOWN, LEFT, RIGHT, STAY, INVALID};

//status of the game
enum status {NORMAL, INVALIDINPUT, CANNOTMOVE, GAMESTART, GAMEOVER, WIN};

void gamestart(); //start the game and fall into a infinity loop
void init_board(char board[][BOARD_WIDTH]); //init the board
void print_board(char board[][BOARD_WIDTH]); //print out the board with a m