Wiimmfi/Nice ID

From Custom Mario Kart
< Wiimmfi
Revision as of 09:21, 15 September 2016 by Wiimm (talk | contribs) (Created page with "'''Nice ID''' is a concept to make long numeric identifiers easier to read and to remember. A ''Nice ID'' are always 2 letters followed by 2 digits. So 26*26*10*10=67600 diffe...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Nice ID is a concept to make long numeric identifiers easier to read and to remember. A Nice ID are always 2 letters followed by 2 digits. So 26*26*10*10=67600 different nice ids are available. They are used cyclic. This is enough to differ between 2 rooms or groups over weeks.

C algorithm

The following algorithm shows, haw a numeric id is translated to a Nice ID. The algorithm includes, that the number is truncated by modulo 67600.

  char buf[5];
  buf[0] = 'A' + id / 2600 % 26;
  buf[1] = 'A' + id /  100 % 26;
  buf[2] = '0' + id /   10 % 10;
  buf[3] = '0' + id        % 10;
  buf[4] = 0;