blob: 199e94fe2cb94422d9a70730f7af15fbe2761bce (
plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Aktywator
{
class HandRecord
{
public string[] north;
public string[] east;
public string[] south;
public string[] west;
public int[] hpcs;
public HandRecord()
{
north = new string[4];
east = new string[4];
south = new string[4];
west = new string[4];
}
private int _hpcFromHand(string hand)
{
int hpc = 0;
foreach (char c in hand)
{
if (c == 'a' || c == 'A')
{
hpc += 4;
}
if (c == 'k' || c == 'K')
{
hpc += 3;
}
if (c == 'q' || c == 'Q')
{
hpc += 2;
}
if (c == 'j' || c == 'J')
{
hpc += 1;
}
}
return hpc;
}
public HandRecord(string pbnString)
{
string[] hand = pbnString.Split(' ');
north = hand[0].Split('.');
east = hand[1].Split('.');
south = hand[2].Split('.');
west = hand[3].Split('.');
hpcs = new int[4];
for (int i = 0; i < 4; i++)
{
hpcs[i] = this._hpcFromHand(hand[i]);
}
}
}
}
|