commit | author | age
|
2d8187
|
1 |
package net.jacekk.bridge; |
JK |
2 |
|
|
3 |
public class BridgeInput { |
ae5f07
|
4 |
public enum Suit { |
JK |
5 |
MINOR(0), MAJOR(1), NOTRUMP(2); |
|
6 |
|
|
7 |
public final int tableIndex; |
|
8 |
|
|
9 |
Suit(int tableIndex) { |
|
10 |
this.tableIndex = tableIndex; |
|
11 |
} |
|
12 |
} |
|
13 |
|
|
14 |
public enum Contract { |
|
15 |
NORMAL(1, 0), DOUBLED(2, 1), REDOUBLED(4, 2); |
|
16 |
|
|
17 |
public final int multiplier; |
|
18 |
public final int tableIndex; |
|
19 |
|
|
20 |
Contract(int multiplier, int tableIndex) { |
|
21 |
this.multiplier = multiplier; |
|
22 |
this.tableIndex = tableIndex; |
|
23 |
} |
|
24 |
} |
|
25 |
|
|
26 |
public int bid; |
|
27 |
public Suit suit; |
|
28 |
public Contract contract; |
|
29 |
public boolean weVulnerable; |
|
30 |
public boolean theyVulnerable; |
|
31 |
public int PC; |
|
32 |
public int tricks; |
|
33 |
|
|
34 |
public String toString() { |
|
35 |
StringBuilder builder = new StringBuilder(); |
|
36 |
builder.append(bid).append(' ').append(suit.name()).append(' '); |
|
37 |
builder.append(contract.name()).append(' '); |
|
38 |
|
|
39 |
if (weVulnerable) |
|
40 |
builder.append('V'); |
|
41 |
else |
|
42 |
builder.append('N'); |
|
43 |
if (theyVulnerable) |
|
44 |
builder.append('V'); |
|
45 |
else |
|
46 |
builder.append('N'); |
|
47 |
builder.append(' '); |
|
48 |
builder.append(PC).append("PC, tricks: ").append(tricks); |
|
49 |
return builder.toString(); |
|
50 |
} |
2d8187
|
51 |
} |