검색어 입력폼

[자료구조] C로 구현한 미로찾기

등록일 2004.05.03 파일확장자압축파일 (zip) | 3페이지 | 가격 2,000원

*해당 문서는 미리보기가 지원되지 않습니다.

소개글

출력물은요..
파일에서 불러와 원본 미로 출력
미로경로 출력
찾은 미로 경로를 표기하여 원본을 변형하여 출력
입니다.

컴파일 실행환경

없음

본문내용

#include <stdio.h>
#include <stdlib.h>


#define MAX_STACK_SIZE 60
#define TRUE 1
#define FALSE 0
#define SIZE 12

typedef struct{
int row;
int col;
int dir;
} element;
element stack[MAX_STACK_SIZE];
element position;

typedef struct{
int vert;
int horiz;
} offsets;

offsets move[8] = {
{-1, 0},
{-1, 1},
{ 0, 1},
{ 1, 1},
{ 1, 0},
{ 1, -1},
{ 0, -1},
{-1, -1}
};

void add(int *top, element position);
element delete(int *top);
void stack_full(void);
void stack_empty(void);

main()
{
int maze[SIZE][SIZE]={{1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,1,1,1,1,0,0,1,1,1,1},
{1,0,1,1,1,0,1,0,1,1,1,1},
{1,1,0,0,0,1,1,1,0,1,1,1},
{1,1,1,1,1,1,0,0,1,1,1,1},
{1,1,1,0,0,0,1,1,1,1,1,1},
{1,1,0,1,1,1,1,0,0,1,1,1},
{1,0,1,1,1,1,0,1,1,0,1,1},
{1,1,0,0,1,1,0,1,0,1,1,1},
{1,1,1,1,0,0,1,1,0,0,1,1},
{1,1,1,1,1,1,1,1,1,1,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1}};

int i, row, col, next_row, next_col, dir=0,
found=FALSE, EX_ROW=10, EX_COL=10;
int top, x, y;
int mark[SIZE][SIZE]={{1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1}};
mark[1][1]=1; top=0;
stack[0].row=1; stack[0].col=1; stack[0].dir=1;

압축파일내 파일목록

YS_maze.dsp
YS_maze.dsw
YS_maze.plg
MAZE1.C
YS_maze.opt
다운로드 맨위로