CTileArranger Class Reference

Slot을 연결하는 그래프를 생성하고, 그 위에 적합한 타일을 배치한다. More...

#include <TileArranger.h>

List of all members.

Public Member Functions

int Process (UserCondition t_userCondition, CTileContainer *pTileContainer)
 주어진 User Condtion 과 Tile set 을 이용하여 그래프를 생성하고 타일을 배치한다.

Private Member Functions

int GenMainPath (int reqTurn, int reqLen)
 인자로 주어진 턴수와 길이를 만족하는 Main Path를 생성한다.
int SetArtiPoints (int lastSequence)
 사용자가 요청한 Lock과 Sokoban을 Main Path 상에 적절한 간격으로 배치한다.
void SetSection ()
 배치된 Ariculation Point을 기준으로 Section을 나눈다.
int BroadenMainPath (int lastSequence)
 Section 별로 사용자가 지정한 값에 따라 Main path의 두께를 넓힌다.
int ComplicateMap (int lastSequence)
 Section 별로 사용자가 지정한 값에 따라 sub path를 생성한다.
void MakeSubPath (int x, int y, Direction::Type curDir, int maxLen, int orgSeq, bool bCycleAllowed)
 인자로 받은 Slot으로부터 이웃 Slot하나를 랜덤하게 연결한다.
int RandomlyConnectMargin ()
 Solution Graph에 연결되지 않은 Slot들을 랜덤하게 연결한다.
int ArrangeTile ()
 각 Slot에 적절한 타일을 배치한다.
int Dfs (int curX, int curY, Direction::Type curDir, int curTurn, int curLen, int reqTurn, int reqLen)
 백트리킹을 하여 Main Path를 생성한다.
float EvalAdjRel (int x, int y, int tileIndex)
 지정된 타일을 지정된 좌표의 Slot에 배치할 때 인접 Slot과의 지형 적합도를 수치로 반환한다.

Private Attributes

Slot m_slotMatrix [MAX_SLOT_MATRIX_SIZE][MAX_SLOT_MATRIX_SIZE]
 Slot으로 이루어진 Matrix. 전체 level을 나타낸다.
UserCondition m_userCondition
 사용자가 입력한 제약 조건
vector< ArtiPoint > m_artiPoints
 Articulation Points(Lock or Sokoban)의 목록.
CTileContainerm_pTileContainer
 사용할 타일 셋

Friends

class CKeyLockComposer
class CCelledMapGenerator


Detailed Description

Slot을 연결하는 그래프를 생성하고, 그 위에 적합한 타일을 배치한다.

slot은 타일 하나가 배치되는 공간이고, 전체 level은 이 slot의 matrix 형태이다. 먼저 각 slot을 vertex로 하고 인접 slot간에 edge를 연결하여 graph를 구성한다. 그 다음에 graph의 각 vertex에 적합한 타일을 배치한다.


Member Function Documentation

int CTileArranger::Process ( UserCondition  t_userCondition,
CTileContainer pTileContainer 
)

주어진 User Condtion 과 Tile set 을 이용하여 그래프를 생성하고 타일을 배치한다.

이 때 CTileArranger의 member 함수를 순서대로 호출함으로써 절차를 수행한다.

Parameters:
t_userCondition 사용자가 입력한 제약 조건
pTileContainer CTileContainer의 pointer
Returns:
에러 코드

int CTileArranger::GenMainPath ( int  reqTurn,
int  reqLen 
) [private]

인자로 주어진 턴수와 길이를 만족하는 Main Path를 생성한다.

Dfs()를 호출하여 백트래킹으로 Path를 생성한다.

Parameters:
reqTurn 사용자가 요구한 턴수
reqLen 사용자가 요구한 길이
Returns:
에러 코드

int CTileArranger::SetArtiPoints ( int  lastSequence  )  [private]

사용자가 요청한 Lock과 Sokoban을 Main Path 상에 적절한 간격으로 배치한다.

