Dobuki Studio Interview Question for Game Programmers


Country: United States




Comment hidden because of low score. Click to expand.
0
of 0 vote

You can represent a hex map as an ordinary grid (2D array). Movement is a bit different. Horizontal movement is the same as with a grid. But Vertical movement is different: in terms of the 2d array, a unit on even rows can move up, down, up and right, down and right. A unit on odd rows can move up, down, up and left, down and left.

- tjcbs2 May 12, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I see the 2D array differently.

If you line up the hexes into rows, either by shifting the even columns up half a row or the odd columns down half a row, you get a 2d array.

From any position in the 2d array you can go left, right, up, or down.
For odd columns you can additionally go up left and up right.
For even columns you additionally go down left and down right.

I'm not seeing why in the answer provided by tjcbs you can only go up/down + right on even rows and up/down + left on odd rows.

- CareerCupDom May 15, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Note that this works well if we have X columns and X rows of hexagons. If you can have arbitrarily long chains of hexes attached you would be better off having a graph where each hex contain a pointer to the next hex in each of the six valid directions.

- CareerCupDom May 15, 2015 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More