~noskcaj/ubuntu/vivid/four-in-a-row/3.14.2

« back to all changes in this revision

Viewing changes to src/test-ai.c

  • Committer: Jackson Doak
  • Date: 2014-11-21 21:52:51 UTC
  • mfrom: (1.1.3)
  • Revision ID: noskcaj@ubuntu.com-20141121215251-jbqgpp0gc8lwmmsw
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* test-ai.c generated by valac 0.26.0.30-a52f5a, the Vala compiler
 
2
 * generated from test-ai.vala, do not modify */
 
3
 
 
4
/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 
5
 *
 
6
 * Copyright © 2014 Michael Catanzaro
 
7
 * Copyright © 2014 Nikhar Agrawal
 
8
 *
 
9
 * This file is part of Four-in-a-row.
 
10
 *
 
11
 * Four-in-a-row is free software: you can redistribute it and/or modify
 
12
 * it under the terms of the GNU General Public License as published by
 
13
 * the Free Software Foundation, either version 2 of the License, or
 
14
 * (at your option) any later version.
 
15
 *
 
16
 * Four-in-a-row is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
 * GNU General Public License for more details.
 
20
 *
 
21
 * You should have received a copy of the GNU General Public License
 
22
 * along with Four-in-a-row.  If not, see <http://www.gnu.org/licenses/>.
 
23
 */
 
24
 
 
25
#include <glib.h>
 
26
#include <glib-object.h>
 
27
#include <stdlib.h>
 
28
#include <string.h>
 
29
 
 
30
 
 
31
#define TYPE_DECISION_TREE (decision_tree_get_type ())
 
32
#define DECISION_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DECISION_TREE, DecisionTree))
 
33
#define DECISION_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DECISION_TREE, DecisionTreeClass))
 
34
#define IS_DECISION_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DECISION_TREE))
 
35
#define IS_DECISION_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DECISION_TREE))
 
36
#define DECISION_TREE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DECISION_TREE, DecisionTreeClass))
 
37
 
 
38
typedef struct _DecisionTree DecisionTree;
 
39
typedef struct _DecisionTreeClass DecisionTreeClass;
 
40
#define _decision_tree_unref0(var) ((var == NULL) ? NULL : (var = (decision_tree_unref (var), NULL)))
 
41
#define _g_free0(var) (var = (g_free (var), NULL))
 
42
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
 
43
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
 
44
 
 
45
 
 
46
 
 
47
#define NUMBER_GAMES 5
 
48
#define MAXIMUM_GAMES 100
 
49
#define THRESHOLD_DENOMINATOR 4
 
50
void test_horizontal_win (void);
 
51
gint playgame (const gchar* moves_until_now);
 
52
void test_vertical_win (void);
 
53
void test_forward_diagonal_win (void);
 
54
void test_backward_diagonal_win (void);
 
55
void test_avoid_vertical_loss (void);
 
56
void test_avoid_forward_diagonal_loss (void);
 
57
void test_avoid_backward_diagonal_loss (void);
 
58
void test_avoid_horizontal_loss (void);
 
59
void test_draw (void);
 
60
void test_random (void);
 
61
gint test_ai_vs_ai (const gchar* easier, const gchar* harder);
 
62
gpointer decision_tree_ref (gpointer instance);
 
63
void decision_tree_unref (gpointer instance);
 