이 때 Lock과 Sokoban이 배치된 Slot은 Graph 상에서 Articulation Point가 된다. 즉 Mission을 Clear하기 위해서는 반드시 이 Slot을 지나가야 한다.

Parameters:
lastSequence 생성된 main path의 길이
Returns:
에러 코드

int CTileArranger::BroadenMainPath ( int  lastSequence  )  [private]

Section 별로 사용자가 지정한 값에 따라 Main path의 두께를 넓힌다.

Parameters:
lastSequence 생성된 main path의 길이
Returns:
에러 코드

int CTileArranger::ComplicateMap ( int  lastSequence  )  [private]

Section 별로 사용자가 지정한 값에 따라 sub path를 생성한다.

sub path는 main path나 이미 생성된 sub path로 부터 뻗어나가는 갈림길이다. cycle을 생성할 수도 있지만 다른 section의 main path로 연결되는 것은 허용하지 않는다. 내부적으로 MakeSubPath()를 재귀적으로 호출한다.

Parameters:
lastSequence 생성된 main path의 길이
Returns:
에러 코드

void CTileArranger::MakeSubPath ( int  x,
int  y,
Direction::Type  curDir,
int  maxLen,
int  orgSeq,
bool  bCycleAllowed 
) [private]

인자로 받은 Slot으로부터 이웃 Slot하나를 랜덤하게 연결한다.

재귀적으로 수행하여 지정된 길이의 sub path를 생성한다.

Parameters:
x 확장할 Slot의 x좌표
y 확장할 Slot의 y좌표
curDir 최근 확장 방향
maxLen sub path의 제한 길이
orgSeq current sub path의 근원이 되는 main path의 sequence. 2*2 cycle을 생성하여 길이 넓어지는 것을 막기 위해
bCycleAllowed 다시 main path로 연결되는 cycle을 허용하는 지의 여부. 이것을 지정하는 이유는 중첩 Lock을 배치하기 위해서는 배치할 중첩 Lock의 갯수와 같은 "cycle이 아닌 sub path"가 필요하기 때문이다.
Returns:
에러 코드

int CTileArranger::RandomlyConnectMargin (  )  [private]

Solution Graph에 연결되지 않은 Slot들을 랜덤하게 연결한다.

이 때 Solution Graph의 Slot과는 연결되지 않도록 보장한다.

Returns:
에러 코드

int CTileArranger::ArrangeTile (  )  [private]

각 Slot에 적절한 타일을 배치한다.

타일 배치의 첫번째 기준은 인접 타일 과의 연결성이다. 미리 생성된 Graph에서 한 Slot이 이웃 Slot과 어떻게 연결되어 있는 지를 파악하여 이에 맞는 타일을 배치한다.

두번째 기준은 이미 타일이 배치된 인접 Slot과의 지형의 연결성이다.

Returns:
에러 코드

int CTileArranger::Dfs ( int  curX,
int  curY,
Direction::Type  curDir,
int  curTurn,
int  curLen,
int  reqTurn,
int  reqLen 
) [private]

백트리킹을 하여 Main Path를 생성한다.

Parameters:
curX x좌표
curY y좌표
curDir 최근 확장 방향
curTurn 지금까지 턴 수
curLen 지금까지 길이
reqTurn 요구된 턴 수
reqLen 요구된 길이
Returns:
에러 코드

float CTileArranger::EvalAdjRel ( int  x,
int  y,
int  tileIndex 
) [private]

지정된 타일을 지정된 좌표의 Slot에 배치할 때 인접 Slot과의 지형 적합도를 수치로 반환한다.

Parameters:
x 타일을 배치할 Slot의 x좌표
y 타일을 배치할 Slot의 y좌표
tileIndex 배치할 타일의 id
Returns:
지형 적합도


The documentation for this class was generated from the following files:
Generated on Wed Dec 19 12:25:56 2007 for Random Level Generator by  doxygen 1.5.4