Why does game_map._get_target_direction() return 2 tuples?


#1

Just curious as to why game_map._get_target_direction() is returning either a tuple of tuples, or a tuple of None and a tuple, being as a Direction is stored within just one tuple. I was thinking for a bit that perhaps the two tuples were just the pair of initial routes that one could take (depending on whether n/s or e/w were chosen first), and that None being in the mix would signify that one is already on the axis in question, but that was before I had enough coffee to think it through fully.

Can somebody explain this behavior to me? I’m having significant difficulties due to not properly understand what’s going on with _get_target_direction() here.

Thanks in advance, it’s very much appreciated!


#2

Whoops, nevermind; I just ended up reading the method’s documentation a little more carefully and answered my own question.

Sorry, I was looking for a place to delete the thread and wasn’t able to find it. If anybody can tell me how to delete a thread that’d be appreciated, too!


#3

No worries, it happens :slight_smile:
What was the solution to your question? You should post it here; someone else might come along with a similar question!


#4

Oh, good point. :wink:

Well, it was just a basic misconception regarding the directionals, actually. I was not thinking of HaliteIII’s limitations on directions being the 4 cardinals; the tuples returned show each of the moves possible on the 2 axes. So there are actually two directionals returned that are good potential moves, depending on whether or not the start position is laying on one of the aforementioned axes. In other words, I was assuming the validity of something like Direction.NorthEast, instead of just the 4 cardinals.

Axes is plural for axis, no? :sweat_smile: