bloodtype.go 1002 Bytes
Newer Older
Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package blood

// Enumeration of blood types. The 'n'-suffix means negative and 'p'-suffix means positive.
const (
	Type_On  = 0
	Type_Op  = 1
	Type_An  = 2
	Type_Ap  = 3
	Type_Bn  = 4
	Type_Bp  = 5
	Type_ABn = 6
	Type_ABp = 7
)

var Names []string = []string{"O-", "O+", "A-", "A+", "B-", "B+", "AB-", "AB+"}

// BloodTable contains the blood type compatibility truth table. Rows are the
// recipient's blood type and the columns are the donor's blood type.
//
// The table contains bools, since we compute a boolean function. Duh!
var Table = [][]bool{
	{true, false, false, false, false, false, false, false},
	{true, true, false, false, false, false, false, false},
	{true, false, true, false, false, false, false, false},
	{true, true, true, true, false, false, false, false},
	{true, false, false, false, true, false, false, false},
	{true, true, false, false, true, true, false, false},
	{true, false, true, false, true, false, true, false},
	{true, true, true, true, true, true, true, true},
}