강의

멘토링

로드맵

Inflearn Community Q&A

taek63361977's profile image
taek63361977

asked

[MMORPG Game Development with C++ and Unreal Engine Series] Part 3: Data Structures and Algorithms

A* pathfinding algorithm

A*알고리즘 작성과정에서 블록 안에서 초기화를 한 이유가 궁금합니다.

Written on

·

592

0

player.cpp의 AStar 함수 내에서

//초기값

{

int32 g = 0;

int32 h = 10 * (abs(dest.y - start.y) + abs(dest.x - start.x));

pq.push(PQNode{ g + h, g, start });

best[start.y][start.x] = g + h;

parent[start] = start;

}

이렇게 { } 블록을 설정하고 그 안에서 초기화를 한 이유가 궁금합니다.

기술면접

Quiz

46% of people got it wrong. Give it a try!

트리(Tree) 자료구조의 가장 큰 특징은 무엇일까요?

데이터가 삽입된 순서대로 정렬됩니다.

각 노드는 최대 두 개의 자식만 가질 수 있습니다.

데이터가 부모-자식 관계의 계층적인 형태로 표현됩니다.

노드 간 연결에 방향성이 없습니다.

Answer 1

0

Rookiss님의 프로필 이미지
Rookiss
Instructor

큰 의미가 있는 것은 아니고 초기화 하는 부분을 묶어서 보기 위함입니다.

taek63361977's profile image
taek63361977

asked

Ask a question