Solved

first steps -> How "Mazes" have been made

Posted on 2007-03-28
9
354 Views
Last Modified: 2013-11-15
Do you have a idea, how to present a "maze"  in C++. Especialy how to present a structure of DATA , I heard
that  I must to describe neibourgh cells e. tc?
0
Comment
Question by:sisqu
9 Comments
 
LVL 6

Accepted Solution

by:
_iskywalker_ earned 168 total points
ID: 18806413
you can always use a matrix for it (a 2-dim array) like:
cell 1 = array[0][0];
cell 2 =array[0][1];
cell 11 = array[1][0];
if there are for example 100 cells divided in a quadratic maze
0
 

Author Comment

by:sisqu
ID: 18806523
Yes, but I mean how to present if the cell is wall,how to walk over the matrix and mark cells have already visited, how to return and change may way
this tings.........................
0
 
LVL 6

Expert Comment

by:_iskywalker_
ID: 18806718
well that you can define by the cell type like
typdef struct mazecell{
int type;
bool visited;
}

mazecell mymaze[10][10];
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:sisqu
ID: 18806744
There havent easier way :(
0
 
LVL 6

Expert Comment

by:_iskywalker_
ID: 18806796
what is hard in it? you can also create a class instead of a struct, but you need some data strcuture to describe your maze cell, if you need many information about the cell, you can also create for every information you need a matrix like:
int visited[10][10];
int type[10][10];
so i would propose the creating a class cell and making a matrix of it, since in the class you can add any property which will be add to every cell.
0
 
LVL 58

Assisted Solution

by:harfang
harfang earned 166 total points
ID: 18814116
I like this one (needs a non-proportional font, though)

char*M,A,Z,E=40,J[40],T[40];main(C){for(*J=A=scanf(M="%d",&C);
--            E;             J[              E]             =T
[E   ]=  E)   printf("._");  for(;(A-=Z=!Z)  ||  (printf("\n|"
)    ,   A    =              39              ,C             --
)    ;   Z    ||    printf   (M   ))M[Z]=Z[A-(E   =A[J-Z])&&!C
&    A   ==             T[                                  A]
|6<<11<rand()||!C&!Z?J[T[E]=T[A]]=E,J[T[A]=A-Z]=A,"_.":" |"];}

An old entry to the obfuscated C-code contest...

(°v°)
0
 
LVL 1

Assisted Solution

by:swiatlo
swiatlo earned 166 total points
ID: 18873396
What do you want to do with your maze (M)? You can represent M in many ways. I just thought that for 2D M, where there is 1 starting point you can build a 3-branch tree. Since from one point you can go FWD, LEFT, RIGHT. Starting point would be a top of the tree, there could be blind (nill pointers) directions, and somewhere at the bottom you will have a winning leaf (or more). while building that tree you would have to find where corridors join together and point to same leafs.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
powershell and sql server - alerting 7 87
Default Mailbox Database on Exchange became dismounted due to carelessness 11 78
Beginner to Unreal Engine 4 5 79
use lov values 2 49
CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
When there is a disconnect between the intentions of their creator and the recipient, when algorithms go awry, they can have disastrous consequences.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now