⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maze.h

📁 Win32下立体迷宫程序
💻 H
字号:

#if !defined(AFX_MAZE_H__E08326FC_39F8_45D8_AD74_F4661FEABD28__INCLUDED_)
#define AFX_MAZE_H__E08326FC_39F8_45D8_AD74_F4661FEABD28__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "resource.h"
#include "stdio.h"

#define MAX_LOADSTRING 100
#define START_H 270
#define START_L 80
#define LONG 32
#define WIDE 24
#define HIGH 18
#define M 10
#define N 10
#define GATE 'G'
#define EXIT 'E'
#define PATH 'P'

typedef struct mazeshow
{
	int up,right,buttom,man,down,left;
}MAZESHOW;
typedef struct way{int x;int y;}WAY;

// Foward declarations of functions included in this code module:
ATOM				MyRegisterClass(HINSTANCE hInstance);
BOOL				InitInstance(HINSTANCE, int);
LRESULT CALLBACK	WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK	About(HWND, UINT, WPARAM, LPARAM);
int					mazeshowinitializtion(void);
int 				MazeboxDraw(HWND,int, int);
int					MazeDraw(HWND);
int					SearchAllWay(HWND,int,int,int,int);
int					SearchBestWay(HWND,int,int,int,int);
int					MazeChange(int a[][2*M+1],int b[][2*M+1]);
int					WayDraw(HWND,int ,int);

// Global Variables:
HINSTANCE hInst;								// current instance
TCHAR szTitle[MAX_LOADSTRING];								// The title bar text
TCHAR szWindowClass[MAX_LOADSTRING];								// The title bar text
MAZESHOW mazeshow[M][N];
WAY way[(2*N+1)*(2*M+1)];
WAY allway[30000][(2*N+1)*(2*M+1)];
int movex[5]={0,-1,0,1,0};
int movey[5]={0,0,1,0,-1};
int best,allwaycount,waycount=0,all=0,game,game07=0,i=0,j=0,selfset=0;
int r=2;
int maze[2*N+1][2*M+1];
int mazeall[8][2*N+1][2*M+1]=
{
	{
		{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
		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,1,1,1,1,1,1,1,1,1,1,1,1,1},
		{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
		{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
		{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
		{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
		{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
		{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
		{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
		{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
	}
};


#endif // !defined(AFX_MAZE_H__E08326FC_39F8_45D8_AD74_F4661FEABD28__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -