1
/* test-ai.c generated by valac 0.26.0.30-a52f5a, the Vala compiler
2
* generated from test-ai.vala, do not modify */
4
/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
6
* Copyright © 2014 Michael Catanzaro
7
* Copyright © 2014 Nikhar Agrawal
9
* This file is part of Four-in-a-row.
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.
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.
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/>.
26
#include <glib-object.h>
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))
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);
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);
92
void test_horizontal_win (void) {
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"
117
void test_vertical_win (void) {
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"
142
void test_forward_diagonal_win (void) {
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"
167
void test_backward_diagonal_win (void) {
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"
192
void test_avoid_vertical_loss (void) {
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"
217
void test_avoid_forward_diagonal_loss (void) {
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"
242
void test_avoid_backward_diagonal_loss (void) {
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"
267
void test_avoid_horizontal_loss (void) {
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"
292
void test_draw (void) {
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"
317
void test_random (void) {
320
gboolean _tmp1_ = FALSE;
323
gboolean _tmp5_ = FALSE;
326
gboolean _tmp9_ = FALSE;
329
gboolean _tmp13_ = FALSE;
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"
335
#line 115 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
337
#line 115 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
339
#line 340 "test-ai.c"
341
#line 115 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
347
#line 115 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
349
#line 350 "test-ai.c"
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"
357
#line 118 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
359
#line 118 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
361
#line 362 "test-ai.c"
363
#line 118 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
369
#line 118 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
371
#line 372 "test-ai.c"
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"
379
#line 121 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
381
#line 121 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
383
#line 384 "test-ai.c"
385
#line 121 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
391
#line 121 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
393
#line 394 "test-ai.c"
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"
401
#line 124 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
403
#line 124 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
405
#line 406 "test-ai.c"
407
#line 124 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
413
#line 124 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
415
#line 416 "test-ai.c"
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"
423
gint test_ai_vs_ai (const gchar* easier, const gchar* harder) {
425
gint easier_wins = 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"
434
#line 131 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
436
#line 132 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
438
#line 439 "test-ai.c"
441
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
443
#line 444 "test-ai.c"
445
gboolean _tmp0_ = FALSE;
446
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
448
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
450
#line 451 "test-ai.c"
453
GString* _tmp3_ = NULL;
454
GString* _tmp4_ = NULL;
455
const gchar* _tmp5_ = 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"
462
#line 463 "test-ai.c"
464
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
466
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
468
#line 469 "test-ai.c"
470
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
472
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
478
#line 479 "test-ai.c"
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"
484
#line 137 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
486
#line 137 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
494
#line 140 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
496
#line 140 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
502
#line 503 "test-ai.c"
504
DecisionTree* t = NULL;
505
DecisionTree* _tmp9_ = NULL;
506
DecisionTree* _tmp10_ = NULL;
507
GString* _tmp11_ = NULL;
508
const gchar* _tmp12_ = NULL;
512
GString* _tmp18_ = NULL;
513
GString* _tmp19_ = NULL;
514
const gchar* _tmp20_ = NULL;
518
gchar* _tmp24_ = NULL;
519
gchar* _tmp25_ = NULL;
520
GString* _tmp26_ = NULL;
521
GString* _tmp27_ = NULL;
522
const gchar* _tmp28_ = NULL;
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;
536
GString* _tmp43_ = NULL;
537
GString* _tmp44_ = NULL;
538
const gchar* _tmp45_ = NULL;
542
gchar* _tmp49_ = NULL;
543
gchar* _tmp50_ = NULL;
544
GString* _tmp51_ = NULL;
545
GString* _tmp52_ = NULL;
546
const gchar* _tmp53_ = NULL;
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"
556
#line 146 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
558
#line 146 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
566
#line 147 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
568
#line 147 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
570
#line 571 "test-ai.c"
572
#line 149 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
574
#line 149 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
580
#line 581 "test-ai.c"
582
#line 153 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
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"
596
#line 597 "test-ai.c"
598
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
600
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
608
#line 159 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
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"
618
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
620
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
628
#line 160 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
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"
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"
642
#line 163 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
644
#line 163 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
652
#line 165 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
654
#line 165 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
656
#line 657 "test-ai.c"
658
#line 167 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
660
#line 167 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
668
#line 669 "test-ai.c"
670
#line 171 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
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"
686
#line 687 "test-ai.c"
688
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
690
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
698
#line 176 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
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"
708
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
710
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
718
#line 177 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
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"
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"
734
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
736
#line 134 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
738
#line 739 "test-ai.c"
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"
746
#line 747 "test-ai.c"
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;
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"
762
#line 187 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
772
#line 773 "test-ai.c"
773
gboolean _tmp3_ = FALSE;
776
const gchar* _tmp8_ = NULL;
777
const gchar* _tmp9_ = NULL;
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"
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"
795
#line 190 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
797
#line 798 "test-ai.c"
799
#line 190 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
801
#line 190 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
803
#line 804 "test-ai.c"
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"
809
#line 192 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
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"
827
#line 185 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
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"
836
void test_easy_vs_medium (void) {
838
gint games_contested = 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"
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"
853
void test_easy_vs_hard (void) {
855
gint games_contested = 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"
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"
870
void test_medium_vs_hard (void) {
871
gint medium_wins = 0;
872
gint games_contested = 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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
964
static void _test_draw_gcallback (void) {
965
#line 238 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
967
#line 968 "test-ai.c"
971
static void _test_random_gcallback (void) {
972
#line 239 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
974
#line 975 "test-ai.c"
978
gint _vala_main (gchar** args, int args_length1) {
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"
1013
#line 240 "/home/mcatanzaro/jhbuild/checkout/four-in-a-row/src/test-ai.vala"
1015
#line 1016 "test-ai.c"
1019
int main (int argc, char ** argv) {
1020
#if !GLIB_CHECK_VERSION (2,35,0)
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"