Suggestion of a 3bit direction structure

A simple way of saving memory space is to concider the fact that you have a maximum possibily of 8 directions out from one tile. (In a hex based system you only have 6). This means that to indicate one direction you will only need 3 bits of information. Two directions fits into one byte, wasting two bits. Of course you can make it even more advanced to take advantage of the two wasted bits by packing them even better together.

  000 Up
  001 Up and Right
  010 Right
  011 Rigth and Down
  100 Down
  101 Down and Left
  110 Left
  111 Left and Up

 Byte 0    Byte 1     Byte 2
    4     0000 0001  0010 0010

Byte 0 indicates how many moves we have, and after that the movedata comes.
Move up, then move up and right, finally move two times to the right.


Back to index page.

john@lis.pitt.edu