Labyrinth
A labyrinth game assignment
host.labyrinth.Edge Class Reference

A utility class used for room prevent algorithm. More...

Package Functions

 Edge (int tileId, int direction)
 This constructor acts as the interface between the application's wall representation and the one based on graph. More...
 
 Edge (Edge e)
 A deep copy contructor. More...
 
int getV1 ()
 Access of the first node of the edge. More...
 
int getV2 ()
 Access of the second node of the edge. More...
 

Private Attributes

int v1
 First vertex of the edge. More...
 
int v2
 Second vertex of the edge. More...
 

Detailed Description

A utility class used for room prevent algorithm.

This class is the wall representation we use in the room preventing algorithm. In this algorithm we represent the crosses between tiles as nodes (V) of a graph and the walls as edges. So for example:

  12--13--14---15
   |           |
   8   9--10   11
   |       |   |
   4   5   6   7
   |   |       |
   0   1---2---3

In this example we have a 4x4=16 vertices board(nodes) and 14 edges(walls). To represent the vertices on the board we use the same trick as the tileId

V = Row*(N+1) + Column, where N is the board's tile size.

The edges are represented as vertices pairs. For example (0, 4) or (13, 14).

Note
Beside the fact that we prefer this kind of representation of the walls in the application we use the one that is suggested from the assignment. This is used only in room preventing algorithm.
Using this kind of representation we don't have any more the "problem" of setting the wall in both neighbor tiles.

Definition at line 306 of file Common.java.

Constructor & Destructor Documentation

◆ Edge() [1/2]

host.labyrinth.Edge.Edge ( int  tileId,
int  direction 
)
package

This constructor acts as the interface between the application's wall representation and the one based on graph.

Parameters
tileIdThe tile id of the wall.
directionThe direction of the tile where the wall should be.

Definition at line 313 of file Common.java.

◆ Edge() [2/2]

host.labyrinth.Edge.Edge ( Edge  e)
package

A deep copy contructor.

Definition at line 335 of file Common.java.

Member Function Documentation

◆ getV1()

int host.labyrinth.Edge.getV1 ( )
package

Access of the first node of the edge.

Definition at line 340 of file Common.java.

◆ getV2()

int host.labyrinth.Edge.getV2 ( )
package

Access of the second node of the edge.

Definition at line 342 of file Common.java.

Member Data Documentation

◆ v1

int host.labyrinth.Edge.v1
private

First vertex of the edge.

Definition at line 344 of file Common.java.

◆ v2

int host.labyrinth.Edge.v2
private

Second vertex of the edge.

Definition at line 345 of file Common.java.


The documentation for this class was generated from the following file: