Is it better to hard code data or find an algorithm?

Posted by OghmaOsiris on Game Development See other posts from Game Development or by OghmaOsiris
Published on 2012-06-21T22:36:21Z Indexed on 2012/06/22 3:25 UTC
Read the original article Hit count: 401

I've been working on a boardgame that has a hex grid as the board (the upper right grid in the image below)

enter image description here

Since the board will never change and the spaces on the board will always be linked to the same other spaces around it, should I just hard code every space with the values that I need? Or should I use various algorithms to calculate links and traversals?

To be more specific, my board game is a 4 player game where each player has a 5x5x5x5x5x5 hex grid (again, the upper right grid in th eimage above). The object is to get from the bottom of the grid to the top, with various obstacles in the way, and each players being able to attack eachother from the edge of their grid onto other players based on a range multiplier.

Since the players grid will never change and the distance of any arbitrary space from the edge of the grid will always be the same, should I just hard code this number into each of the spaces, or should I still use a breadth first search algorithm when players are attacking?

The only con I can think of for hard coding everything is that I'm going to code 9+ 2(5+6+7+8) = 61 individual cells. Is there anything else that I'm missing that I should consider using more complex algorithms?

© Game Development or respective owner

Related posts about algorithm

Related posts about procedural-generation