Vurnhœff Pirate Code

The Vurnhœff Pirate Code is a unique numeric code assigned to pirate characters located to join with the Vurnhœff database. It has 11 characters in the format AA12345678A.

Contents of the Vurnhœff Pirate Code
The Vurnhœff Pirate Code contains two letters (the first letter indicates the gender of the pirate character), seven numbers, one checksum number and optionally, a final letter.
 * Gender: The first letter indicates the gender and must not be D, F, I, O, Q, U or V to prevent confusion.
 * Second letter and seven numbers: The second letter and seven numbers are randomised. The second letter can be any letter from A to Z but must not be D, F, I, O, Q, U or V to prevent confusion.
 * Check digit: Is a number. Calculated for error detection.
 * Final letter: The final letter is optional, it can be A, B, C or H; or it can be truncated.

Calculation of check digit
To calculate a check digit: Transliterate letters to numbers according to the list below: A = 3    M = 30 B = 6    N = 33 C = 9    P = 36 E = 12   R = 39 G = 15   S = 42 H = 18   T = 45 J = 21   W = 48 K = 24   X = 51 L = 27   Y = 54 Z = 1 (position 11 only) Absence of letter in 11th position = 0 Multiply the digits by weighing factor: Digit 1       10 Digit 2       9 Digit 3       8 Digit 4       7 Digit 5       6 Digit 6       5 Digit 7       4 Digit 8       3 Digit 9       2 Digit 11      11 The formula to get a checksum number is: result = 11 - (remainder of sum / 11) If result between 1 and 9, Checksum number = result If result = 10, Checksum number = 5 If result = 11, Checksum number = 0 First checksum calculation example for AL8492881_A (a boy pirate): A = 3, L = 27 3*10 + 27*9 + 8*8 + 4*7 + 9*6 + 2*5 + 8*4 + 8*3 + 1*2 + 3*11 = 520     520 / 11 = 47 R 3 11 - 3 = 8 8 is the checksum number; completed Vurnhœff Pirate Code is AL84928818A Second checksum calculation example for ZS6806438_B (a girl pirate): Z = 1, S = 42 1*10 + 42*9 + 6*8 + 8*7 + 0*6 + 6*5 + 4*4 + 3*3 + 8*2 + 6*11 = 629     629 / 11 = 57 R 2 11 - 2 = 9 9 is the checksum number; completed Vurnhœff Pirate Code is ZS68064389B

Example of a valid Vurnhœff Pirate Code
An example of a valid Vurnhœff Pirate Code is BH05638109A, which is assigned to Elizabeth Swann from Pirates of the Caribbean.