Solved

first steps -> How "Mazes" have been made

Posted on 2007-03-28
9
363 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

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

Suggested Solutions

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

710 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