Make a decision based on a 2d matrix

So, I'm making a Black jack simulator. I've generated the deck, shuffled it, dealt the cards, checked for 21 and now I need to program the AI player's choice.

The AI player's decision shall be based on Basic Strategy (basically making the correct choice mathematically) according to this chart: http://www.blackjackinfo.com/bjbse.php .

What would be the best way to do this? I started using IF and SWITCH, but I'm not sure that's the best way. I've only written the decisions for splittable cards (bottom 10 of 30 on the chart), and it's already getting unmanageable.

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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
	int dealer_upcard = hands[1].cards[0].value;

	//First check for double cards
	if ((hands[0].cards.size() == 2) && (hands[0].cards[0].rank==hands[0].cards[1].rank)){
		int split_value = hands[0].cards[0].value;

		switch(split_value){
			case 0:
				choice_split();
				break;
			case 2:
			case 3:
				switch(dealer_upcard){
					case 2:
					case 3:
					case 4:
					case 5:
					case 6:
					case 7:
						choice_split();
						break;
					case 8:
					case 9:
					case 10:
					case 0:
						choice_hit();
						break;
				}
			break;
			case 4:
				switch(dealer_upcard){
					case 0:
					case 2:
					case 3:
					case 4:
					case 7:
					case 8:
					case 9:
					case 10:
						choice_hit();
						break;
					case 5:
					case 6:
						choice_split();
						break;
				}
			break;
			case 5:
				switch(dealer_upcard){
					case 2:
					case 3:
					case 4:
					case 5:
					case 6:
					case 7:
					case 8:
					case 9:
						choice_double();
						break;
					case 10:
					case 0:
						choice_hit();
						break;
				}
				break;
			case 6:
				switch(dealer_upcard){
					case 2:
					case 3:
					case 4:
					case 5:
					case 6:
						choice_split();
						break;
					case 7:
					case 8:
					case 9:
					case 10:
					case 0:
						choice_hit();
						break;
				}
				break;
			case 7:
				switch(dealer_upcard){
					case 2:
					case 3:
					case 4:
					case 5:
					case 6:
					case 7:
						choice_split();
						break;
					case 8:
					case 9:
					case 10:
					case 0:
						choice_hit();
						break;
					}
				break;
			case 8:
				choice_split();
				break;
			case 9:
				switch(dealer_upcard){
					case 2:
					case 3:
					case 4:
					case 5:
					case 6:
					case 8:
					case 9:
						choice_split();
						break;
					case 7:
					case 10:
					case 0:
						choice_stand();
						break;
					}
				break;
			case 10:
				choice_stand();
				break;
		}
	}


I was thinking that using vectors inside vectors might be a better choice, but that might be even more unreadable.

What is the correct method?
Topic archived. No new replies allowed.