64
GParamSpec* param_spec_decision_tree (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
 
65
void value_set_decision_tree (GValue* value, gpointer v_object);
 
66
void value_take_decision_tree (GValue* value, gpointer v_object);
 
67
gpointer value_get_decision_tree (const GValue* value);
 
68
GType decision_tree_get_type (void) G_GNUC_CONST;
 
69
DecisionTree* decision_tree_new (void);
 
70
DecisionTree* decision_tree_construct (GType object_type);
 
71
gint decision_tree_playandcheck (DecisionTree* self, const gchar* vstr);
 
72
void repeat_contests (const gchar* easier, const gchar* harder, gint* games_contested, gint* easy_wins);
 
73
void test_easy_vs_medium (void);
 
74
void test_easy_vs_hard (void);
 
75
void test_medium_vs_hard (void);
 
76
gint _vala_main (gchar** args, int args_length1);
 
77
static void _test_horizontal_win_gcallback (void);
 
78
static void _test_vertical_win_gcallback (void);
 
79
static void _test_forward_diagonal_win_gcallback (void);
 
80
static void _test_backward_diagonal_win_gcallback (void);
 
81
static void _test_avoid_horizontal_loss_gcallback (void);
 
82
static void _test_avoid_vertical_loss_gcallback (void);
 
83
static void _test_avoid_forward_diagonal_loss_gcallback (void);
 
84
static void _test_avoid_backward_diagonal_loss_gcallback (void);
 
85
static void _test_easy_vs_medium_gcallback (void);
 
86
static void _test_easy_vs_hard_gcallback (void);
 
87
static void _test_medium_vs_hard_gcallback (void);
 
88
static void _test_draw_gcallback (void);
 
89
static void _test_random_gcallback (void);
 
90
 
 
91
 
 
92
void test_horizontal_win (void) {
 
93
        gint _tmp0_ = 0;
 
94
        gint _tmp1_ = 0;
 
95
        gint _tmp2_ = 0;
 
96
        gint _tmp3_ = 0;
 
97
#line 31 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
98
        _tmp0_ = playgame ("a1727370");
 
99
#line 31 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
100
        _vala_assert (_tmp0_ == 4, "playgame (\"a1727370\") == 4");
 
101
#line 32 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
102
        _tmp1_ = playgame ("a7315651311324420");
 
103
#line 32 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
104
        _vala_assert (_tmp1_ == 6, "playgame (\"a7315651311324420\") == 6");
 
105
#line 33 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
106
        _tmp2_ = playgame ("a232225657223561611133440");
 
107
#line 33 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
108
        _vala_assert (_tmp2_ == 4, "playgame (\"a232225657223561611133440\") == 4");
 
109
#line 34 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
110
        _tmp3_ = playgame ("a242215322574255543341746677453337710");
 
111
#line 34 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
112
        _vala_assert (_tmp3_ == 1, "playgame (\"a242215322574255543341746677453337710\") == 1");
 
113
#line 114 "test-ai.c"
 
114
}
 
115
 
 
116
 
 
117
void test_vertical_win (void) {
 
118
        gint _tmp0_ = 0;
 
119
        gint _tmp1_ = 0;
 
120
        gint _tmp2_ = 0;
 
121
        gint _tmp3_ = 0;
 
122
#line 40 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
123
        _tmp0_ = playgame ("a1213140");
 
124
#line 40 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
125
        _vala_assert (_tmp0_ == 1, "playgame (\"a1213140\") == 1");
 
126
#line 41 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
127
        _tmp1_ = playgame ("a14456535526613130");
 
128
#line 41 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
129
        _vala_assert (_tmp1_ == 1, "playgame (\"a14456535526613130\") == 1");
 
130
#line 42 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
131
        _tmp2_ = playgame ("a432334277752576710");
 
132
#line 42 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
133
        _vala_assert (_tmp2_ == 7, "playgame (\"a432334277752576710\") == 7");
 
134
#line 43 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
135
        _tmp3_ = playgame ("a547477454544323321712116260");
 
136
#line 43 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
137
        _vala_assert (_tmp3_ == 2, "playgame (\"a547477454544323321712116260\") == 2");
 
138
#line 139 "test-ai.c"
 
139
}
 
140
 
 
141
 
 
142
void test_forward_diagonal_win (void) {
 
143
        gint _tmp0_ = 0;
 
144
        gint _tmp1_ = 0;
 
145
        gint _tmp2_ = 0;
 
146
        gint _tmp3_ = 0;
 
147
#line 49 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
148
        _tmp0_ = playgame ("a54221164712446211622157570");
 
149
#line 49 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
150
        _vala_assert (_tmp0_ == 7, "playgame (\"a54221164712446211622157570\") == 7");
 
151
#line 50 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
152
        _tmp1_ = playgame ("a4256424426621271412117175776343330");
 
153
#line 50 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
154
        _vala_assert (_tmp1_ == 3, "playgame (\"a4256424426621271412117175776343330\") == 3");
 
155
#line 51 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
156
        _tmp2_ = playgame ("a132565522322662666775443351131113540");
 
157
#line 51 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
158
        _vala_assert (_tmp2_ == 4, "playgame (\"a132565522322662666775443351131113540\") == 4");
 
159
#line 52 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
160
        _tmp3_ = playgame ("a4571311334541225544112245262577767733360");
 
161
#line 52 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
162
        _vala_assert (_tmp3_ == 6, "playgame (\"a4571311334541225544112245262577767733360\") == 6");
 
163
#line 164 "test-ai.c"
 
164
}
 
165
 
 
166
 
 
167
void test_backward_diagonal_win (void) {
 
168
        gint _tmp0_ = 0;
 
169
        gint _tmp1_ = 0;
 
170
        gint _tmp2_ = 0;
 
171
        gint _tmp3_ = 0;
 
172
#line 58 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
173
        _tmp0_ = playgame ("5422327343142110");
 
174
#line 58 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
175
        _vala_assert (_tmp0_ == 1, "playgame (\"5422327343142110\") == 1");
 
176
#line 59 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
177
        _tmp1_ = playgame ("a1415113315143220");
 
178
#line 59 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
179
        _vala_assert (_tmp1_ == 2, "playgame (\"a1415113315143220\") == 2");
 
180
#line 60 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
181
        _tmp2_ = playgame ("a547323452213345110");
 
182
#line 60 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
183
        _vala_assert (_tmp2_ == 1, "playgame (\"a547323452213345110\") == 1");
 
184
#line 61 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
185
        _tmp3_ = playgame ("a4256424426621271412117175776343330");
 
186
#line 61 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
187
        _vala_assert (_tmp3_ == 3, "playgame (\"a4256424426621271412117175776343330\") == 3");
 
188
#line 189 "test-ai.c"
 
189
}
 
190
 
 
191
 
 
192
void test_avoid_vertical_loss (void) {
 
193
        gint _tmp0_ = 0;
 
194
        gint _tmp1_ = 0;
 
195
        gint _tmp2_ = 0;
 
196
        gint _tmp3_ = 0;
 
197
#line 68 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
198
        _tmp0_ = playgame ("a42563117273430");
 
199
#line 68 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
200
        _vala_assert (_tmp0_ == 3, "playgame (\"a42563117273430\") == 3");
 
201
#line 69 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
202
        _tmp1_ = playgame ("a3642571541322340");
 
203
#line 69 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
204
        _vala_assert (_tmp1_ == 4, "playgame (\"a3642571541322340\") == 4");
 
205
#line 70 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
206
        _tmp2_ = playgame ("a144566264475171137750");
 
207
#line 70 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
208
        _vala_assert (_tmp2_ == 5, "playgame (\"a144566264475171137750\") == 5");
 
209
#line 71 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
210
        _tmp3_ = playgame ("a54747745454432332171210");
 
211
#line 71 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
212
        _vala_assert (_tmp3_ == 1, "playgame (\"a54747745454432332171210\") == 1");
 
213
#line 214 "test-ai.c"
 
214
}
 
215
 
 
216
 
 
217
void test_avoid_forward_diagonal_loss (void) {
 
218
        gint _tmp0_ = 0;
 
219
        gint _tmp1_ = 0;
 
220
        gint _tmp2_ = 0;
 
221
        gint _tmp3_ = 0;
 
222
#line 77 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
223
        _tmp0_ = playgame ("a34256477331566570");
 
224
#line 77 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
225
        _vala_assert (_tmp0_ == 7, "playgame (\"a34256477331566570\") == 7");
 
226
#line 78 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
227
        _tmp1_ = playgame ("a1445662644751711370");
 
228
#line 78 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
229
        _vala_assert (_tmp1_ == 7, "playgame (\"a1445662644751711370\") == 7");
 
230
#line 79 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
231
        _tmp2_ = playgame ("a43442235372115113340");
 
232
#line 79 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
233
        _vala_assert (_tmp2_ == 4, "playgame (\"a43442235372115113340\") == 4");
 
234
#line 80 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
235
        _tmp3_ = playgame ("a4143525567766443543125411170");
 
236
#line 80 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
237
        _vala_assert (_tmp3_ == 7, "playgame (\"a4143525567766443543125411170\") == 7");
 
238
#line 239 "test-ai.c"
 
239
}
 
240
 
 
241
 
 
242
void test_avoid_backward_diagonal_loss (void) {
 
243
        gint _tmp0_ = 0;
 
244
        gint _tmp1_ = 0;
 
245
        gint _tmp2_ = 0;
 
246
        gint _tmp3_ = 0;
 
247
#line 86 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
248
        _tmp0_ = playgame ("a47465234222530");
 
249
#line 86 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
250
        _vala_assert (_tmp0_ == 3, "playgame (\"a47465234222530\") == 3");
 
251
#line 87 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
252
        _tmp1_ = playgame ("a4344223537211510");
 
253
#line 87 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
254
        _vala_assert (_tmp1_ == 1, "playgame (\"a4344223537211510\") == 1");
 
255
#line 88 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
256
        _tmp2_ = playgame ("a4141311525513520");
 
257
#line 88 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
258
        _vala_assert (_tmp2_ == 2, "playgame (\"a4141311525513520\") == 2");
 
259
#line 89 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
260
        _tmp3_ = playgame ("a1445662644751711377553330");
 
261
#line 89 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
262
        _vala_assert (_tmp3_ == 3, "playgame (\"a1445662644751711377553330\") == 3");
 
263
#line 264 "test-ai.c"
 
264
}
 
265
 
 
266
 
 
267
void test_avoid_horizontal_loss (void) {
 
268
        gint _tmp0_ = 0;
 
269
        gint _tmp1_ = 0;
 
270
        gint _tmp2_ = 0;
 
271
        gint _tmp3_ = 0;
 
272
#line 96 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
273
        _tmp0_ = playgame ("a445360");
 
274
#line 96 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
275
        _vala_assert (_tmp0_ == 7, "playgame (\"a445360\") == 7");
 
276
#line 97 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
277
        _tmp1_ = playgame ("a745534131117114777720");
 
278
#line 97 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
279
        _vala_assert (_tmp1_ == 2, "playgame (\"a745534131117114777720\") == 2");
 
280
#line 98 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
281
        _tmp2_ = playgame ("a243466431217112323350");
 
282
#line 98 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
283
        _vala_assert (_tmp2_ == 5, "playgame (\"a243466431217112323350\") == 5");
 
284
#line 99 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
285
        _tmp3_ = playgame ("a24147356465355111336631615240");
 
286
#line 99 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
287
        _vala_assert (_tmp3_ == 4, "playgame (\"a24147356465355111336631615240\") == 4");
 
288
#line 289 "test-ai.c"
 
289
}
 
290
 
 
291
 
 
292
void test_draw (void) {
 
293
        gint _tmp0_ = 0;
 
294
        gint _tmp1_ = 0;
 
295
        gint _tmp2_ = 0;
 
296
        gint _tmp3_ = 0;
 
297
#line 105 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
298
        _tmp0_ = playgame ("a1311313113652226667224247766737374455445550");
 
299
#line 105 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
300
        _vala_assert (_tmp0_ == 0, "playgame (\"a1311313113652226667224247766737374455445550\") == 0");
 
301
#line 106 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
302
        _tmp1_ = playgame ("a6121151135432322433425566474425617635677770");
 
303
#line 106 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
304
        _vala_assert (_tmp1_ == 0, "playgame (\"a6121151135432322433425566474425617635677770\") == 0");
 
305
#line 107 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
306
        _tmp2_ = playgame ("a4226111412113275256335534443264375577676670");
 
307
#line 107 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
308
        _vala_assert (_tmp2_ == 0, "playgame (\"a4226111412113275256335534443264375577676670\") == 0");
 
309
#line 108 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
310
        _tmp3_ = playgame ("a4212116575717754775221133434432366655342660");
 
311
#line 108 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
312
        _vala_assert (_tmp3_ == 0, "playgame (\"a4212116575717754775221133434432366655342660\") == 0");
 
313
#line 314 "test-ai.c"
 
314
}
 
315
 
 
316
 
 
317
void test_random (void) {
 
318
        gint x = 0;
 
319
        gint _tmp0_ = 0;
 
320
        gboolean _tmp1_ = FALSE;
 
321
        gint _tmp2_ = 0;
 
322
        gint _tmp4_ = 0;
 
323
        gboolean _tmp5_ = FALSE;
 
324
        gint _tmp6_ = 0;
 
325
        gint _tmp8_ = 0;
 
326
        gboolean _tmp9_ = FALSE;
 
327
        gint _tmp10_ = 0;
 
328
        gint _tmp12_ = 0;
 
329
        gboolean _tmp13_ = FALSE;
 
330
        gint _tmp14_ = 0;
 
331
#line 114 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
332
        _tmp0_ = playgame ("a443256214350");
 
333
#line 114 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
334
        x = _tmp0_;
 
335
#line 115 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
336
        _tmp2_ = x;
 
337
#line 115 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
338
        if (_tmp2_ >= 1) {
 
339
#line 340 "test-ai.c"
 
340
                gint _tmp3_ = 0;
 
341
#line 115 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
342
                _tmp3_ = x;
 
343
#line 115 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
344
                _tmp1_ = _tmp3_ <= 7;
 
345
#line 346 "test-ai.c"
 
346
        } else {
 
347
#line 115 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
348
                _tmp1_ = FALSE;
 
349
#line 350 "test-ai.c"
 
350
        }
 
351
#line 115 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
352
        _vala_assert (_tmp1_, "x >= 1 && x <= 7");
 
353
#line 117 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
354
        _tmp4_ = playgame ("a241473564653551113366316150");
 
355
#line 117 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
356
        x = _tmp4_;
 
357
#line 118 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
358
        _tmp6_ = x;
 
359
#line 118 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
360
        if (_tmp6_ >= 1) {
 
361
#line 362 "test-ai.c"
 
362
                gint _tmp7_ = 0;
 
363
#line 118 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
364
                _tmp7_ = x;
 
365
#line 118 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
366
                _tmp5_ = _tmp7_ <= 7;
 
367
#line 368 "test-ai.c"
 
368
        } else {
 
369
#line 118 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
370
                _tmp5_ = FALSE;
 
371
#line 372 "test-ai.c"
 
372
        }
 
373
#line 118 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
374
        _vala_assert (_tmp5_, "x >= 1 && x <= 7");
 
375
#line 120 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
376
        _tmp8_ = playgame ("a24357315461711177416622623350");
 
377
#line 120 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
378
        x = _tmp8_;
 
379
#line 121 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
380
        _tmp10_ = x;
 
381
#line 121 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
382
        if (_tmp10_ >= 1) {
 
383
#line 384 "test-ai.c"
 
384
                gint _tmp11_ = 0;
 
385
#line 121 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
386
                _tmp11_ = x;
 
387
#line 121 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
388
                _tmp9_ = _tmp11_ <= 7;
 
389
#line 390 "test-ai.c"
 
390
        } else {
 
391
#line 121 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
392
                _tmp9_ = FALSE;
 
393
#line 394 "test-ai.c"
 
394
        }
 
395
#line 121 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
396
        _vala_assert (_tmp9_, "x >= 1 && x <= 7");
 
397
#line 123 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
398
        _tmp12_ = playgame ("a1445662644751711377553333665775446110");
 
399
#line 123 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
400
        x = _tmp12_;
 
401
#line 124 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
402
        _tmp14_ = x;
 
403
#line 124 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
404
        if (_tmp14_ >= 1) {
 
405
#line 406 "test-ai.c"
 
406
                gint _tmp15_ = 0;
 
407
#line 124 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
408
                _tmp15_ = x;
 
409
#line 124 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
410
                _tmp13_ = _tmp15_ <= 7;
 
411
#line 412 "test-ai.c"
 
412
        } else {
 
413
#line 124 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
414
                _tmp13_ = FALSE;
 
415
#line 416 "test-ai.c"
 
416
        }
 
417
#line 124 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
418
        _vala_assert (_tmp13_, "x >= 1 && x <= 7");
 
419
#line 420 "test-ai.c"
 
420
}
 
421
 
 
422
 
 
423
gint test_ai_vs_ai (const gchar* easier, const gchar* harder) {
 
424
        gint result = 0;
 
425
        gint easier_wins = 0;
 
426
        gint draw = 0;
 
427
        gint harder_wins = 0;
 
428
#line 128 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
429
        g_return_val_if_fail (easier != NULL, 0);
 
430
#line 128 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
431
        g_return_val_if_fail (harder != NULL, 0);
 
432
#line 130 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
433
        easier_wins = 0;
 
434
#line 131 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
435
        draw = 0;
 
436
#line 132 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
437
        harder_wins = 0;
 
438
#line 439 "test-ai.c"
 
439
        {
 
440
                gint i = 0;
 
441
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
442
                i = 0;
 
443
#line 444 "test-ai.c"
 
444
                {
 
445
                        gboolean _tmp0_ = FALSE;
 
446
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
447
                        _tmp0_ = TRUE;
 
448
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
449
                        while (TRUE) {
 
450
#line 451 "test-ai.c"
 
451
                                gint _tmp2_ = 0;
 
452
                                GString* e = NULL;
 
453
                                GString* _tmp3_ = NULL;
 
454
                                GString* _tmp4_ = NULL;
 
455
                                const gchar* _tmp5_ = NULL;
 
456
                                GString* m = NULL;
 
457
                                GString* _tmp6_ = NULL;
 
458
                                GString* _tmp7_ = NULL;
 
459
                                const gchar* _tmp8_ = NULL;
 
460
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
461
                                if (!_tmp0_) {
 
462
#line 463 "test-ai.c"
 
463
                                        gint _tmp1_ = 0;
 
464
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
465
                                        _tmp1_ = i;
 
466
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
467
                                        i = _tmp1_ + 1;
 
468
#line 469 "test-ai.c"
 
469
                                }
 
470
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
471
                                _tmp0_ = FALSE;
 
472
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
473
                                _tmp2_ = i;
 
474
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
475
                                if (!(_tmp2_ < NUMBER_GAMES)) {
 
476
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
477
                                        break;
 
478
#line 479 "test-ai.c"
 
479
                                }
 
480
#line 136 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
481
                                _tmp3_ = g_string_new ("");
 
482
#line 136 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
483
                                e = _tmp3_;
 
484
#line 137 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
485
                                _tmp4_ = e;
 
486
#line 137 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
487
                                _tmp5_ = easier;
 
488
#line 137 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
489
                                g_string_append (_tmp4_, _tmp5_);
 
490
#line 139 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
491
                                _tmp6_ = g_string_new ("");
 
492
#line 139 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
493
                                m = _tmp6_;
 
494
#line 140 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
495
                                _tmp7_ = m;
 
496
#line 140 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
497
                                _tmp8_ = harder;
 
498
#line 140 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
499
                                g_string_append (_tmp7_, _tmp8_);
 
500
#line 142 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
501
                                while (TRUE) {
 
502
#line 503 "test-ai.c"
 
503
                                        gint move = 0;
 
504
                                        DecisionTree* t = NULL;
 
505
                                        DecisionTree* _tmp9_ = NULL;
 
506
                                        DecisionTree* _tmp10_ = NULL;
 
507
                                        GString* _tmp11_ = NULL;
 
508
                                        const gchar* _tmp12_ = NULL;
 
509
                                        gint _tmp13_ = 0;
 
510
                                        gint _tmp14_ = 0;
 
511
                                        gint _tmp16_ = 0;
 
512
                                        GString* _tmp18_ = NULL;
 
513
                                        GString* _tmp19_ = NULL;
 
514
                                        const gchar* _tmp20_ = NULL;
 
515
                                        gint _tmp21_ = 0;
 
516
                                        gint _tmp22_ = 0;
 
517
                                        gint _tmp23_ = 0;
 
518
                                        gchar* _tmp24_ = NULL;
 
519
                                        gchar* _tmp25_ = NULL;
 
520
                                        GString* _tmp26_ = NULL;
 
521
                                        GString* _tmp27_ = NULL;
 
522
                                        const gchar* _tmp28_ = NULL;
 
523
                                        gint _tmp29_ = 0;
 
524
                                        gint _tmp30_ = 0;
 
525
                                        gint _tmp31_ = 0;
 
526
                                        gchar* _tmp32_ = NULL;
 
527
                                        gchar* _tmp33_ = NULL;
 
528
                                        DecisionTree* d = NULL;
 
529
                                        DecisionTree* _tmp34_ = NULL;
 
530
                                        DecisionTree* _tmp35_ = NULL;
 
531
                                        GString* _tmp36_ = NULL;
 
532
                                        const gchar* _tmp37_ = NULL;
 
533
                                        gint _tmp38_ = 0;
 
534
                                        gint _tmp39_ = 0;
 
535
                                        gint _tmp41_ = 0;
 
536
                                        GString* _tmp43_ = NULL;
 
537
                                        GString* _tmp44_ = NULL;
 
538
                                        const gchar* _tmp45_ = NULL;
 
539
                                        gint _tmp46_ = 0;
 
540
                                        gint _tmp47_ = 0;
 
541
                                        gint _tmp48_ = 0;
 
542
                                        gchar* _tmp49_ = NULL;
 
543
                                        gchar* _tmp50_ = NULL;
 
544
                                        GString* _tmp51_ = NULL;
 
545
                                        GString* _tmp52_ = NULL;
 
546
                                        const gchar* _tmp53_ = NULL;
 
547
                                        gint _tmp54_ = 0;
 
548
                                        gint _tmp55_ = 0;
 
549
                                        gint _tmp56_ = 0;
 
550
                                        gchar* _tmp57_ = NULL;
 
551
                                        gchar* _tmp58_ = NULL;
 
552
#line 145 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
553
                                        _tmp9_ = decision_tree_new ();
 
554
#line 145 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
555
                                        t = _tmp9_;
 
556
#line 146 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
557
                                        _tmp10_ = t;
 
558
#line 146 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
559
                                        _tmp11_ = e;
 
560
#line 146 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
561
                                        _tmp12_ = _tmp11_->str;
 
562
#line 146 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
563
                                        _tmp13_ = decision_tree_playandcheck (_tmp10_, _tmp12_);
 
564
#line 146 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
565
                                        move = _tmp13_;
 
566
#line 147 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
567
                                        _tmp14_ = move;
 
568
#line 147 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
569
                                        if (_tmp14_ == 0) {
 
570
#line 571 "test-ai.c"
 
571
                                                gint _tmp15_ = 0;
 
572
#line 149 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
573
                                                _tmp15_ = draw;
 
574
#line 149 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
575
                                                draw = _tmp15_ + 1;
 
576
#line 150 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
577
                                                _decision_tree_unref0 (t);
 
578
#line 150 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
579
                                                break;
 
580
#line 581 "test-ai.c"
 
581
                                        }
 
582
#line 153 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
583
                                        _tmp16_ = move;
 
584
#line 153 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
585
                                        if (_tmp16_ == 1000) {
 
586
#line 587 "test-ai.c"
 
587
                                                gint _tmp17_ = 0;
 
588
#line 155 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
589
                                                _tmp17_ = easier_wins;
 
590
#line 155 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
591
                                                easier_wins = _tmp17_ + 1;
 
592
#line 156 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
593
                                                _decision_tree_unref0 (t);
 
594
#line 156 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
595
                                                break;
 
596
#line 597 "test-ai.c"
 
597
                                        }
 
598
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
599
                                        _tmp18_ = e;
 
600
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
601
                                        _tmp19_ = e;
 
602
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
603
                                        _tmp20_ = _tmp19_->str;
 
604
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
605
                                        _tmp21_ = strlen (_tmp20_);
 
606
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
607
                                        _tmp22_ = _tmp21_;
 
608
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
609
                                        _tmp23_ = move;
 
610
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
611
                                        _tmp24_ = g_strdup_printf ("%i", _tmp23_);
 
612
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
613
                                        _tmp25_ = _tmp24_;
 
614
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
615
                                        g_string_insert (_tmp18_, (gssize) (_tmp22_ - 1), _tmp25_);
 
616
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
617
                                        _g_free0 (_tmp25_);
 
618
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
619
                                        _tmp26_ = m;
 
620
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
621
                                        _tmp27_ = m;
 
622
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
623
                                        _tmp28_ = _tmp27_->str;
 
624
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
625
                                        _tmp29_ = strlen (_tmp28_);
 
626
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
627
                                        _tmp30_ = _tmp29_;
 
628
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
629
                                        _tmp31_ = move;
 
630
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
631
                                        _tmp32_ = g_strdup_printf ("%i", _tmp31_);
 
632
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
633
                                        _tmp33_ = _tmp32_;
 
634
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
635
                                        g_string_insert (_tmp26_, (gssize) (_tmp30_ - 1), _tmp33_);
 
636
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
637
                                        _g_free0 (_tmp33_);
 
638
#line 162 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
639
                                        _tmp34_ = decision_tree_new ();
 
640
#line 162 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
641
                                        d = _tmp34_;
 
642
#line 163 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
643
                                        _tmp35_ = d;
 
644
#line 163 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
645
                                        _tmp36_ = m;
 
646
#line 163 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
647
                                        _tmp37_ = _tmp36_->str;
 
648
#line 163 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
649
                                        _tmp38_ = decision_tree_playandcheck (_tmp35_, _tmp37_);
 
650
#line 163 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
651
                                        move = _tmp38_;
 
652
#line 165 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
653
                                        _tmp39_ = move;
 
654
#line 165 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
655
                                        if (_tmp39_ == 0) {
 
656
#line 657 "test-ai.c"
 
657
                                                gint _tmp40_ = 0;
 
658
#line 167 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
659
                                                _tmp40_ = draw;
 
660
#line 167 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
661
                                                draw = _tmp40_ + 1;
 
662
#line 168 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
663
                                                _decision_tree_unref0 (d);
 
664
#line 168 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
665
                                                _decision_tree_unref0 (t);
 
666
#line 168 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
667
                                                break;
 
668
#line 669 "test-ai.c"
 
669
                                        }
 
670
#line 171 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
671
                                        _tmp41_ = move;
 
672
#line 171 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
673
                                        if (_tmp41_ == 1000) {
 
674
#line 675 "test-ai.c"
 
675
                                                gint _tmp42_ = 0;
 
676
#line 173 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
677
                                                _tmp42_ = harder_wins;
 
678
#line 173 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
679
                                                harder_wins = _tmp42_ + 1;
 
680
#line 174 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
681
                                                _decision_tree_unref0 (d);
 
682
#line 174 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
683
                                                _decision_tree_unref0 (t);
 
684
#line 174 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
685
                                                break;
 
686
#line 687 "test-ai.c"
 
687
                                        }
 
688
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
689
                                        _tmp43_ = e;
 
690
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
691
                                        _tmp44_ = e;
 
692
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
693
                                        _tmp45_ = _tmp44_->str;
 
694
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
695
                                        _tmp46_ = strlen (_tmp45_);
 
696
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
697
                                        _tmp47_ = _tmp46_;
 
698
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
699
                                        _tmp48_ = move;
 
700
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
701
                                        _tmp49_ = g_strdup_printf ("%i", _tmp48_);
 
702
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
703
                                        _tmp50_ = _tmp49_;
 
704
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
705
                                        g_string_insert (_tmp43_, (gssize) (_tmp47_ - 1), _tmp50_);
 
706
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
707
                                        _g_free0 (_tmp50_);
 
708
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
709
                                        _tmp51_ = m;
 
710
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
711
                                        _tmp52_ = m;
 
712
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
713
                                        _tmp53_ = _tmp52_->str;
 
714
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
715
                                        _tmp54_ = strlen (_tmp53_);
 
716
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
717
                                        _tmp55_ = _tmp54_;
 
718
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
719
                                        _tmp56_ = move;
 
720
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
721
                                        _tmp57_ = g_strdup_printf ("%i", _tmp56_);
 
722
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
723
                                        _tmp58_ = _tmp57_;
 
724
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
725
                                        g_string_insert (_tmp51_, (gssize) (_tmp55_ - 1), _tmp58_);
 
726
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
727
                                        _g_free0 (_tmp58_);
 
728
#line 142 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
729
                                        _decision_tree_unref0 (d);
 
730
#line 142 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
731
                                        _decision_tree_unref0 (t);
 
732
#line 733 "test-ai.c"
 
733
                                }
 
734
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
735
                                _g_string_free0 (m);
 
736
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
737
                                _g_string_free0 (e);
 
738
#line 739 "test-ai.c"
 
739
                        }
 
740
                }
 
741
        }
 
742
#line 180 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
743
        result = easier_wins;
 
744
#line 180 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
745
        return result;
 
746
#line 747 "test-ai.c"
 
747
}
 
748
 
 
749
 
 
750
void repeat_contests (const gchar* easier, const gchar* harder, gint* games_contested, gint* easy_wins) {
 
751
        gint _vala_games_contested = 0;
 
752
        gint _vala_easy_wins = 0;
 
753
        const gchar* _tmp0_ = NULL;
 
754
        const gchar* _tmp1_ = NULL;
 
755
        gint _tmp2_ = 0;
 
756
#line 185 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
757
        g_return_if_fail (easier != NULL);
 
758
#line 185 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
759
        g_return_if_fail (harder != NULL);
 
760
#line 187 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
761
        _tmp0_ = easier;
 
762
#line 187 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
763
        _tmp1_ = harder;
 
764
#line 187 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
765
        _tmp2_ = test_ai_vs_ai (_tmp0_, _tmp1_);
 
766
#line 187 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
767
        _vala_easy_wins = _tmp2_;
 
768
#line 188 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
769
        _vala_games_contested = NUMBER_GAMES;
 
770
#line 190 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
771
        while (TRUE) {
 
772
#line 773 "test-ai.c"
 
773
                gboolean _tmp3_ = FALSE;
 
774
                gint _tmp4_ = 0;
 
775
                gint _tmp7_ = 0;
 
776
                const gchar* _tmp8_ = NULL;
 
777
                const gchar* _tmp9_ = NULL;
 
778
                gint _tmp10_ = 0;
 
779
                gint _tmp11_ = 0;
 
780
#line 190 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
781
                _tmp4_ = _vala_games_contested;
 
782
#line 190 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
783
                if (_tmp4_ <= MAXIMUM_GAMES) {
 
784
#line 785 "test-ai.c"
 
785
                        gint _tmp5_ = 0;
 
786
                        gint _tmp6_ = 0;
 
787
#line 190 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
788
                        _tmp5_ = _vala_easy_wins;
 
789
#line 190 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
790
                        _tmp6_ = _vala_games_contested;
 
791
#line 190 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
792
                        _tmp3_ = _tmp5_ > (_tmp6_ / THRESHOLD_DENOMINATOR);
 
793
#line 794 "test-ai.c"
 
794
                } else {
 
795
#line 190 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
796
                        _tmp3_ = FALSE;
 
797
#line 798 "test-ai.c"
 
798
                }
 
799
#line 190 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
800
                if (!_tmp3_) {
 
801
#line 190 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
802
                        break;
 
803
#line 804 "test-ai.c"
 
804
                }
 
805
#line 192 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
806
                _tmp7_ = _vala_easy_wins;
 
807
#line 192 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
808
                _tmp8_ = easier;
 
809
#line 192 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
810
                _tmp9_ = harder;
 
811
#line 192 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
812
                _tmp10_ = test_ai_vs_ai (_tmp8_, _tmp9_);
 
813
#line 192 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
814
                _vala_easy_wins = _tmp7_ + _tmp10_;
 
815
#line 193 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
816
                _tmp11_ = _vala_games_contested;
 
817
#line 193 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
818
                _vala_games_contested = _tmp11_ + NUMBER_GAMES;
 
819
#line 820 "test-ai.c"
 
820
        }
 
821
#line 185 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
822
        if (games_contested) {
 
823
#line 185 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
824
                *games_contested = _vala_games_contested;
 
825
#line 826 "test-ai.c"
 
826
        }
 
827
#line 185 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
828
        if (easy_wins) {
 
829
#line 185 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
830
                *easy_wins = _vala_easy_wins;
 
831
#line 832 "test-ai.c"
 
832
        }
 
833
}
 
834
 
 
835
 
 
836
void test_easy_vs_medium (void) {
 
837
        gint easy_wins = 0;
 
838
        gint games_contested = 0;
 
839
        gint _tmp0_ = 0;
 
840
        gint _tmp1_ = 0;
 
841
#line 201 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
842
        repeat_contests ("a0", "b0", &_tmp0_, &_tmp1_);
 
843
#line 201 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
844
        games_contested = _tmp0_;
 
845
#line 201 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
846
        easy_wins = _tmp1_;
 
847
#line 203 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
848
        _vala_assert (easy_wins <= (games_contested / THRESHOLD_DENOMINATOR), "easy_wins <= games_contested/THRESHOLD_DENOMINATOR");
 
849
#line 850 "test-ai.c"
 
850
}
 
851
 
 
852
 
 
853
void test_easy_vs_hard (void) {
 
854
        gint easy_wins = 0;
 
855
        gint games_contested = 0;
 
856
        gint _tmp0_ = 0;
 
857
        gint _tmp1_ = 0;
 
858
#line 210 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
859
        repeat_contests ("a0", "c0", &_tmp0_, &_tmp1_);
 
860
#line 210 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
861
        games_contested = _tmp0_;
 
862
#line 210 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
863
        easy_wins = _tmp1_;
 
864
#line 212 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
865
        _vala_assert (easy_wins <= (games_contested / THRESHOLD_DENOMINATOR), "easy_wins <= games_contested/THRESHOLD_DENOMINATOR");
 
866
#line 867 "test-ai.c"
 
867
}
 
868
 
 
869
 
 
870
void test_medium_vs_hard (void) {
 
871
        gint medium_wins = 0;
 
872
        gint games_contested = 0;
 
873
        gint _tmp0_ = 0;
 
874
        gint _tmp1_ = 0;
 
875
#line 219 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
876
        repeat_contests ("b0", "c0", &_tmp0_, &_tmp1_);
 
877
#line 219 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
878
        games_contested = _tmp0_;
 
879
#line 219 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
880
        medium_wins = _tmp1_;
 
881
#line 221 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
882
        _vala_assert (medium_wins <= (games_contested / THRESHOLD_DENOMINATOR), "medium_wins <= games_contested/THRESHOLD_DENOMINATOR");
 
883
#line 884 "test-ai.c"
 
884
}
 
885
 
 
886
 
 
887
static void _test_horizontal_win_gcallback (void) {
 
888
#line 227 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
889
        test_horizontal_win ();
 
890
#line 891 "test-ai.c"
 
891
}
 
892
 
 
893
 
 
894
static void _test_vertical_win_gcallback (void) {
 
895
#line 228 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
896
        test_vertical_win ();
 
897
#line 898 "test-ai.c"
 
898
}
 
899
 
 
900
 
 
901
static void _test_forward_diagonal_win_gcallback (void) {
 
902
#line 229 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
903
        test_forward_diagonal_win ();
 
904
#line 905 "test-ai.c"
 
905
}
 
906
 
 
907
 
 
908
static void _test_backward_diagonal_win_gcallback (void) {
 
909
#line 230 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
910
        test_backward_diagonal_win ();
 
911
#line 912 "test-ai.c"
 
912
}
 
913
 
 
914
 
 
915
static void _test_avoid_horizontal_loss_gcallback (void) {
 
916
#line 231 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
917
        test_avoid_horizontal_loss ();
 
918
#line 919 "test-ai.c"
 
919
}
 
920
 
 
921
 
 
922
static void _test_avoid_vertical_loss_gcallback (void) {
 
923
#line 232 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
924
        test_avoid_vertical_loss ();
 
925
#line 926 "test-ai.c"
 
926
}
 
927
 
 
928
 
 
929
static void _test_avoid_forward_diagonal_loss_gcallback (void) {
 
930
#line 233 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
931
        test_avoid_forward_diagonal_loss ();
 
932
#line 933 "test-ai.c"
 
933
}
 
934
 
 
935
 
 
936
static void _test_avoid_backward_diagonal_loss_gcallback (void) {
 
937
#line 234 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
938
        test_avoid_backward_diagonal_loss ();
 
939
#line 940 "test-ai.c"
 
940
}
 
941
 
 
942
 
 
943
static void _test_easy_vs_medium_gcallback (void) {
 
944
#line 235 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
945
        test_easy_vs_medium ();
 
946
#line 947 "test-ai.c"
 
947
}
 
948
 
 
949
 
 
950
static void _test_easy_vs_hard_gcallback (void) {
 
951
#line 236 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
952
        test_easy_vs_hard ();
 
953
#line 954 "test-ai.c"
 
954
}
 
955
 
 
956
 
 
957
static void _test_medium_vs_hard_gcallback (void) {
 
958
#line 237 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
959
        test_medium_vs_hard ();
 
960
#line 961 "test-ai.c"
 
961
}
 
962
 
 
963
 
 
964
static void _test_draw_gcallback (void) {
 
965
#line 238 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
966
        test_draw ();
 
967
#line 968 "test-ai.c"
 
968
}
 
969
 
 
970
 
 
971
static void _test_random_gcallback (void) {
 
972
#line 239 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
973
        test_random ();
 
974
#line 975 "test-ai.c"
 
975
}
 
976
 
 
977
 
 
978
gint _vala_main (gchar** args, int args_length1) {
 
979
        gint result = 0;
 
980
        gint _tmp0_ = 0;
 
981
#line 226 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
982
        g_test_init (&args_length1, &args, NULL);
 
983
#line 227 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
984
        g_test_add_func ("/AI/Take Win/Horizontal Win", _test_horizontal_win_gcallback);
 
985
#line 228 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
986
        g_test_add_func ("/AI/Take Win/Vertical Win", _test_vertical_win_gcallback);
 
987
#line 229 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
988
        g_test_add_func ("/AI/Take Win/Forward Diagonal Win", _test_forward_diagonal_win_gcallback);
 
989
#line 230 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
990
        g_test_add_func ("/AI/Take Win/Backward Diagonal Win", _test_backward_diagonal_win_gcallback);
 
991
#line 231 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
992
        g_test_add_func ("/AI/Avoid Loss/Horizontal Loss", _test_avoid_horizontal_loss_gcallback);
 
993
#line 232 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
994
        g_test_add_func ("/AI/Avoid Loss/Vertical Loss", _test_avoid_vertical_loss_gcallback);
 
995
#line 233 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
996
        g_test_add_func ("/AI/Avoid Loss/Forward Diagonal Loss", _test_avoid_forward_diagonal_loss_gcallback);
 
997
#line 234 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
998
        g_test_add_func ("/AI/Avoid Loss/Backward Diagonal Loss", _test_avoid_backward_diagonal_loss_gcallback);
 
999
#line 235 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
1000
        g_test_add_func ("/AI/AI vs AI/Easy vs Medium", _test_easy_vs_medium_gcallback);
 
1001
#line 236 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
1002
        g_test_add_func ("/AI/AI vs AI/Easy vs Hard", _test_easy_vs_hard_gcallback);
 
1003
#line 237 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
1004
        g_test_add_func ("/AI/AI vs AI/Medium vs Hard", _test_medium_vs_hard_gcallback);
 
1005
#line 238 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
1006
        g_test_add_func ("/AI/Draw", _test_draw_gcallback);
 
1007
#line 239 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
1008
        g_test_add_func ("/AI/Random", _test_random_gcallback);
 
1009
#line 240 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
1010
        _tmp0_ = g_test_run ();
 
1011
#line 240 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
1012
        result = _tmp0_;
 
1013
#line 240 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
1014
        return result;
 
1015
#line 1016 "test-ai.c"
 
1016
}
 
1017
 
 
1018
 
 
1019
int main (int argc, char ** argv) {
 
1020
#if !GLIB_CHECK_VERSION (2,35,0)
 
1021
        g_type_init ();
 
1022
#endif
 
1023
#line 224 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
 
1024
        return _vala_main (argv, argc);
 
1025
#line 1026 "test-ai.c"
 
1026
}
 
1027
 
 
1028
 
 
1029