Java Reference
In-Depth Information
figure 24.2
Initial state: All walls
are up, and all cells
are in their own sets.
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14}
{15} {16} {17} {18} {19} {20} {21} {22} {23} {24}
figure 24.3
At some point in the
algorithm, several
walls have been
knocked down and
sets have been
merged. At this point,
if we randomly select
the wall between 8
and 13, this wall is not
knocked down
because 8 and 13 are
already connected.
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{0, 1} {2} {3} {4, 6, 7, 8, 9, 13,14} {5} {10, 11, 15} {12}
{16, 17, 18, 22} {19} {20} {21} {22} {23} {24}
figure 24.4
We randomly select
the wall between
squares 18 and 13 in
Figure 24.3; this wall
has been knocked
down because 18 and
13 were not already
connected, and their
sets have been
merged.
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{0,1} {2} {3} {5} {10, 11, 15} {12}
{4, 6, 7, 8, 9, 13, 14, 16, 17, 18, 22} {19} {20} {21} {23} {24}
 
Search WWH ::




Custom Search