~ubuntu-branches/debian/sid/gnome-chess/sid

« back to all changes in this revision

Viewing changes to src/chess-game.c

  • Committer: Package Import Robot
  • Author(s): Luca Falavigna, Jeremy Bicha, Jackson Doak, Luca Falavigna
  • Date: 2014-07-15 21:50:20 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140715215020-rhk7hmpjf5xlntb9
Tags: 1:3.12.3-1
* Team upload.

[ Jeremy Bicha ]
* debian/control.in:
  - Depend on hoichess and demote other chess engines to Suggests
    per upstream recommendation (LP: #138570)
  - Bump minimum intoltool and vala
  - Drop sqlite dependency
* debian/gnome-chess.install:
  - AI configuration file moved to /etc/chess-engines.conf

[ Jackson Doak ]
* New upstream release (3.12.3)

[ Luca Falavigna ]
* debian/control.in:
  - Bump Standards-Version to 3.9.5.
  - Refresh build-dependencies required minimum versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* chess-game.c generated by valac 0.18.1, the Vala compiler
 
1
/* chess-game.c generated by valac 0.24.0.112-bbf5, the Vala compiler
2
2
 * generated from chess-game.vala, do not modify */
3
3
 
 
4
/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 
5
 *
 
6
 * Copyright (C) 2010-2013 Robert Ancell
 
7
 *
 
8
 * This program is free software: you can redistribute it and/or modify it under
 
9
 * the terms of the GNU General Public License as published by the Free Software
 
10
 * Foundation, either version 2 of the License, or (at your option) any later
 
11
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 
12
 * license.
 
13
 */
4
14
 
5
15
#include <glib.h>
6
16
#include <glib-object.h>
93
103
typedef struct _ChessClock ChessClock;
94
104
typedef struct _ChessClockClass ChessClockClass;
95
105
#define __g_list_free__chess_state_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__chess_state_unref0_ (var), NULL)))
96
 
typedef struct _ParamSpecChessGame ParamSpecChessGame;
97
106
 
98
107
typedef enum  {
99
108
        COLOR_WHITE,
207
216
        CHESS_RULE_INSUFFICIENT_MATERIAL,
208
217
        CHESS_RULE_RESIGN,
209
218
        CHESS_RULE_ABANDONMENT,
210
 
        CHESS_RULE_DEATH
 
219
        CHESS_RULE_DEATH,
 
220
        CHESS_RULE_BUG
211
221
} ChessRule;
212
222
 
213
223
typedef enum  {
214
224
        CHESS_RESULT_IN_PROGRESS,
215
225
        CHESS_RESULT_WHITE_WON,
216
226
        CHESS_RESULT_BLACK_WON,
217
 
        CHESS_RESULT_DRAW
 
227
        CHESS_RESULT_DRAW,
 
228
        CHESS_RESULT_BUG
218
229
} ChessResult;
219
230
 
220
231
struct _ParamSpecChessState {
222
233
};
223
234
 
224
235
struct _ChessGame {
225
 
        GTypeInstance parent_instance;
226
 
        volatile int ref_count;
 
236
        GObject parent_instance;
227
237
        ChessGamePrivate * priv;
228
238
        gboolean is_started;
229
239
        ChessResult result;
232
242
};
233
243
 
234
244
struct _ChessGameClass {
235
 
        GTypeClass parent_class;
236
 
        void (*finalize) (ChessGame *self);
 
245
        GObjectClass parent_class;
237
246
};
238
247
 
239
248
struct _ChessGamePrivate {
240
249
        gint hold_count;
 
250
        gboolean _is_paused;
241
251
        ChessClock* _clock;
242
252
};
243
253
 
244
 
struct _ParamSpecChessGame {
245
 
        GParamSpec parent_instance;
246
 
};
247
 
 
248
254
 
249
255
static gpointer chess_player_parent_class = NULL;
250
256
static gpointer chess_piece_parent_class = NULL;
335
341
gboolean chess_state_move (ChessState* self, const gchar* move, gboolean apply);
336
342
static gboolean chess_state_decode_move (ChessState* self, ChessPlayer* player, const gchar* move, gint* r0, gint* f0, gint* r1, gint* f1, PieceType* promotion_type);
337
343
gboolean chess_state_move_with_coords (ChessState* self, ChessPlayer* player, gint r0, gint f0, gint r1, gint f1, PieceType promotion_type, gboolean apply, gboolean test_check);
338
 
static gboolean chess_state_is_in_check (ChessState* self, ChessPlayer* player);
 
344
gboolean chess_state_is_in_check (ChessState* self, ChessPlayer* player);
339
345
GType chess_rule_get_type (void) G_GNUC_CONST;
340
346
GType chess_result_get_type (void) G_GNUC_CONST;
341
347
ChessResult chess_state_get_result (ChessState* self, ChessRule* rule);
344
350
static gboolean chess_state_is_in_checkmate (ChessState* self, ChessPlayer* player);
345
351
ChessPlayer* chess_state_get_opponent (ChessState* self);
346
352
static void chess_state_finalize (ChessState* obj);
347
 
gpointer chess_game_ref (gpointer instance);
348
 
void chess_game_unref (gpointer instance);
349
 
GParamSpec* param_spec_chess_game (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
350
 
void value_set_chess_game (GValue* value, gpointer v_object);
351
 
void value_take_chess_game (GValue* value, gpointer v_object);
352
 
gpointer value_get_chess_game (const GValue* value);
353
353
GType chess_game_get_type (void) G_GNUC_CONST;
354
354
GType chess_clock_get_type (void) G_GNUC_CONST;
355
355
#define CHESS_GAME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_CHESS_GAME, ChessGamePrivate))
356
356
enum  {
357
 
        CHESS_GAME_DUMMY_PROPERTY
 
357
        CHESS_GAME_DUMMY_PROPERTY,
 
358
        CHESS_GAME_IS_PAUSED,
 
359
        CHESS_GAME_CURRENT_STATE,
 
360
        CHESS_GAME_WHITE,
 
361
        CHESS_GAME_BLACK,
 
362
        CHESS_GAME_CURRENT_PLAYER,
 
363
        CHESS_GAME_OPPONENT,
 
364
        CHESS_GAME_CLOCK,
 
365
        CHESS_GAME_N_MOVES
358
366
};
359
367
void chess_clock_stop (ChessClock* self);
360
368
static void _chess_state_unref0_ (gpointer var);
378
386
static void chess_game_complete_move (ChessGame* self);
379
387
void chess_game_add_hold (ChessGame* self);
380
388
void chess_game_remove_hold (ChessGame* self);
381
 
static void chess_game_stop (ChessGame* self, ChessResult _result_, ChessRule rule);
 
389
void chess_game_stop (ChessGame* self, ChessResult _result_, ChessRule rule);
382
390
void chess_clock_set_active_color (ChessClock* self, Color value);
383
391
ChessPlayer* chess_game_get_opponent (ChessGame* self);
384
392
static gboolean chess_game_is_three_fold_repeat (ChessGame* self);
385
393
void chess_game_start (ChessGame* self);
386
394
static void chess_game_clock_expired_cb (ChessGame* self, ChessClock* clock);
387
395
static void _chess_game_clock_expired_cb_chess_clock_expired (ChessClock* _sender, gpointer self);
388
 
void chess_game_abandon (ChessGame* self);
389
396
ChessPiece* chess_game_get_piece (ChessGame* self, gint rank, gint file, gint move_number);
 
397
void chess_game_pause (ChessGame* self);
390
398
ChessClock* chess_game_get_clock (ChessGame* self);
 
399
gboolean chess_game_get_is_paused (ChessGame* self);
 
400
void chess_clock_pause (ChessClock* self);
 
401
static void chess_game_set_is_paused (ChessGame* self, gboolean value);
 
402
void chess_game_unpause (ChessGame* self);
 
403
void chess_clock_unpause (ChessClock* self);
 
404
gint chess_game_state_repeated_times (ChessGame* self, ChessState* s1);
391
405
void chess_game_set_clock (ChessGame* self, ChessClock* value);
392
406
guint chess_game_get_n_moves (ChessGame* self);
393
407
static void g_cclosure_user_marshal_VOID__CHESS_MOVE (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
394
 
static void chess_game_finalize (ChessGame* obj);
 
408
static void chess_game_finalize (GObject* obj);
 
409
static void _vala_chess_game_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
 
410
static void _vala_chess_game_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
395
411
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
396
412
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
397
413
static gint _vala_array_length (gpointer array);
415
431
 
416
432
ChessPlayer* chess_player_construct (GType object_type, Color color) {
417
433
        ChessPlayer * self = NULL;
418
 
        Color _tmp0_;
 
434
        Color _tmp0_ = 0;
419
435
        self = (ChessPlayer*) g_object_new (object_type, NULL);
420
436
        _tmp0_ = color;
421
437
        self->color = _tmp0_;
430
446
 
431
447
gboolean chess_player_move (ChessPlayer* self, const gchar* move, gboolean apply) {
432
448
        gboolean result = FALSE;
433
 
        const gchar* _tmp0_;
434
 
        gboolean _tmp1_;
 
449
        const gchar* _tmp0_ = NULL;
 
450
        gboolean _tmp1_ = FALSE;
435
451
        gboolean _tmp2_ = FALSE;
436
452
        g_return_val_if_fail (self != NULL, FALSE);
437
453
        g_return_val_if_fail (move != NULL, FALSE);
445
461
 
446
462
gboolean chess_player_move_with_coords (ChessPlayer* self, gint r0, gint f0, gint r1, gint f1, gboolean apply, PieceType promotion_type) {
447
463
        gboolean result = FALSE;
448
 
        gint _tmp0_;
449
 
        gint _tmp1_;
450
 
        gint _tmp2_;
451
 
        gint _tmp3_;
 
464
        gchar* move = NULL;
 
465
        gint _tmp0_ = 0;
 
466
        gint _tmp1_ = 0;
 
467
        gint _tmp2_ = 0;
 
468
        gint _tmp3_ = 0;
452
469
        gchar* _tmp4_ = NULL;
453
 
        gchar* move;
454
 
        PieceType _tmp5_;
455
 
        const gchar* _tmp12_;
456
 
        gboolean _tmp13_;
 
470
        PieceType _tmp5_ = 0;
 
471
        const gchar* _tmp12_ = NULL;
 
472
        gboolean _tmp13_ = FALSE;
457
473
        gboolean _tmp14_ = FALSE;
458
474
        g_return_val_if_fail (self != NULL, FALSE);
459
475
        _tmp0_ = f0;
470
486
                }
471
487
                case PIECE_TYPE_KNIGHT:
472
488
                {
473
 
                        const gchar* _tmp6_;
474
 
                        gchar* _tmp7_;
 
489
                        const gchar* _tmp6_ = NULL;
 
490
                        gchar* _tmp7_ = NULL;
475
491
                        _tmp6_ = move;
476
492
                        _tmp7_ = g_strconcat (_tmp6_, "=N", NULL);
477
493
                        _g_free0 (move);
480
496
                }
481
497
                case PIECE_TYPE_ROOK:
482
498
                {
483
 
                        const gchar* _tmp8_;
484
 
                        gchar* _tmp9_;
 
499
                        const gchar* _tmp8_ = NULL;
 
500
                        gchar* _tmp9_ = NULL;
485
501
                        _tmp8_ = move;
486
502
                        _tmp9_ = g_strconcat (_tmp8_, "=R", NULL);
487
503
                        _g_free0 (move);
490
506
                }
491
507
                case PIECE_TYPE_BISHOP:
492
508
                {
493
 
                        const gchar* _tmp10_;
494
 
                        gchar* _tmp11_;
 
509
                        const gchar* _tmp10_ = NULL;
 
510
                        gchar* _tmp11_ = NULL;
495
511
                        _tmp10_ = move;
496
512
                        _tmp11_ = g_strconcat (_tmp10_, "=B", NULL);
497
513
                        _g_free0 (move);
540
556
 
541
557
gboolean chess_player_get_local_human (ChessPlayer* self) {
542
558
        gboolean result;
543
 
        gboolean _tmp0_;
 
559
        gboolean _tmp0_ = FALSE;
544
560
        g_return_val_if_fail (self != NULL, FALSE);
545
561
        _tmp0_ = self->priv->_local_human;
546
562
        result = _tmp0_;
549
565
 
550
566
 
551
567
void chess_player_set_local_human (ChessPlayer* self, gboolean value) {
552
 
        gboolean _tmp0_;
 
568
        gboolean _tmp0_ = FALSE;
553
569
        g_return_if_fail (self != NULL);
554
570
        _tmp0_ = value;
555
571
        self->priv->_local_human = _tmp0_;
690
706
 
691
707
ChessPiece* chess_piece_construct (GType object_type, ChessPlayer* player, PieceType type) {
692
708
        ChessPiece* self = NULL;
693
 
        ChessPlayer* _tmp0_;
694
 
        ChessPlayer* _tmp1_;
695
 
        PieceType _tmp2_;
 
709
        ChessPlayer* _tmp0_ = NULL;
 
710
        ChessPlayer* _tmp1_ = NULL;
 
711
        PieceType _tmp2_ = 0;
696
712
        g_return_val_if_fail (player != NULL, NULL);
697
713
        self = (ChessPiece*) g_type_create_instance (object_type);
698
714
        _tmp0_ = player;
712
728
 
713
729
Color chess_piece_get_color (ChessPiece* self) {
714
730
        Color result;
715
 
        ChessPlayer* _tmp0_;
716
 
        Color _tmp1_;
 
731
        ChessPlayer* _tmp0_ = NULL;
 
732
        Color _tmp1_ = 0;
717
733
        g_return_val_if_fail (self != NULL, 0);
718
734
        _tmp0_ = self->player;
719
735
        _tmp1_ = _tmp0_->color;
724
740
 
725
741
gunichar chess_piece_get_symbol (ChessPiece* self) {
726
742
        gunichar result;
727
 
        gunichar c;
728
 
        PieceType _tmp0_;
729
 
        ChessPlayer* _tmp1_;
730
 
        Color _tmp2_;
731
 
        gunichar _tmp5_;
 
743
        gunichar c = 0U;
 
744
        PieceType _tmp0_ = 0;
 
745
        ChessPlayer* _tmp1_ = NULL;
 
746
        Color _tmp2_ = 0;
 
747
        gunichar _tmp5_ = 0U;
732
748
        g_return_val_if_fail (self != NULL, 0U);
733
749
        c = (gunichar) ' ';
734
750
        _tmp0_ = self->type;
769
785
        _tmp1_ = self->player;
770
786
        _tmp2_ = _tmp1_->color;
771
787
        if (_tmp2_ == COLOR_WHITE) {
772
 
                gunichar _tmp3_;
 
788
                gunichar _tmp3_ = 0U;
773
789
                gunichar _tmp4_ = 0U;
774
790
                _tmp3_ = c;
775
791
                _tmp4_ = g_unichar_toupper (_tmp3_);
958
974
 
959
975
gchar* chess_move_get_lan (ChessMove* self) {
960
976
        gchar* result = NULL;
961
 
        ChessPiece* _tmp0_;
962
 
        GString* _tmp5_;
963
 
        GString* builder;
964
 
        ChessPiece* _tmp6_;
 
977
        ChessPiece* _tmp0_ = NULL;
 
978
        GString* builder = NULL;
 
979
        GString* _tmp5_ = NULL;
 
980
        ChessPiece* _tmp6_ = NULL;
965
981
        static const gchar promotion_symbols[] = {' ', 'R', 'N', 'B', 'Q', 'K'};
966
 
        ChessPiece* _tmp17_;
967
 
        CheckState _tmp22_;
968
 
        GString* _tmp25_;
969
 
        const gchar* _tmp26_;
970
 
        gchar* _tmp27_;
 
982
        ChessPiece* _tmp17_ = NULL;
 
983
        CheckState _tmp22_ = 0;
 
984
        GString* _tmp25_ = NULL;
 
985
        const gchar* _tmp26_ = NULL;
 
986
        gchar* _tmp27_ = NULL;
971
987
        g_return_val_if_fail (self != NULL, NULL);
972
988
        _tmp0_ = self->moved_rook;
973
989
        if (_tmp0_ != NULL) {
974
 
                gint _tmp1_;
975
 
                gint _tmp2_;
 
990
                gint _tmp1_ = 0;
 
991
                gint _tmp2_ = 0;
976
992
                _tmp1_ = self->f1;
977
993
                _tmp2_ = self->f0;
978
994
                if (_tmp1_ > _tmp2_) {
979
 
                        gchar* _tmp3_;
 
995
                        gchar* _tmp3_ = NULL;
980
996
                        _tmp3_ = g_strdup ("O-O");
981
997
                        result = _tmp3_;
982
998
                        return result;
983
999
                } else {
984
 
                        gchar* _tmp4_;
 
1000
                        gchar* _tmp4_ = NULL;
985
1001
                        _tmp4_ = g_strdup ("O-O-O");
986
1002
                        result = _tmp4_;
987
1003
                        return result;
991
1007
        builder = _tmp5_;
992
1008
        _tmp6_ = self->victim;
993
1009
        if (_tmp6_ != NULL) {
994
 
                GString* _tmp7_;
995
 
                gint _tmp8_;
996
 
                gint _tmp9_;
997
 
                gint _tmp10_;
998
 
                gint _tmp11_;
 
1010
                GString* _tmp7_ = NULL;
 
1011
                gint _tmp8_ = 0;
 
1012
                gint _tmp9_ = 0;
 
1013
                gint _tmp10_ = 0;
 
1014
                gint _tmp11_ = 0;
999
1015
                _tmp7_ = builder;
1000
1016
                _tmp8_ = self->f0;
1001
1017
                _tmp9_ = self->r0;
1003
1019
                _tmp11_ = self->r1;
1004
1020
                g_string_append_printf (_tmp7_, "%c%dx%c%d", 'a' + _tmp8_, _tmp9_ + 1, 'a' + _tmp10_, _tmp11_ + 1);
1005
1021
        } else {
1006
 
                GString* _tmp12_;
1007
 
                gint _tmp13_;
1008
 
                gint _tmp14_;
1009
 
                gint _tmp15_;
1010
 
                gint _tmp16_;
 
1022
                GString* _tmp12_ = NULL;
 
1023
                gint _tmp13_ = 0;
 
1024
                gint _tmp14_ = 0;
 
1025
                gint _tmp15_ = 0;
 
1026
                gint _tmp16_ = 0;
1011
1027
                _tmp12_ = builder;
1012
1028
                _tmp13_ = self->f0;
1013
1029
                _tmp14_ = self->r0;
1017
1033
        }
1018
1034
        _tmp17_ = self->promotion_piece;
1019
1035
        if (_tmp17_ != NULL) {
1020
 
                GString* _tmp18_;
1021
 
                ChessPiece* _tmp19_;
1022
 
                PieceType _tmp20_;
1023
 
                gchar _tmp21_;
 
1036
                GString* _tmp18_ = NULL;
 
1037
                ChessPiece* _tmp19_ = NULL;
 
1038
                PieceType _tmp20_ = 0;
 
1039
                gchar _tmp21_ = '\0';
1024
1040
                _tmp18_ = builder;
1025
1041
                _tmp19_ = self->promotion_piece;
1026
1042
                _tmp20_ = _tmp19_->type;
1031
1047
        switch (_tmp22_) {
1032
1048
                case CHECK_STATE_CHECK:
1033
1049
                {
1034
 
                        GString* _tmp23_;
 
1050
                        GString* _tmp23_ = NULL;
1035
1051
                        _tmp23_ = builder;
1036
1052
                        g_string_append_c (_tmp23_, '+');
1037
1053
                        break;
1038
1054
                }
1039
1055
                case CHECK_STATE_CHECKMATE:
1040
1056
                {
1041
 
                        GString* _tmp24_;
 
1057
                        GString* _tmp24_ = NULL;
1042
1058
                        _tmp24_ = builder;
1043
1059
                        g_string_append_c (_tmp24_, '#');
1044
1060
                        break;
1068
1084
 
1069
1085
gchar* chess_move_get_fan (ChessMove* self) {
1070
1086
        gchar* result = NULL;
1071
 
        static const gchar* white_piece_names[] = {"", "♞", "♝", "♜", "♛", "♚"};
1072
 
        static const gchar* black_piece_names[] = {"", "♘", "♗", "♖", "♕", "♔"};
1073
 
        ChessPiece* _tmp0_;
1074
 
        Color _tmp1_;
1075
 
        Color _tmp2_;
 
1087
        static const gchar* white_piece_names[] = {"", "♖", "♘", "♗", "♕", "♔"};
 
1088
        static const gchar* black_piece_names[] = {"", "♜", "♞", "♝", "♛", "♚"};
 
1089
        ChessPiece* _tmp0_ = NULL;
 
1090
        Color _tmp1_ = 0;
 
1091
        Color _tmp2_ = 0;
1076
1092
        g_return_val_if_fail (self != NULL, NULL);
1077
1093
        _tmp0_ = self->piece;
1078
1094
        _tmp1_ = chess_piece_get_color (_tmp0_);
1093
1109
 
1094
1110
static gchar* chess_move_make_san (ChessMove* self, gchar** piece_names, int piece_names_length1) {
1095
1111
        gchar* result = NULL;
1096
 
        ChessPiece* _tmp0_;
1097
 
        GString* _tmp5_;
1098
 
        GString* builder;
1099
 
        GString* _tmp6_;
1100
 
        gchar** _tmp7_;
1101
 
        gint _tmp7__length1;
1102
 
        ChessPiece* _tmp8_;
1103
 
        PieceType _tmp9_;
1104
 
        const gchar* _tmp10_;
1105
 
        gboolean _tmp11_;
1106
 
        gboolean _tmp14_;
1107
 
        ChessPiece* _tmp17_;
1108
 
        GString* _tmp19_;
1109
 
        gint _tmp20_;
1110
 
        gint _tmp21_;
1111
 
        ChessPiece* _tmp22_;
1112
 
        CheckState _tmp28_;
1113
 
        GString* _tmp31_;
1114
 
        const gchar* _tmp32_;
1115
 
        gchar* _tmp33_;
 
1112
        ChessPiece* _tmp0_ = NULL;
 
1113
        GString* builder = NULL;
 
1114
        GString* _tmp5_ = NULL;
 
1115
        GString* _tmp6_ = NULL;
 
1116
        gchar** _tmp7_ = NULL;
 
1117
        gint _tmp7__length1 = 0;
 
1118
        ChessPiece* _tmp8_ = NULL;
 
1119
        PieceType _tmp9_ = 0;
 
1120
        const gchar* _tmp10_ = NULL;
 
1121
        gboolean _tmp11_ = FALSE;
 
1122
        gboolean _tmp14_ = FALSE;
 
1123
        ChessPiece* _tmp17_ = NULL;
 
1124
        GString* _tmp19_ = NULL;
 
1125
        gint _tmp20_ = 0;
 
1126
        gint _tmp21_ = 0;
 
1127
        ChessPiece* _tmp22_ = NULL;
 
1128
        CheckState _tmp28_ = 0;
 
1129
        GString* _tmp31_ = NULL;
 
1130
        const gchar* _tmp32_ = NULL;
 
1131
        gchar* _tmp33_ = NULL;
1116
1132
        g_return_val_if_fail (self != NULL, NULL);
1117
1133
        _tmp0_ = self->moved_rook;
1118
1134
        if (_tmp0_ != NULL) {
1119
 
                gint _tmp1_;
1120
 
                gint _tmp2_;
 
1135
                gint _tmp1_ = 0;
 
1136
                gint _tmp2_ = 0;
1121
1137
                _tmp1_ = self->f1;
1122
1138
                _tmp2_ = self->f0;
1123
1139
                if (_tmp1_ > _tmp2_) {
1124
 
                        gchar* _tmp3_;
 
1140
                        gchar* _tmp3_ = NULL;
1125
1141
                        _tmp3_ = g_strdup ("O-O");
1126
1142
                        result = _tmp3_;
1127
1143
                        return result;
1128
1144
                } else {
1129
 
                        gchar* _tmp4_;
 
1145
                        gchar* _tmp4_ = NULL;
1130
1146
                        _tmp4_ = g_strdup ("O-O-O");
1131
1147
                        result = _tmp4_;
1132
1148
                        return result;
1143
1159
        g_string_append (_tmp6_, _tmp10_);
1144
1160
        _tmp11_ = self->ambiguous_file;
1145
1161
        if (_tmp11_) {
1146
 
                GString* _tmp12_;
1147
 
                gint _tmp13_;
 
1162
                GString* _tmp12_ = NULL;
 
1163
                gint _tmp13_ = 0;
1148
1164
                _tmp12_ = builder;
1149
1165
                _tmp13_ = self->f0;
1150
1166
                g_string_append_printf (_tmp12_, "%c", 'a' + _tmp13_);
1151
1167
        }
1152
1168
        _tmp14_ = self->ambiguous_rank;
1153
1169
        if (_tmp14_) {
1154
 
                GString* _tmp15_;
1155
 
                gint _tmp16_;
 
1170
                GString* _tmp15_ = NULL;
 
1171
                gint _tmp16_ = 0;
1156
1172
                _tmp15_ = builder;
1157
1173
                _tmp16_ = self->r0;
1158
1174
                g_string_append_printf (_tmp15_, "%d", _tmp16_ + 1);
1159
1175
        }
1160
1176
        _tmp17_ = self->victim;
1161
1177
        if (_tmp17_ != NULL) {
1162
 
                GString* _tmp18_;
 
1178
                GString* _tmp18_ = NULL;
1163
1179
                _tmp18_ = builder;
1164
1180
                g_string_append (_tmp18_, "x");
1165
1181
        }
1169
1185
        g_string_append_printf (_tmp19_, "%c%d", 'a' + _tmp20_, _tmp21_ + 1);
1170
1186
        _tmp22_ = self->promotion_piece;
1171
1187
        if (_tmp22_ != NULL) {
1172
 
                GString* _tmp23_;
1173
 
                gchar** _tmp24_;
1174
 
                gint _tmp24__length1;
1175
 
                ChessPiece* _tmp25_;
1176
 
                PieceType _tmp26_;
1177
 
                const gchar* _tmp27_;
 
1188
                GString* _tmp23_ = NULL;
 
1189
                gchar** _tmp24_ = NULL;
 
1190
                gint _tmp24__length1 = 0;
 
1191
                ChessPiece* _tmp25_ = NULL;
 
1192
                PieceType _tmp26_ = 0;
 
1193
                const gchar* _tmp27_ = NULL;
1178
1194
                _tmp23_ = builder;
1179
1195
                _tmp24_ = piece_names;
1180
1196
                _tmp24__length1 = piece_names_length1;
1187
1203
        switch (_tmp28_) {
1188
1204
                case CHECK_STATE_CHECK:
1189
1205
                {
1190
 
                        GString* _tmp29_;
 
1206
                        GString* _tmp29_ = NULL;
1191
1207
                        _tmp29_ = builder;
1192
1208
                        g_string_append_c (_tmp29_, '+');
1193
1209
                        break;
1194
1210
                }
1195
1211
                case CHECK_STATE_CHECKMATE:
1196
1212
                {
1197
 
                        GString* _tmp30_;
 
1213
                        GString* _tmp30_ = NULL;
1198
1214
                        _tmp30_ = builder;
1199
1215
                        g_string_append_c (_tmp30_, '#');
1200
1216
                        break;
1213
1229
 
1214
1230
gchar* chess_move_get_engine (ChessMove* self) {
1215
1231
        gchar* result = NULL;
1216
 
        GString* _tmp0_;
1217
 
        GString* builder;
 
1232
        GString* builder = NULL;
 
1233
        GString* _tmp0_ = NULL;
1218
1234
        static const gchar promotion_symbols[] = {' ', 'r', 'n', 'b', 'q', ' '};
1219
 
        ChessPiece* _tmp1_;
1220
 
        GString* _tmp15_;
1221
 
        const gchar* _tmp16_;
1222
 
        gchar* _tmp17_;
 
1235
        ChessPiece* _tmp1_ = NULL;
 
1236
        GString* _tmp15_ = NULL;
 
1237
        const gchar* _tmp16_ = NULL;
 
1238
        gchar* _tmp17_ = NULL;
1223
1239
        g_return_val_if_fail (self != NULL, NULL);
1224
1240
        _tmp0_ = g_string_new ("");
1225
1241
        builder = _tmp0_;
1226
1242
        _tmp1_ = self->promotion_piece;
1227
1243
        if (_tmp1_ != NULL) {
1228
 
                GString* _tmp2_;
1229
 
                gint _tmp3_;
1230
 
                gint _tmp4_;
1231
 
                gint _tmp5_;
1232
 
                gint _tmp6_;
1233
 
                ChessPiece* _tmp7_;
1234
 
                PieceType _tmp8_;
1235
 
                gchar _tmp9_;
 
1244
                GString* _tmp2_ = NULL;
 
1245
                gint _tmp3_ = 0;
 
1246
                gint _tmp4_ = 0;
 
1247
                gint _tmp5_ = 0;
 
1248
                gint _tmp6_ = 0;
 
1249
                ChessPiece* _tmp7_ = NULL;
 
1250
                PieceType _tmp8_ = 0;
 
1251
                gchar _tmp9_ = '\0';
1236
1252
                _tmp2_ = builder;
1237
1253
                _tmp3_ = self->f0;
1238
1254
                _tmp4_ = self->r0;
1243
1259
                _tmp9_ = promotion_symbols[_tmp8_];
1244
1260
                g_string_append_printf (_tmp2_, "%c%d%c%d%c", 'a' + _tmp3_, _tmp4_ + 1, 'a' + _tmp5_, _tmp6_ + 1, (gint) _tmp9_);
1245
1261
        } else {
1246
 
                GString* _tmp10_;
1247
 
                gint _tmp11_;
1248
 
                gint _tmp12_;
1249
 
                gint _tmp13_;
1250
 
                gint _tmp14_;
 
1262
                GString* _tmp10_ = NULL;
 
1263
                gint _tmp11_ = 0;
 
1264
                gint _tmp12_ = 0;
 
1265
                gint _tmp13_ = 0;
 
1266
                gint _tmp14_ = 0;
1251
1267
                _tmp10_ = builder;
1252
1268
                _tmp11_ = self->f0;
1253
1269
                _tmp12_ = self->r0;
1271
1287
 
1272
1288
ChessMove* chess_move_copy (ChessMove* self) {
1273
1289
        ChessMove* result = NULL;
1274
 
        ChessMove* _tmp0_;
1275
 
        ChessMove* move;
1276
 
        gint _tmp1_;
1277
 
        ChessPiece* _tmp2_;
1278
 
        ChessPiece* _tmp3_;
1279
 
        ChessPiece* _tmp4_;
1280
 
        ChessPiece* _tmp5_;
1281
 
        ChessPiece* _tmp6_;
1282
 
        ChessPiece* _tmp7_;
1283
 
        ChessPiece* _tmp8_;
1284
 
        ChessPiece* _tmp9_;
1285
 
        gint _tmp10_;
1286
 
        gint _tmp11_;
1287
 
        gint _tmp12_;
1288
 
        gint _tmp13_;
1289
 
        gboolean _tmp14_;
1290
 
        gboolean _tmp15_;
1291
 
        CheckState _tmp16_;
 
1290
        ChessMove* move = NULL;
 
1291
        ChessMove* _tmp0_ = NULL;
 
1292
        gint _tmp1_ = 0;
 
1293
        ChessPiece* _tmp2_ = NULL;
 
1294
        ChessPiece* _tmp3_ = NULL;
 
1295
        ChessPiece* _tmp4_ = NULL;
 
1296
        ChessPiece* _tmp5_ = NULL;
 
1297
        ChessPiece* _tmp6_ = NULL;
 
1298
        ChessPiece* _tmp7_ = NULL;
 
1299
        ChessPiece* _tmp8_ = NULL;
 
1300
        ChessPiece* _tmp9_ = NULL;
 
1301
        gint _tmp10_ = 0;
 
1302
        gint _tmp11_ = 0;
 
1303
        gint _tmp12_ = 0;
 
1304
        gint _tmp13_ = 0;
 
1305
        gboolean _tmp14_ = FALSE;
 
1306
        gboolean _tmp15_ = FALSE;
 
1307
        CheckState _tmp16_ = 0;
1292
1308
        g_return_val_if_fail (self != NULL, NULL);
1293
1309
        _tmp0_ = chess_move_new ();
1294
1310
        move = _tmp0_;
1518
1534
 
1519
1535
static gchar string_get (const gchar* self, glong index) {
1520
1536
        gchar result = '\0';
1521
 
        glong _tmp0_;
1522
 
        gchar _tmp1_;
 
1537
        glong _tmp0_ = 0L;
 
1538
        gchar _tmp1_ = '\0';
1523
1539
        g_return_val_if_fail (self != NULL, '\0');
1524
1540
        _tmp0_ = index;
1525
1541
        _tmp1_ = ((gchar*) self)[_tmp0_];
1530
1546
 
1531
1547
ChessState* chess_state_construct (GType object_type, const gchar* fen) {
1532
1548
        ChessState* self = NULL;
1533
 
        ChessPlayer* _tmp0_;
1534
 
        ChessPlayer* _tmp1_;
1535
 
        ChessPlayer* _tmp2_;
1536
 
        ChessPlayer* _tmp3_;
1537
 
        const gchar* _tmp10_;
1538
 
        gchar** _tmp11_;
 
1549
        ChessPlayer* _tmp0_ = NULL;
 
1550
        ChessPlayer* _tmp1_ = NULL;
 
1551
        ChessPlayer* _tmp2_ = NULL;
 
1552
        ChessPlayer* _tmp3_ = NULL;
 
1553
        gchar** fields = NULL;
 
1554
        const gchar* _tmp9_ = NULL;
 
1555
        gchar** _tmp10_ = NULL;
 
1556
        gchar** _tmp11_ = NULL;
 
1557
        gint fields_length1 = 0;
 
1558
        gint _fields_size_ = 0;
 
1559
        gchar** ranks = NULL;
1539
1560
        gchar** _tmp12_ = NULL;
1540
 
        gchar** fields;
1541
 
        gint fields_length1;
1542
 
        gint _fields_size_;
1543
 
        gchar** _tmp13_;
1544
 
        gint _tmp13__length1;
1545
 
        const gchar* _tmp14_;
1546
 
        gchar** _tmp15_;
1547
 
        gchar** _tmp16_ = NULL;
1548
 
        gchar** ranks;
1549
 
        gint ranks_length1;
1550
 
        gint _ranks_size_;
1551
 
        gchar** _tmp69_;
1552
 
        gint _tmp69__length1;
1553
 
        const gchar* _tmp70_;
1554
 
        gchar** _tmp77_;
1555
 
        gint _tmp77__length1;
1556
 
        const gchar* _tmp78_;
1557
 
        gchar** _tmp99_;
1558
 
        gint _tmp99__length1;
1559
 
        const gchar* _tmp100_;
1560
 
        gchar** _tmp108_;
1561
 
        gint _tmp108__length1;
1562
 
        const gchar* _tmp109_;
1563
 
        gint _tmp110_ = 0;
1564
 
        gchar** _tmp111_;
1565
 
        gint _tmp111__length1;
1566
 
        const gchar* _tmp112_;
1567
 
        gint _tmp113_ = 0;
1568
 
        ChessPlayer* _tmp114_;
1569
 
        Color _tmp115_;
1570
 
        ChessPlayer* _tmp117_;
1571
 
        CheckState _tmp118_ = 0;
 
1561
        gint _tmp12__length1 = 0;
 
1562
        const gchar* _tmp13_ = NULL;
 
1563
        gchar** _tmp14_ = NULL;
 
1564
        gchar** _tmp15_ = NULL;
 
1565
        gint ranks_length1 = 0;
 
1566
        gint _ranks_size_ = 0;
 
1567
        gchar** _tmp63_ = NULL;
 
1568
        gint _tmp63__length1 = 0;
 
1569
        const gchar* _tmp64_ = NULL;
 
1570
        gchar** _tmp71_ = NULL;
 
1571
        gint _tmp71__length1 = 0;
 
1572
        const gchar* _tmp72_ = NULL;
 
1573
        gchar** _tmp92_ = NULL;
 
1574
        gint _tmp92__length1 = 0;
 
1575
        const gchar* _tmp93_ = NULL;
 
1576
        gchar** _tmp101_ = NULL;
 
1577
        gint _tmp101__length1 = 0;
 
1578
        const gchar* _tmp102_ = NULL;
 
1579
        gint _tmp103_ = 0;
 
1580
        gchar** _tmp104_ = NULL;
 
1581
        gint _tmp104__length1 = 0;
 
1582
        const gchar* _tmp105_ = NULL;
 
1583
        gint _tmp106_ = 0;
 
1584
        ChessPlayer* _tmp107_ = NULL;
 
1585
        Color _tmp108_ = 0;
 
1586
        ChessPlayer* _tmp110_ = NULL;
 
1587
        CheckState _tmp111_ = 0;
1572
1588
        g_return_val_if_fail (fen != NULL, NULL);
1573
1589
        self = (ChessState*) g_type_create_instance (object_type);
1574
1590
        _tmp0_ = chess_player_new (COLOR_WHITE);
1580
1596
        self->players[COLOR_BLACK] = _tmp2_;
1581
1597
        _tmp3_ = self->players[COLOR_BLACK];
1582
1598
        {
1583
 
                gint i;
 
1599
                gint i = 0;
1584
1600
                i = 0;
1585
1601
                {
1586
 
                        gboolean _tmp4_;
 
1602
                        gboolean _tmp4_ = FALSE;
1587
1603
                        _tmp4_ = TRUE;
1588
1604
                        while (TRUE) {
1589
 
                                gboolean _tmp5_;
1590
 
                                gint _tmp7_;
1591
 
                                gint _tmp8_;
1592
 
                                ChessPiece* _tmp9_;
1593
 
                                _tmp5_ = _tmp4_;
1594
 
                                if (!_tmp5_) {
1595
 
                                        gint _tmp6_;
1596
 
                                        _tmp6_ = i;
1597
 
                                        i = _tmp6_ + 1;
 
1605
                                gint _tmp6_ = 0;
 
1606
                                gint _tmp7_ = 0;
 
1607
                                ChessPiece* _tmp8_ = NULL;
 
1608
                                if (!_tmp4_) {
 
1609
                                        gint _tmp5_ = 0;
 
1610
                                        _tmp5_ = i;
 
1611
                                        i = _tmp5_ + 1;
1598
1612
                                }
1599
1613
                                _tmp4_ = FALSE;
 
1614
                                _tmp6_ = i;
 
1615
                                if (!(_tmp6_ < 64)) {
 
1616
                                        break;
 
1617
                                }
1600
1618
                                _tmp7_ = i;
1601
 
                                if (!(_tmp7_ < 64)) {
1602
 
                                        break;
1603
 
                                }
1604
 
                                _tmp8_ = i;
1605
 
                                _chess_piece_unref0 (self->board[_tmp8_]);
1606
 
                                self->board[_tmp8_] = NULL;
1607
 
                                _tmp9_ = self->board[_tmp8_];
 
1619
                                _chess_piece_unref0 (self->board[_tmp7_]);
 
1620
                                self->board[_tmp7_] = NULL;
 
1621
                                _tmp8_ = self->board[_tmp7_];
1608
1622
                        }
1609
1623
                }
1610
1624
        }
1611
 
        _tmp10_ = fen;
1612
 
        _tmp12_ = _tmp11_ = g_strsplit (_tmp10_, " ", 0);
1613
 
        fields = _tmp12_;
1614
 
        fields_length1 = _vala_array_length (_tmp11_);
 
1625
        _tmp9_ = fen;
 
1626
        _tmp11_ = _tmp10_ = g_strsplit (_tmp9_, " ", 0);
 
1627
        fields = _tmp11_;
 
1628
        fields_length1 = _vala_array_length (_tmp10_);
1615
1629
        _fields_size_ = fields_length1;
1616
 
        _tmp13_ = fields;
1617
 
        _tmp13__length1 = fields_length1;
1618
 
        _tmp14_ = _tmp13_[0];
1619
 
        _tmp16_ = _tmp15_ = g_strsplit (_tmp14_, "/", 0);
1620
 
        ranks = _tmp16_;
1621
 
        ranks_length1 = _vala_array_length (_tmp15_);
 
1630
        _tmp12_ = fields;
 
1631
        _tmp12__length1 = fields_length1;
 
1632
        _tmp13_ = _tmp12_[0];
 
1633
        _tmp15_ = _tmp14_ = g_strsplit (_tmp13_, "/", 0);
 
1634
        ranks = _tmp15_;
 
1635
        ranks_length1 = _vala_array_length (_tmp14_);
1622
1636
        _ranks_size_ = ranks_length1;
1623
1637
        {
1624
 
                gint rank;
 
1638
                gint rank = 0;
1625
1639
                rank = 0;
1626
1640
                {
1627
 
                        gboolean _tmp17_;
1628
 
                        _tmp17_ = TRUE;
 
1641
                        gboolean _tmp16_ = FALSE;
 
1642
                        _tmp16_ = TRUE;
1629
1643
                        while (TRUE) {
1630
 
                                gboolean _tmp18_;
1631
 
                                gint _tmp20_;
1632
 
                                gchar** _tmp21_;
1633
 
                                gint _tmp21__length1;
1634
 
                                gint _tmp22_;
1635
 
                                const gchar* _tmp23_;
1636
 
                                gchar* _tmp24_;
1637
 
                                gchar* rank_string;
1638
 
                                _tmp18_ = _tmp17_;
1639
 
                                if (!_tmp18_) {
1640
 
                                        gint _tmp19_;
1641
 
                                        _tmp19_ = rank;
1642
 
                                        rank = _tmp19_ + 1;
1643
 
                                }
1644
 
                                _tmp17_ = FALSE;
 
1644
                                gint _tmp18_ = 0;
 
1645
                                gchar* rank_string = NULL;
 
1646
                                gchar** _tmp19_ = NULL;
 
1647
                                gint _tmp19__length1 = 0;
 
1648
                                gint _tmp20_ = 0;
 
1649
                                const gchar* _tmp21_ = NULL;
 
1650
                                gchar* _tmp22_ = NULL;
 
1651
                                if (!_tmp16_) {
 
1652
                                        gint _tmp17_ = 0;
 
1653
                                        _tmp17_ = rank;
 
1654
                                        rank = _tmp17_ + 1;
 
1655
                                }
 
1656
                                _tmp16_ = FALSE;
 
1657
                                _tmp18_ = rank;
 
1658
                                if (!(_tmp18_ < 8)) {
 
1659
                                        break;
 
1660
                                }
 
1661
                                _tmp19_ = ranks;
 
1662
                                _tmp19__length1 = ranks_length1;
1645
1663
                                _tmp20_ = rank;
1646
 
                                if (!(_tmp20_ < 8)) {
1647
 
                                        break;
1648
 
                                }
1649
 
                                _tmp21_ = ranks;
1650
 
                                _tmp21__length1 = ranks_length1;
1651
 
                                _tmp22_ = rank;
1652
 
                                _tmp23_ = _tmp21_[7 - _tmp22_];
1653
 
                                _tmp24_ = g_strdup (_tmp23_);
1654
 
                                rank_string = _tmp24_;
 
1664
                                _tmp21_ = _tmp19_[7 - _tmp20_];
 
1665
                                _tmp22_ = g_strdup (_tmp21_);
 
1666
                                rank_string = _tmp22_;
1655
1667
                                {
1656
 
                                        gint file;
1657
 
                                        gint offset;
 
1668
                                        gint file = 0;
 
1669
                                        gint offset = 0;
1658
1670
                                        file = 0;
1659
1671
                                        offset = 0;
1660
1672
                                        {
1661
 
                                                gboolean _tmp25_;
1662
 
                                                _tmp25_ = TRUE;
 
1673
                                                gboolean _tmp23_ = FALSE;
 
1674
                                                _tmp23_ = TRUE;
1663
1675
                                                while (TRUE) {
1664
 
                                                        gboolean _tmp26_;
1665
 
                                                        gboolean _tmp28_ = FALSE;
1666
 
                                                        gint _tmp29_;
1667
 
                                                        gboolean _tmp34_;
1668
 
                                                        const gchar* _tmp35_;
1669
 
                                                        gint _tmp36_;
1670
 
                                                        gchar _tmp37_ = '\0';
1671
 
                                                        gchar c;
1672
 
                                                        gboolean _tmp38_ = FALSE;
1673
 
                                                        gchar _tmp39_;
1674
 
                                                        gboolean _tmp41_;
 
1676
                                                        gboolean _tmp25_ = FALSE;
 
1677
                                                        gint _tmp26_ = 0;
 
1678
                                                        gchar c = '\0';
 
1679
                                                        const gchar* _tmp31_ = NULL;
 
1680
                                                        gint _tmp32_ = 0;
 
1681
                                                        gchar _tmp33_ = '\0';
 
1682
                                                        gboolean _tmp34_ = FALSE;
 
1683
                                                        gchar _tmp35_ = '\0';
1675
1684
                                                        PieceType type = 0;
1676
 
                                                        Color _tmp44_ = 0;
1677
 
                                                        gchar _tmp45_;
1678
 
                                                        gboolean _tmp46_ = FALSE;
1679
 
                                                        Color _tmp47_;
1680
 
                                                        Color color;
1681
 
                                                        gchar _tmp48_;
1682
 
                                                        gchar _tmp49_ = '\0';
1683
 
                                                        PieceType _tmp50_ = 0;
1684
 
                                                        gboolean _tmp51_ = FALSE;
1685
 
                                                        gint _tmp52_;
1686
 
                                                        gint _tmp53_;
1687
 
                                                        gint _tmp54_ = 0;
1688
 
                                                        gint index;
1689
 
                                                        Color _tmp55_;
1690
 
                                                        ChessPlayer* _tmp56_;
1691
 
                                                        PieceType _tmp57_;
1692
 
                                                        ChessPiece* _tmp58_;
1693
 
                                                        ChessPiece* piece;
1694
 
                                                        gint _tmp59_;
1695
 
                                                        ChessPiece* _tmp60_;
1696
 
                                                        ChessPiece* _tmp61_;
1697
 
                                                        ChessPiece* _tmp62_;
1698
 
                                                        gint _tmp63_;
1699
 
                                                        gint64 _tmp64_;
1700
 
                                                        gint64 mask;
1701
 
                                                        Color _tmp65_;
1702
 
                                                        gint64 _tmp66_;
1703
 
                                                        gint64 _tmp67_;
1704
 
                                                        gint _tmp68_;
1705
 
                                                        _tmp26_ = _tmp25_;
1706
 
                                                        if (!_tmp26_) {
1707
 
                                                                gint _tmp27_;
 
1685
                                                        Color _tmp39_ = 0;
 
1686
                                                        gchar _tmp40_ = '\0';
 
1687
                                                        gboolean _tmp41_ = FALSE;
 
1688
                                                        Color color = 0;
 
1689
                                                        gchar _tmp42_ = '\0';
 
1690
                                                        gchar _tmp43_ = '\0';
 
1691
                                                        PieceType _tmp44_ = 0;
 
1692
                                                        gboolean _tmp45_ = FALSE;
 
1693
                                                        gint index = 0;
 
1694
                                                        gint _tmp46_ = 0;
 
1695
                                                        gint _tmp47_ = 0;
 
1696
                                                        gint _tmp48_ = 0;
 
1697
                                                        ChessPiece* piece = NULL;
 
1698
                                                        Color _tmp49_ = 0;
 
1699
                                                        ChessPlayer* _tmp50_ = NULL;
 
1700
                                                        PieceType _tmp51_ = 0;
 
1701
                                                        ChessPiece* _tmp52_ = NULL;
 
1702
                                                        gint _tmp53_ = 0;
 
1703
                                                        ChessPiece* _tmp54_ = NULL;
 
1704
                                                        ChessPiece* _tmp55_ = NULL;
 
1705
                                                        ChessPiece* _tmp56_ = NULL;
 
1706
                                                        gint64 mask = 0LL;
 
1707
                                                        gint _tmp57_ = 0;
 
1708
                                                        gint64 _tmp58_ = 0LL;
 
1709
                                                        Color _tmp59_ = 0;
 
1710
                                                        gint64 _tmp60_ = 0LL;
 
1711
                                                        gint64 _tmp61_ = 0LL;
 
1712
                                                        gint _tmp62_ = 0;
 
1713
                                                        if (!_tmp23_) {
 
1714
                                                                gint _tmp24_ = 0;
 
1715
                                                                _tmp24_ = offset;
 
1716
                                                                offset = _tmp24_ + 1;
 
1717
                                                        }
 
1718
                                                        _tmp23_ = FALSE;
 
1719
                                                        _tmp26_ = file;
 
1720
                                                        if (_tmp26_ < 8) {
 
1721
                                                                gint _tmp27_ = 0;
 
1722
                                                                const gchar* _tmp28_ = NULL;
 
1723
                                                                gint _tmp29_ = 0;
 
1724
                                                                gint _tmp30_ = 0;
1708
1725
                                                                _tmp27_ = offset;
1709
 
                                                                offset = _tmp27_ + 1;
1710
 
                                                        }
1711
 
                                                        _tmp25_ = FALSE;
1712
 
                                                        _tmp29_ = file;
1713
 
                                                        if (_tmp29_ < 8) {
1714
 
                                                                gint _tmp30_;
1715
 
                                                                const gchar* _tmp31_;
1716
 
                                                                gint _tmp32_;
1717
 
                                                                gint _tmp33_;
1718
 
                                                                _tmp30_ = offset;
1719
 
                                                                _tmp31_ = rank_string;
1720
 
                                                                _tmp32_ = strlen (_tmp31_);
1721
 
                                                                _tmp33_ = _tmp32_;
1722
 
                                                                _tmp28_ = _tmp30_ < _tmp33_;
 
1726
                                                                _tmp28_ = rank_string;
 
1727
                                                                _tmp29_ = strlen (_tmp28_);
 
1728
                                                                _tmp30_ = _tmp29_;
 
1729
                                                                _tmp25_ = _tmp27_ < _tmp30_;
1723
1730
                                                        } else {
1724
 
                                                                _tmp28_ = FALSE;
 
1731
                                                                _tmp25_ = FALSE;
1725
1732
                                                        }
1726
 
                                                        _tmp34_ = _tmp28_;
1727
 
                                                        if (!_tmp34_) {
 
1733
                                                        if (!_tmp25_) {
1728
1734
                                                                break;
1729
1735
                                                        }
1730
 
                                                        _tmp35_ = rank_string;
1731
 
                                                        _tmp36_ = offset;
1732
 
                                                        _tmp37_ = string_get (_tmp35_, (glong) _tmp36_);
1733
 
                                                        c = _tmp37_;
1734
 
                                                        _tmp39_ = c;
1735
 
                                                        if (_tmp39_ >= '1') {
1736
 
                                                                gchar _tmp40_;
1737
 
                                                                _tmp40_ = c;
1738
 
                                                                _tmp38_ = _tmp40_ <= '8';
 
1736
                                                        _tmp31_ = rank_string;
 
1737
                                                        _tmp32_ = offset;
 
1738
                                                        _tmp33_ = string_get (_tmp31_, (glong) _tmp32_);
 
1739
                                                        c = _tmp33_;
 
1740
                                                        _tmp35_ = c;
 
1741
                                                        if (_tmp35_ >= '1') {
 
1742
                                                                gchar _tmp36_ = '\0';
 
1743
                                                                _tmp36_ = c;
 
1744
                                                                _tmp34_ = _tmp36_ <= '8';
1739
1745
                                                        } else {
1740
 
                                                                _tmp38_ = FALSE;
1741
 
                                                        }
1742
 
                                                        _tmp41_ = _tmp38_;
 
1746
                                                                _tmp34_ = FALSE;
 
1747
                                                        }
 
1748
                                                        if (_tmp34_) {
 
1749
                                                                gint _tmp37_ = 0;
 
1750
                                                                gchar _tmp38_ = '\0';
 
1751
                                                                _tmp37_ = file;
 
1752
                                                                _tmp38_ = c;
 
1753
                                                                file = _tmp37_ + (_tmp38_ - '0');
 
1754
                                                                continue;
 
1755
                                                        }
 
1756
                                                        _tmp40_ = c;
 
1757
                                                        _tmp41_ = g_ascii_isupper (_tmp40_);
1743
1758
                                                        if (_tmp41_) {
1744
 
                                                                gint _tmp42_;
1745
 
                                                                gchar _tmp43_;
1746
 
                                                                _tmp42_ = file;
1747
 
                                                                _tmp43_ = c;
1748
 
                                                                file = _tmp42_ + (_tmp43_ - '0');
1749
 
                                                                continue;
1750
 
                                                        }
1751
 
                                                        _tmp45_ = c;
1752
 
                                                        _tmp46_ = g_ascii_isupper (_tmp45_);
1753
 
                                                        if (_tmp46_) {
1754
 
                                                                _tmp44_ = COLOR_WHITE;
 
1759
                                                                _tmp39_ = COLOR_WHITE;
1755
1760
                                                        } else {
1756
 
                                                                _tmp44_ = COLOR_BLACK;
1757
 
                                                        }
1758
 
                                                        _tmp47_ = _tmp44_;
1759
 
                                                        color = _tmp47_;
1760
 
                                                        _tmp48_ = c;
1761
 
                                                        _tmp49_ = g_ascii_toupper (_tmp48_);
1762
 
                                                        _tmp51_ = chess_state_decode_piece_type (self, (gunichar) _tmp49_, &_tmp50_);
1763
 
                                                        type = _tmp50_;
1764
 
                                                        if (!_tmp51_) {
1765
 
                                                        }
1766
 
                                                        _tmp52_ = rank;
1767
 
                                                        _tmp53_ = file;
1768
 
                                                        _tmp54_ = chess_state_get_index (self, _tmp52_, _tmp53_);
1769
 
                                                        index = _tmp54_;
1770
 
                                                        _tmp55_ = color;
1771
 
                                                        _tmp56_ = self->players[_tmp55_];
1772
 
                                                        _tmp57_ = type;
1773
 
                                                        _tmp58_ = chess_piece_new (_tmp56_, _tmp57_);
1774
 
                                                        piece = _tmp58_;
1775
 
                                                        _tmp59_ = index;
1776
 
                                                        _tmp60_ = piece;
1777
 
                                                        _tmp61_ = _chess_piece_ref0 (_tmp60_);
1778
 
                                                        _chess_piece_unref0 (self->board[_tmp59_]);
1779
 
                                                        self->board[_tmp59_] = _tmp61_;
1780
 
                                                        _tmp62_ = self->board[_tmp59_];
1781
 
                                                        _tmp63_ = index;
1782
 
                                                        _tmp64_ = BIT_BOARD_set_location_masks[_tmp63_];
1783
 
                                                        mask = _tmp64_;
1784
 
                                                        _tmp65_ = color;
1785
 
                                                        _tmp66_ = mask;
1786
 
                                                        self->priv->piece_masks[_tmp65_] |= _tmp66_;
1787
 
                                                        _tmp67_ = self->priv->piece_masks[_tmp65_];
1788
 
                                                        _tmp68_ = file;
1789
 
                                                        file = _tmp68_ + 1;
 
1761
                                                                _tmp39_ = COLOR_BLACK;
 
1762
                                                        }
 
1763
                                                        color = _tmp39_;
 
1764
                                                        _tmp42_ = c;
 
1765
                                                        _tmp43_ = g_ascii_toupper (_tmp42_);
 
1766
                                                        _tmp45_ = chess_state_decode_piece_type (self, (gunichar) _tmp43_, &_tmp44_);
 
1767
                                                        type = _tmp44_;
 
1768
                                                        if (!_tmp45_) {
 
1769
                                                        }
 
1770
                                                        _tmp46_ = rank;
 
1771
                                                        _tmp47_ = file;
 
1772
                                                        _tmp48_ = chess_state_get_index (self, _tmp46_, _tmp47_);
 
1773
                                                        index = _tmp48_;
 
1774
                                                        _tmp49_ = color;
 
1775
                                                        _tmp50_ = self->players[_tmp49_];
 
1776
                                                        _tmp51_ = type;
 
1777
                                                        _tmp52_ = chess_piece_new (_tmp50_, _tmp51_);
 
1778
                                                        piece = _tmp52_;
 
1779
                                                        _tmp53_ = index;
 
1780
                                                        _tmp54_ = piece;
 
1781
                                                        _tmp55_ = _chess_piece_ref0 (_tmp54_);
 
1782
                                                        _chess_piece_unref0 (self->board[_tmp53_]);
 
1783
                                                        self->board[_tmp53_] = _tmp55_;
 
1784
                                                        _tmp56_ = self->board[_tmp53_];
 
1785
                                                        _tmp57_ = index;
 
1786
                                                        _tmp58_ = BIT_BOARD_set_location_masks[_tmp57_];
 
1787
                                                        mask = _tmp58_;
 
1788
                                                        _tmp59_ = color;
 
1789
                                                        _tmp60_ = mask;
 
1790
                                                        self->priv->piece_masks[_tmp59_] |= _tmp60_;
 
1791
                                                        _tmp61_ = self->priv->piece_masks[_tmp59_];
 
1792
                                                        _tmp62_ = file;
 
1793
                                                        file = _tmp62_ + 1;
1790
1794
                                                        _chess_piece_unref0 (piece);
1791
1795
                                                }
1792
1796
                                        }
1795
1799
                        }
1796
1800
                }
1797
1801
        }
1798
 
        _tmp69_ = fields;
1799
 
        _tmp69__length1 = fields_length1;
1800
 
        _tmp70_ = _tmp69_[1];
1801
 
        if (g_strcmp0 (_tmp70_, "w") == 0) {
1802
 
                ChessPlayer* _tmp71_;
1803
 
                ChessPlayer* _tmp72_;
1804
 
                _tmp71_ = self->players[COLOR_WHITE];
1805
 
                _tmp72_ = _g_object_ref0 (_tmp71_);
 
1802
        _tmp63_ = fields;
 
1803
        _tmp63__length1 = fields_length1;
 
1804
        _tmp64_ = _tmp63_[1];
 
1805
        if (g_strcmp0 (_tmp64_, "w") == 0) {
 
1806
                ChessPlayer* _tmp65_ = NULL;
 
1807
                ChessPlayer* _tmp66_ = NULL;
 
1808
                _tmp65_ = self->players[COLOR_WHITE];
 
1809
                _tmp66_ = _g_object_ref0 (_tmp65_);
1806
1810
                _g_object_unref0 (self->current_player);
1807
 
                self->current_player = _tmp72_;
 
1811
                self->current_player = _tmp66_;
1808
1812
        } else {
1809
 
                gchar** _tmp73_;
1810
 
                gint _tmp73__length1;
1811
 
                const gchar* _tmp74_;
1812
 
                _tmp73_ = fields;
1813
 
                _tmp73__length1 = fields_length1;
1814
 
                _tmp74_ = _tmp73_[1];
1815
 
                if (g_strcmp0 (_tmp74_, "b") == 0) {
1816
 
                        ChessPlayer* _tmp75_;
1817
 
                        ChessPlayer* _tmp76_;
1818
 
                        _tmp75_ = self->players[COLOR_BLACK];
1819
 
                        _tmp76_ = _g_object_ref0 (_tmp75_);
 
1813
                gchar** _tmp67_ = NULL;
 
1814
                gint _tmp67__length1 = 0;
 
1815
                const gchar* _tmp68_ = NULL;
 
1816
                _tmp67_ = fields;
 
1817
                _tmp67__length1 = fields_length1;
 
1818
                _tmp68_ = _tmp67_[1];
 
1819
                if (g_strcmp0 (_tmp68_, "b") == 0) {
 
1820
                        ChessPlayer* _tmp69_ = NULL;
 
1821
                        ChessPlayer* _tmp70_ = NULL;
 
1822
                        _tmp69_ = self->players[COLOR_BLACK];
 
1823
                        _tmp70_ = _g_object_ref0 (_tmp69_);
1820
1824
                        _g_object_unref0 (self->current_player);
1821
 
                        self->current_player = _tmp76_;
 
1825
                        self->current_player = _tmp70_;
1822
1826
                }
1823
1827
        }
1824
 
        _tmp77_ = fields;
1825
 
        _tmp77__length1 = fields_length1;
1826
 
        _tmp78_ = _tmp77_[2];
1827
 
        if (g_strcmp0 (_tmp78_, "-") != 0) {
 
1828
        _tmp71_ = fields;
 
1829
        _tmp71__length1 = fields_length1;
 
1830
        _tmp72_ = _tmp71_[2];
 
1831
        if (g_strcmp0 (_tmp72_, "-") != 0) {
1828
1832
                {
1829
 
                        gint i;
 
1833
                        gint i = 0;
1830
1834
                        i = 0;
1831
1835
                        {
1832
 
                                gboolean _tmp79_;
1833
 
                                _tmp79_ = TRUE;
 
1836
                                gboolean _tmp73_ = FALSE;
 
1837
                                _tmp73_ = TRUE;
1834
1838
                                while (TRUE) {
1835
 
                                        gboolean _tmp80_;
1836
 
                                        gint _tmp82_;
1837
 
                                        gchar** _tmp83_;
1838
 
                                        gint _tmp83__length1;
1839
 
                                        const gchar* _tmp84_;
1840
 
                                        gint _tmp85_;
1841
 
                                        gint _tmp86_;
1842
 
                                        gchar** _tmp87_;
1843
 
                                        gint _tmp87__length1;
1844
 
                                        const gchar* _tmp88_;
1845
 
                                        gint _tmp89_;
1846
 
                                        gchar _tmp90_ = '\0';
1847
 
                                        gchar c;
1848
 
                                        gchar _tmp91_;
1849
 
                                        _tmp80_ = _tmp79_;
1850
 
                                        if (!_tmp80_) {
1851
 
                                                gint _tmp81_;
1852
 
                                                _tmp81_ = i;
1853
 
                                                i = _tmp81_ + 1;
1854
 
                                        }
1855
 
                                        _tmp79_ = FALSE;
 
1839
                                        gint _tmp75_ = 0;
 
1840
                                        gchar** _tmp76_ = NULL;
 
1841
                                        gint _tmp76__length1 = 0;
 
1842
                                        const gchar* _tmp77_ = NULL;
 
1843
                                        gint _tmp78_ = 0;
 
1844
                                        gint _tmp79_ = 0;
 
1845
                                        gchar c = '\0';
 
1846
                                        gchar** _tmp80_ = NULL;
 
1847
                                        gint _tmp80__length1 = 0;
 
1848
                                        const gchar* _tmp81_ = NULL;
 
1849
                                        gint _tmp82_ = 0;
 
1850
                                        gchar _tmp83_ = '\0';
 
1851
                                        gchar _tmp84_ = '\0';
 
1852
                                        if (!_tmp73_) {
 
1853
                                                gint _tmp74_ = 0;
 
1854
                                                _tmp74_ = i;
 
1855
                                                i = _tmp74_ + 1;
 
1856
                                        }
 
1857
                                        _tmp73_ = FALSE;
 
1858
                                        _tmp75_ = i;
 
1859
                                        _tmp76_ = fields;
 
1860
                                        _tmp76__length1 = fields_length1;
 
1861
                                        _tmp77_ = _tmp76_[2];
 
1862
                                        _tmp78_ = strlen (_tmp77_);
 
1863
                                        _tmp79_ = _tmp78_;
 
1864
                                        if (!(_tmp75_ < _tmp79_)) {
 
1865
                                                break;
 
1866
                                        }
 
1867
                                        _tmp80_ = fields;
 
1868
                                        _tmp80__length1 = fields_length1;
 
1869
                                        _tmp81_ = _tmp80_[2];
1856
1870
                                        _tmp82_ = i;
1857
 
                                        _tmp83_ = fields;
1858
 
                                        _tmp83__length1 = fields_length1;
1859
 
                                        _tmp84_ = _tmp83_[2];
1860
 
                                        _tmp85_ = strlen (_tmp84_);
1861
 
                                        _tmp86_ = _tmp85_;
1862
 
                                        if (!(_tmp82_ < _tmp86_)) {
1863
 
                                                break;
1864
 
                                        }
1865
 
                                        _tmp87_ = fields;
1866
 
                                        _tmp87__length1 = fields_length1;
1867
 
                                        _tmp88_ = _tmp87_[2];
1868
 
                                        _tmp89_ = i;
1869
 
                                        _tmp90_ = string_get (_tmp88_, (glong) _tmp89_);
1870
 
                                        c = _tmp90_;
1871
 
                                        _tmp91_ = c;
1872
 
                                        if (_tmp91_ == 'K') {
1873
 
                                                gboolean _tmp92_;
 
1871
                                        _tmp83_ = string_get (_tmp81_, (glong) _tmp82_);
 
1872
                                        c = _tmp83_;
 
1873
                                        _tmp84_ = c;
 
1874
                                        if (_tmp84_ == 'K') {
 
1875
                                                gboolean _tmp85_ = FALSE;
1874
1876
                                                self->can_castle_kingside[COLOR_WHITE] = TRUE;
1875
 
                                                _tmp92_ = self->can_castle_kingside[COLOR_WHITE];
 
1877
                                                _tmp85_ = self->can_castle_kingside[COLOR_WHITE];
1876
1878
                                        } else {
1877
 
                                                gchar _tmp93_;
1878
 
                                                _tmp93_ = c;
1879
 
                                                if (_tmp93_ == 'Q') {
1880
 
                                                        gboolean _tmp94_;
 
1879
                                                gchar _tmp86_ = '\0';
 
1880
                                                _tmp86_ = c;
 
1881
                                                if (_tmp86_ == 'Q') {
 
1882
                                                        gboolean _tmp87_ = FALSE;
1881
1883
                                                        self->can_castle_queenside[COLOR_WHITE] = TRUE;
1882
 
                                                        _tmp94_ = self->can_castle_queenside[COLOR_WHITE];
 
1884
                                                        _tmp87_ = self->can_castle_queenside[COLOR_WHITE];
1883
1885
                                                } else {
1884
 
                                                        gchar _tmp95_;
1885
 
                                                        _tmp95_ = c;
1886
 
                                                        if (_tmp95_ == 'k') {
1887
 
                                                                gboolean _tmp96_;
 
1886
                                                        gchar _tmp88_ = '\0';
 
1887
                                                        _tmp88_ = c;
 
1888
                                                        if (_tmp88_ == 'k') {
 
1889
                                                                gboolean _tmp89_ = FALSE;
1888
1890
                                                                self->can_castle_kingside[COLOR_BLACK] = TRUE;
1889
 
                                                                _tmp96_ = self->can_castle_kingside[COLOR_BLACK];
 
1891
                                                                _tmp89_ = self->can_castle_kingside[COLOR_BLACK];
1890
1892
                                                        } else {
1891
 
                                                                gchar _tmp97_;
1892
 
                                                                _tmp97_ = c;
1893
 
                                                                if (_tmp97_ == 'q') {
1894
 
                                                                        gboolean _tmp98_;
 
1893
                                                                gchar _tmp90_ = '\0';
 
1894
                                                                _tmp90_ = c;
 
1895
                                                                if (_tmp90_ == 'q') {
 
1896
                                                                        gboolean _tmp91_ = FALSE;
1895
1897
                                                                        self->can_castle_queenside[COLOR_BLACK] = TRUE;
1896
 
                                                                        _tmp98_ = self->can_castle_queenside[COLOR_BLACK];
 
1898
                                                                        _tmp91_ = self->can_castle_queenside[COLOR_BLACK];
1897
1899
                                                                }
1898
1900
                                                        }
1899
1901
                                                }
1902
1904
                        }
1903
1905
                }
1904
1906
        }
1905
 
        _tmp99_ = fields;
1906
 
        _tmp99__length1 = fields_length1;
1907
 
        _tmp100_ = _tmp99_[3];
1908
 
        if (g_strcmp0 (_tmp100_, "-") != 0) {
1909
 
                gchar** _tmp101_;
1910
 
                gint _tmp101__length1;
1911
 
                const gchar* _tmp102_;
1912
 
                gchar _tmp103_ = '\0';
1913
 
                gchar** _tmp104_;
1914
 
                gint _tmp104__length1;
1915
 
                const gchar* _tmp105_;
1916
 
                gchar _tmp106_ = '\0';
1917
 
                gint _tmp107_ = 0;
1918
 
                _tmp101_ = fields;
1919
 
                _tmp101__length1 = fields_length1;
1920
 
                _tmp102_ = _tmp101_[3];
1921
 
                _tmp103_ = string_get (_tmp102_, (glong) 1);
1922
 
                _tmp104_ = fields;
1923
 
                _tmp104__length1 = fields_length1;
1924
 
                _tmp105_ = _tmp104_[3];
1925
 
                _tmp106_ = string_get (_tmp105_, (glong) 0);
1926
 
                _tmp107_ = chess_state_get_index (self, (gint) (_tmp103_ - '1'), (gint) (_tmp106_ - 'a'));
1927
 
                self->en_passant_index = _tmp107_;
1928
 
        }
1929
 
        _tmp108_ = fields;
1930
 
        _tmp108__length1 = fields_length1;
1931
 
        _tmp109_ = _tmp108_[4];
1932
 
        _tmp110_ = atoi (_tmp109_);
1933
 
        self->halfmove_clock = _tmp110_;
1934
 
        _tmp111_ = fields;
1935
 
        _tmp111__length1 = fields_length1;
1936
 
        _tmp112_ = _tmp111_[5];
1937
 
        _tmp113_ = atoi (_tmp112_);
1938
 
        self->number = (_tmp113_ - 1) * 2;
1939
 
        _tmp114_ = self->current_player;
1940
 
        _tmp115_ = _tmp114_->color;
1941
 
        if (_tmp115_ == COLOR_BLACK) {
1942
 
                gint _tmp116_;
1943
 
                _tmp116_ = self->number;
1944
 
                self->number = _tmp116_ + 1;
1945
 
        }
1946
 
        _tmp117_ = self->current_player;
1947
 
        _tmp118_ = chess_state_get_check_state (self, _tmp117_);
1948
 
        self->check_state = _tmp118_;
 
1907
        _tmp92_ = fields;
 
1908
        _tmp92__length1 = fields_length1;
 
1909
        _tmp93_ = _tmp92_[3];
 
1910
        if (g_strcmp0 (_tmp93_, "-") != 0) {
 
1911
                gchar** _tmp94_ = NULL;
 
1912
                gint _tmp94__length1 = 0;
 
1913
                const gchar* _tmp95_ = NULL;
 
1914
                gchar _tmp96_ = '\0';
 
1915
                gchar** _tmp97_ = NULL;
 
1916
                gint _tmp97__length1 = 0;
 
1917
                const gchar* _tmp98_ = NULL;
 
1918
                gchar _tmp99_ = '\0';
 
1919
                gint _tmp100_ = 0;
 
1920
                _tmp94_ = fields;
 
1921
                _tmp94__length1 = fields_length1;
 
1922
                _tmp95_ = _tmp94_[3];
 
1923
                _tmp96_ = string_get (_tmp95_, (glong) 1);
 
1924
                _tmp97_ = fields;
 
1925
                _tmp97__length1 = fields_length1;
 
1926
                _tmp98_ = _tmp97_[3];
 
1927
                _tmp99_ = string_get (_tmp98_, (glong) 0);
 
1928
                _tmp100_ = chess_state_get_index (self, (gint) (_tmp96_ - '1'), (gint) (_tmp99_ - 'a'));
 
1929
                self->en_passant_index = _tmp100_;
 
1930
        }
 
1931
        _tmp101_ = fields;
 
1932
        _tmp101__length1 = fields_length1;
 
1933
        _tmp102_ = _tmp101_[4];
 
1934
        _tmp103_ = atoi (_tmp102_);
 
1935
        self->halfmove_clock = _tmp103_;
 
1936
        _tmp104_ = fields;
 
1937
        _tmp104__length1 = fields_length1;
 
1938
        _tmp105_ = _tmp104_[5];
 
1939
        _tmp106_ = atoi (_tmp105_);
 
1940
        self->number = (_tmp106_ - 1) * 2;
 
1941
        _tmp107_ = self->current_player;
 
1942
        _tmp108_ = _tmp107_->color;
 
1943
        if (_tmp108_ == COLOR_BLACK) {
 
1944
                gint _tmp109_ = 0;
 
1945
                _tmp109_ = self->number;
 
1946
                self->number = _tmp109_ + 1;
 
1947
        }
 
1948
        _tmp110_ = self->current_player;
 
1949
        _tmp111_ = chess_state_get_check_state (self, _tmp110_);
 
1950
        self->check_state = _tmp111_;
1949
1951
        ranks = (_vala_array_free (ranks, ranks_length1, (GDestroyNotify) g_free), NULL);
1950
1952
        fields = (_vala_array_free (fields, fields_length1, (GDestroyNotify) g_free), NULL);
1951
1953
        return self;
1959
1961
 
1960
1962
ChessState* chess_state_copy (ChessState* self) {
1961
1963
        ChessState* result = NULL;
1962
 
        ChessState* _tmp0_;
1963
 
        ChessState* state;
1964
 
        ChessState* _tmp1_;
1965
 
        gint _tmp2_;
1966
 
        ChessState* _tmp3_;
1967
 
        ChessPlayer* _tmp4_;
1968
 
        ChessPlayer* _tmp5_;
1969
 
        ChessPlayer* _tmp6_;
1970
 
        ChessState* _tmp7_;
1971
 
        ChessPlayer* _tmp8_;
1972
 
        ChessPlayer* _tmp9_;
1973
 
        ChessPlayer* _tmp10_;
1974
 
        ChessState* _tmp11_;
1975
 
        ChessPlayer* _tmp12_;
1976
 
        ChessPlayer* _tmp13_;
1977
 
        ChessState* _tmp14_;
1978
 
        gboolean _tmp15_;
1979
 
        gboolean _tmp16_;
1980
 
        ChessState* _tmp17_;
1981
 
        gboolean _tmp18_;
1982
 
        gboolean _tmp19_;
1983
 
        ChessState* _tmp20_;
1984
 
        gboolean _tmp21_;
1985
 
        gboolean _tmp22_;
1986
 
        ChessState* _tmp23_;
1987
 
        gboolean _tmp24_;
1988
 
        gboolean _tmp25_;
1989
 
        ChessState* _tmp26_;
1990
 
        gint _tmp27_;
1991
 
        ChessState* _tmp28_;
1992
 
        CheckState _tmp29_;
1993
 
        ChessMove* _tmp30_;
1994
 
        ChessState* _tmp44_;
1995
 
        gint64 _tmp45_;
1996
 
        gint64 _tmp46_;
1997
 
        ChessState* _tmp47_;
1998
 
        gint64 _tmp48_;
1999
 
        gint64 _tmp49_;
 
1964
        ChessState* state = NULL;
 
1965
        ChessState* _tmp0_ = NULL;
 
1966
        ChessState* _tmp1_ = NULL;
 
1967
        gint _tmp2_ = 0;
 
1968
        ChessState* _tmp3_ = NULL;
 
1969
        ChessPlayer* _tmp4_ = NULL;
 
1970
        ChessPlayer* _tmp5_ = NULL;
 
1971
        ChessPlayer* _tmp6_ = NULL;
 
1972
        ChessState* _tmp7_ = NULL;
 
1973
        ChessPlayer* _tmp8_ = NULL;
 
1974
        ChessPlayer* _tmp9_ = NULL;
 
1975
        ChessPlayer* _tmp10_ = NULL;
 
1976
        ChessState* _tmp11_ = NULL;
 
1977
        ChessPlayer* _tmp12_ = NULL;
 
1978
        ChessPlayer* _tmp13_ = NULL;
 
1979
        ChessState* _tmp14_ = NULL;
 
1980
        gboolean _tmp15_ = FALSE;
 
1981
        gboolean _tmp16_ = FALSE;
 
1982
        ChessState* _tmp17_ = NULL;
 
1983
        gboolean _tmp18_ = FALSE;
 
1984
        gboolean _tmp19_ = FALSE;
 
1985
        ChessState* _tmp20_ = NULL;
 
1986
        gboolean _tmp21_ = FALSE;
 
1987
        gboolean _tmp22_ = FALSE;
 
1988
        ChessState* _tmp23_ = NULL;
 
1989
        gboolean _tmp24_ = FALSE;
 
1990
        gboolean _tmp25_ = FALSE;
 
1991
        ChessState* _tmp26_ = NULL;
 
1992
        gint _tmp27_ = 0;
 
1993
        ChessState* _tmp28_ = NULL;
 
1994
        CheckState _tmp29_ = 0;
 
1995
        ChessMove* _tmp30_ = NULL;
 
1996
        ChessState* _tmp43_ = NULL;
 
1997
        gint64 _tmp44_ = 0LL;
 
1998
        gint64 _tmp45_ = 0LL;
 
1999
        ChessState* _tmp46_ = NULL;
 
2000
        gint64 _tmp47_ = 0LL;
 
2001
        gint64 _tmp48_ = 0LL;
 
2002
        ChessState* _tmp49_ = NULL;
 
2003
        gint _tmp50_ = 0;
2000
2004
        g_return_val_if_fail (self != NULL, NULL);
2001
2005
        _tmp0_ = chess_state_new_empty ();
2002
2006
        state = _tmp0_;
2044
2048
        _tmp28_->check_state = _tmp29_;
2045
2049
        _tmp30_ = self->last_move;
2046
2050
        if (_tmp30_ != NULL) {
2047
 
                ChessState* _tmp31_;
2048
 
                ChessMove* _tmp32_;
 
2051
                ChessState* _tmp31_ = NULL;
 
2052
                ChessMove* _tmp32_ = NULL;
2049
2053
                ChessMove* _tmp33_ = NULL;
2050
2054
                _tmp31_ = state;
2051
2055
                _tmp32_ = self->last_move;
2054
2058
                _tmp31_->last_move = _tmp33_;
2055
2059
        }
2056
2060
        {
2057
 
                gint i;
 
2061
                gint i = 0;
2058
2062
                i = 0;
2059
2063
                {
2060
 
                        gboolean _tmp34_;
 
2064
                        gboolean _tmp34_ = FALSE;
2061
2065
                        _tmp34_ = TRUE;
2062
2066
                        while (TRUE) {
2063
 
                                gboolean _tmp35_;
2064
 
                                gint _tmp37_;
2065
 
                                ChessState* _tmp38_;
2066
 
                                gint _tmp39_;
2067
 
                                gint _tmp40_;
2068
 
                                ChessPiece* _tmp41_;
2069
 
                                ChessPiece* _tmp42_;
2070
 
                                ChessPiece* _tmp43_;
2071
 
                                _tmp35_ = _tmp34_;
2072
 
                                if (!_tmp35_) {
2073
 
                                        gint _tmp36_;
2074
 
                                        _tmp36_ = i;
2075
 
                                        i = _tmp36_ + 1;
 
2067
                                gint _tmp36_ = 0;
 
2068
                                ChessState* _tmp37_ = NULL;
 
2069
                                gint _tmp38_ = 0;
 
2070
                                gint _tmp39_ = 0;
 
2071
                                ChessPiece* _tmp40_ = NULL;
 
2072
                                ChessPiece* _tmp41_ = NULL;
 
2073
                                ChessPiece* _tmp42_ = NULL;
 
2074
                                if (!_tmp34_) {
 
2075
                                        gint _tmp35_ = 0;
 
2076
                                        _tmp35_ = i;
 
2077
                                        i = _tmp35_ + 1;
2076
2078
                                }
2077
2079
                                _tmp34_ = FALSE;
2078
 
                                _tmp37_ = i;
2079
 
                                if (!(_tmp37_ < 64)) {
 
2080
                                _tmp36_ = i;
 
2081
                                if (!(_tmp36_ < 64)) {
2080
2082
                                        break;
2081
2083
                                }
2082
 
                                _tmp38_ = state;
 
2084
                                _tmp37_ = state;
 
2085
                                _tmp38_ = i;
2083
2086
                                _tmp39_ = i;
2084
 
                                _tmp40_ = i;
2085
 
                                _tmp41_ = self->board[_tmp40_];
2086
 
                                _tmp42_ = _chess_piece_ref0 (_tmp41_);
2087
 
                                _chess_piece_unref0 (_tmp38_->board[_tmp39_]);
2088
 
                                _tmp38_->board[_tmp39_] = _tmp42_;
2089
 
                                _tmp43_ = _tmp38_->board[_tmp39_];
 
2087
                                _tmp40_ = self->board[_tmp39_];
 
2088
                                _tmp41_ = _chess_piece_ref0 (_tmp40_);
 
2089
                                _chess_piece_unref0 (_tmp37_->board[_tmp38_]);
 
2090
                                _tmp37_->board[_tmp38_] = _tmp41_;
 
2091
                                _tmp42_ = _tmp37_->board[_tmp38_];
2090
2092
                        }
2091
2093
                }
2092
2094
        }
2093
 
        _tmp44_ = state;
2094
 
        _tmp45_ = self->priv->piece_masks[COLOR_WHITE];
2095
 
        _tmp44_->priv->piece_masks[COLOR_WHITE] = _tmp45_;
2096
 
        _tmp46_ = _tmp44_->priv->piece_masks[COLOR_WHITE];
2097
 
        _tmp47_ = state;
2098
 
        _tmp48_ = self->priv->piece_masks[COLOR_BLACK];
2099
 
        _tmp47_->priv->piece_masks[COLOR_BLACK] = _tmp48_;
2100
 
        _tmp49_ = _tmp47_->priv->piece_masks[COLOR_BLACK];
 
2095
        _tmp43_ = state;
 
2096
        _tmp44_ = self->priv->piece_masks[COLOR_WHITE];
 
2097
        _tmp43_->priv->piece_masks[COLOR_WHITE] = _tmp44_;
 
2098
        _tmp45_ = _tmp43_->priv->piece_masks[COLOR_WHITE];
 
2099
        _tmp46_ = state;
 
2100
        _tmp47_ = self->priv->piece_masks[COLOR_BLACK];
 
2101
        _tmp46_->priv->piece_masks[COLOR_BLACK] = _tmp47_;
 
2102
        _tmp48_ = _tmp46_->priv->piece_masks[COLOR_BLACK];
 
2103
        _tmp49_ = state;
 
2104
        _tmp50_ = self->halfmove_clock;
 
2105
        _tmp49_->halfmove_clock = _tmp50_;
2101
2106
        result = state;
2102
2107
        return result;
2103
2108
}
2112
2117
        gboolean _tmp4_ = FALSE;
2113
2118
        gboolean _tmp5_ = FALSE;
2114
2119
        gboolean _tmp6_ = FALSE;
2115
 
        gboolean _tmp7_ = FALSE;
2116
 
        gboolean _tmp8_ = FALSE;
2117
 
        gboolean _tmp9_ = FALSE;
2118
 
        gboolean _tmp10_ = FALSE;
2119
 
        gboolean _tmp11_ = FALSE;
2120
 
        gint64 _tmp12_;
2121
 
        ChessState* _tmp13_;
2122
 
        gint64 _tmp14_;
2123
 
        gboolean _tmp18_;
2124
 
        gboolean _tmp22_;
2125
 
        gboolean _tmp26_;
2126
 
        gboolean _tmp30_;
2127
 
        gboolean _tmp34_;
2128
 
        gboolean _tmp38_;
2129
 
        gboolean _tmp42_;
2130
 
        gboolean _tmp50_;
2131
 
        gboolean _tmp56_;
2132
 
        gboolean _tmp62_;
2133
 
        gboolean _tmp68_;
2134
 
        gboolean _tmp74_;
 
2120
        gint64 _tmp7_ = 0LL;
 
2121
        ChessState* _tmp8_ = NULL;
 
2122
        gint64 _tmp9_ = 0LL;
2135
2123
        g_return_val_if_fail (self != NULL, FALSE);
2136
2124
        g_return_val_if_fail (state != NULL, FALSE);
2137
 
        _tmp12_ = self->priv->piece_masks[COLOR_WHITE];
2138
 
        _tmp13_ = state;
2139
 
        _tmp14_ = _tmp13_->priv->piece_masks[COLOR_WHITE];
2140
 
        if (_tmp12_ != _tmp14_) {
2141
 
                _tmp11_ = TRUE;
2142
 
        } else {
2143
 
                gint64 _tmp15_;
2144
 
                ChessState* _tmp16_;
2145
 
                gint64 _tmp17_;
2146
 
                _tmp15_ = self->priv->piece_masks[COLOR_BLACK];
2147
 
                _tmp16_ = state;
2148
 
                _tmp17_ = _tmp16_->priv->piece_masks[COLOR_BLACK];
2149
 
                _tmp11_ = _tmp15_ != _tmp17_;
2150
 
        }
2151
 
        _tmp18_ = _tmp11_;
2152
 
        if (_tmp18_) {
2153
 
                _tmp10_ = TRUE;
2154
 
        } else {
2155
 
                gboolean _tmp19_;
2156
 
                ChessState* _tmp20_;
2157
 
                gboolean _tmp21_;
2158
 
                _tmp19_ = self->can_castle_kingside[COLOR_WHITE];
2159
 
                _tmp20_ = state;
2160
 
                _tmp21_ = _tmp20_->can_castle_kingside[COLOR_WHITE];
2161
 
                _tmp10_ = _tmp19_ != _tmp21_;
2162
 
        }
2163
 
        _tmp22_ = _tmp10_;
2164
 
        if (_tmp22_) {
2165
 
                _tmp9_ = TRUE;
2166
 
        } else {
2167
 
                gboolean _tmp23_;
2168
 
                ChessState* _tmp24_;
2169
 
                gboolean _tmp25_;
2170
 
                _tmp23_ = self->can_castle_queenside[COLOR_WHITE];
2171
 
                _tmp24_ = state;
2172
 
                _tmp25_ = _tmp24_->can_castle_queenside[COLOR_WHITE];
2173
 
                _tmp9_ = _tmp23_ != _tmp25_;
2174
 
        }
2175
 
        _tmp26_ = _tmp9_;
2176
 
        if (_tmp26_) {
2177
 
                _tmp8_ = TRUE;
2178
 
        } else {
2179
 
                gboolean _tmp27_;
2180
 
                ChessState* _tmp28_;
2181
 
                gboolean _tmp29_;
2182
 
                _tmp27_ = self->can_castle_kingside[COLOR_BLACK];
2183
 
                _tmp28_ = state;
2184
 
                _tmp29_ = _tmp28_->can_castle_kingside[COLOR_BLACK];
2185
 
                _tmp8_ = _tmp27_ != _tmp29_;
2186
 
        }
2187
 
        _tmp30_ = _tmp8_;
2188
 
        if (_tmp30_) {
2189
 
                _tmp7_ = TRUE;
2190
 
        } else {
2191
 
                gboolean _tmp31_;
2192
 
                ChessState* _tmp32_;
2193
 
                gboolean _tmp33_;
2194
 
                _tmp31_ = self->can_castle_queenside[COLOR_BLACK];
2195
 
                _tmp32_ = state;
2196
 
                _tmp33_ = _tmp32_->can_castle_queenside[COLOR_BLACK];
2197
 
                _tmp7_ = _tmp31_ != _tmp33_;
2198
 
        }
2199
 
        _tmp34_ = _tmp7_;
2200
 
        if (_tmp34_) {
 
2125
        _tmp7_ = self->priv->piece_masks[COLOR_WHITE];
 
2126
        _tmp8_ = state;
 
2127
        _tmp9_ = _tmp8_->priv->piece_masks[COLOR_WHITE];
 
2128
        if (_tmp7_ != _tmp9_) {
2201
2129
                _tmp6_ = TRUE;
2202
2130
        } else {
2203
 
                gint _tmp35_;
2204
 
                ChessState* _tmp36_;
2205
 
                gint _tmp37_;
2206
 
                _tmp35_ = self->en_passant_index;
2207
 
                _tmp36_ = state;
2208
 
                _tmp37_ = _tmp36_->en_passant_index;
2209
 
                _tmp6_ = _tmp35_ != _tmp37_;
 
2131
                gint64 _tmp10_ = 0LL;
 
2132
                ChessState* _tmp11_ = NULL;
 
2133
                gint64 _tmp12_ = 0LL;
 
2134
                _tmp10_ = self->priv->piece_masks[COLOR_BLACK];
 
2135
                _tmp11_ = state;
 
2136
                _tmp12_ = _tmp11_->priv->piece_masks[COLOR_BLACK];
 
2137
                _tmp6_ = _tmp10_ != _tmp12_;
2210
2138
        }
2211
 
        _tmp38_ = _tmp6_;
2212
 
        if (_tmp38_) {
 
2139
        if (_tmp6_) {
2213
2140
                _tmp5_ = TRUE;
2214
2141
        } else {
2215
 
                ChessMove* _tmp39_;
2216
 
                ChessState* _tmp40_;
2217
 
                ChessMove* _tmp41_;
2218
 
                _tmp39_ = self->last_move;
2219
 
                _tmp40_ = state;
2220
 
                _tmp41_ = _tmp40_->last_move;
2221
 
                _tmp5_ = (_tmp39_ != NULL) != (_tmp41_ != NULL);
 
2142
                ChessPlayer* _tmp13_ = NULL;
 
2143
                Color _tmp14_ = 0;
 
2144
                ChessState* _tmp15_ = NULL;
 
2145
                ChessPlayer* _tmp16_ = NULL;
 
2146
                Color _tmp17_ = 0;
 
2147
                _tmp13_ = self->current_player;
 
2148
                _tmp14_ = _tmp13_->color;
 
2149
                _tmp15_ = state;
 
2150
                _tmp16_ = _tmp15_->current_player;
 
2151
                _tmp17_ = _tmp16_->color;
 
2152
                _tmp5_ = _tmp14_ != _tmp17_;
2222
2153
        }
2223
 
        _tmp42_ = _tmp5_;
2224
 
        if (_tmp42_) {
 
2154
        if (_tmp5_) {
2225
2155
                _tmp4_ = TRUE;
2226
2156
        } else {
2227
 
                ChessMove* _tmp43_;
2228
 
                ChessPiece* _tmp44_;
2229
 
                PieceType _tmp45_;
2230
 
                ChessState* _tmp46_;
2231
 
                ChessMove* _tmp47_;
2232
 
                ChessPiece* _tmp48_;
2233
 
                PieceType _tmp49_;
2234
 
                _tmp43_ = self->last_move;
2235
 
                _tmp44_ = _tmp43_->piece;
2236
 
                _tmp45_ = _tmp44_->type;
2237
 
                _tmp46_ = state;
2238
 
                _tmp47_ = _tmp46_->last_move;
2239
 
                _tmp48_ = _tmp47_->piece;
2240
 
                _tmp49_ = _tmp48_->type;
2241
 
                _tmp4_ = _tmp45_ != _tmp49_;
 
2157
                gboolean _tmp18_ = FALSE;
 
2158
                ChessState* _tmp19_ = NULL;
 
2159
                gboolean _tmp20_ = FALSE;
 
2160
                _tmp18_ = self->can_castle_kingside[COLOR_WHITE];
 
2161
                _tmp19_ = state;
 
2162
                _tmp20_ = _tmp19_->can_castle_kingside[COLOR_WHITE];
 
2163
                _tmp4_ = _tmp18_ != _tmp20_;
2242
2164
        }
2243
 
        _tmp50_ = _tmp4_;
2244
 
        if (_tmp50_) {
 
2165
        if (_tmp4_) {
2245
2166
                _tmp3_ = TRUE;
2246
2167
        } else {
2247
 
                ChessMove* _tmp51_;
2248
 
                gint _tmp52_;
2249
 
                ChessState* _tmp53_;
2250
 
                ChessMove* _tmp54_;
2251
 
                gint _tmp55_;
2252
 
                _tmp51_ = self->last_move;
2253
 
                _tmp52_ = _tmp51_->r0;
2254
 
                _tmp53_ = state;
2255
 
                _tmp54_ = _tmp53_->last_move;
2256
 
                _tmp55_ = _tmp54_->r0;
2257
 
                _tmp3_ = _tmp52_ != _tmp55_;
 
2168
                gboolean _tmp21_ = FALSE;
 
2169
                ChessState* _tmp22_ = NULL;
 
2170
                gboolean _tmp23_ = FALSE;
 
2171
                _tmp21_ = self->can_castle_queenside[COLOR_WHITE];
 
2172
                _tmp22_ = state;
 
2173
                _tmp23_ = _tmp22_->can_castle_queenside[COLOR_WHITE];
 
2174
                _tmp3_ = _tmp21_ != _tmp23_;
2258
2175
        }
2259
 
        _tmp56_ = _tmp3_;
2260
 
        if (_tmp56_) {
 
2176
        if (_tmp3_) {
2261
2177
                _tmp2_ = TRUE;
2262
2178
        } else {
2263
 
                ChessMove* _tmp57_;
2264
 
                gint _tmp58_;
2265
 
                ChessState* _tmp59_;
2266
 
                ChessMove* _tmp60_;
2267
 
                gint _tmp61_;
2268
 
                _tmp57_ = self->last_move;
2269
 
                _tmp58_ = _tmp57_->f0;
2270
 
                _tmp59_ = state;
2271
 
                _tmp60_ = _tmp59_->last_move;
2272
 
                _tmp61_ = _tmp60_->f0;
2273
 
                _tmp2_ = _tmp58_ != _tmp61_;
 
2179
                gboolean _tmp24_ = FALSE;
 
2180
                ChessState* _tmp25_ = NULL;
 
2181
                gboolean _tmp26_ = FALSE;
 
2182
                _tmp24_ = self->can_castle_kingside[COLOR_BLACK];
 
2183
                _tmp25_ = state;
 
2184
                _tmp26_ = _tmp25_->can_castle_kingside[COLOR_BLACK];
 
2185
                _tmp2_ = _tmp24_ != _tmp26_;
2274
2186
        }
2275
 
        _tmp62_ = _tmp2_;
2276
 
        if (_tmp62_) {
 
2187
        if (_tmp2_) {
2277
2188
                _tmp1_ = TRUE;
2278
2189
        } else {
2279
 
                ChessMove* _tmp63_;
2280
 
                gint _tmp64_;
2281
 
                ChessState* _tmp65_;
2282
 
                ChessMove* _tmp66_;
2283
 
                gint _tmp67_;
2284
 
                _tmp63_ = self->last_move;
2285
 
                _tmp64_ = _tmp63_->r1;
2286
 
                _tmp65_ = state;
2287
 
                _tmp66_ = _tmp65_->last_move;
2288
 
                _tmp67_ = _tmp66_->r1;
2289
 
                _tmp1_ = _tmp64_ != _tmp67_;
 
2190
                gboolean _tmp27_ = FALSE;
 
2191
                ChessState* _tmp28_ = NULL;
 
2192
                gboolean _tmp29_ = FALSE;
 
2193
                _tmp27_ = self->can_castle_queenside[COLOR_BLACK];
 
2194
                _tmp28_ = state;
 
2195
                _tmp29_ = _tmp28_->can_castle_queenside[COLOR_BLACK];
 
2196
                _tmp1_ = _tmp27_ != _tmp29_;
2290
2197
        }
2291
 
        _tmp68_ = _tmp1_;
2292
 
        if (_tmp68_) {
 
2198
        if (_tmp1_) {
2293
2199
                _tmp0_ = TRUE;
2294
2200
        } else {
2295
 
                ChessMove* _tmp69_;
2296
 
                gint _tmp70_;
2297
 
                ChessState* _tmp71_;
2298
 
                ChessMove* _tmp72_;
2299
 
                gint _tmp73_;
2300
 
                _tmp69_ = self->last_move;
2301
 
                _tmp70_ = _tmp69_->f1;
2302
 
                _tmp71_ = state;
2303
 
                _tmp72_ = _tmp71_->last_move;
2304
 
                _tmp73_ = _tmp72_->f1;
2305
 
                _tmp0_ = _tmp70_ != _tmp73_;
 
2201
                gint _tmp30_ = 0;
 
2202
                ChessState* _tmp31_ = NULL;
 
2203
                gint _tmp32_ = 0;
 
2204
                _tmp30_ = self->en_passant_index;
 
2205
                _tmp31_ = state;
 
2206
                _tmp32_ = _tmp31_->en_passant_index;
 
2207
                _tmp0_ = _tmp30_ != _tmp32_;
2306
2208
        }
2307
 
        _tmp74_ = _tmp0_;
2308
 
        if (_tmp74_) {
 
2209
        if (_tmp0_) {
2309
2210
                result = FALSE;
2310
2211
                return result;
2311
2212
        }
2312
2213
        {
2313
 
                gint i;
 
2214
                gint i = 0;
2314
2215
                i = 0;
2315
2216
                {
2316
 
                        gboolean _tmp75_;
2317
 
                        _tmp75_ = TRUE;
 
2217
                        gboolean _tmp33_ = FALSE;
 
2218
                        _tmp33_ = TRUE;
2318
2219
                        while (TRUE) {
2319
 
                                gboolean _tmp76_;
2320
 
                                gint _tmp78_;
2321
 
                                gboolean _tmp79_ = FALSE;
2322
 
                                gint _tmp80_;
2323
 
                                ChessPiece* _tmp81_;
2324
 
                                gboolean _tmp89_;
2325
 
                                _tmp76_ = _tmp75_;
2326
 
                                if (!_tmp76_) {
2327
 
                                        gint _tmp77_;
2328
 
                                        _tmp77_ = i;
2329
 
                                        i = _tmp77_ + 1;
 
2220
                                gint _tmp35_ = 0;
 
2221
                                gboolean _tmp36_ = FALSE;
 
2222
                                gint _tmp37_ = 0;
 
2223
                                ChessPiece* _tmp38_ = NULL;
 
2224
                                if (!_tmp33_) {
 
2225
                                        gint _tmp34_ = 0;
 
2226
                                        _tmp34_ = i;
 
2227
                                        i = _tmp34_ + 1;
2330
2228
                                }
2331
 
                                _tmp75_ = FALSE;
2332
 
                                _tmp78_ = i;
2333
 
                                if (!(_tmp78_ < 64)) {
 
2229
                                _tmp33_ = FALSE;
 
2230
                                _tmp35_ = i;
 
2231
                                if (!(_tmp35_ < 64)) {
2334
2232
                                        break;
2335
2233
                                }
2336
 
                                _tmp80_ = i;
2337
 
                                _tmp81_ = self->board[_tmp80_];
2338
 
                                if (_tmp81_ != NULL) {
2339
 
                                        gint _tmp82_;
2340
 
                                        ChessPiece* _tmp83_;
2341
 
                                        PieceType _tmp84_;
2342
 
                                        ChessState* _tmp85_;
2343
 
                                        gint _tmp86_;
2344
 
                                        ChessPiece* _tmp87_;
2345
 
                                        PieceType _tmp88_;
2346
 
                                        _tmp82_ = i;
2347
 
                                        _tmp83_ = self->board[_tmp82_];
2348
 
                                        _tmp84_ = _tmp83_->type;
2349
 
                                        _tmp85_ = state;
2350
 
                                        _tmp86_ = i;
2351
 
                                        _tmp87_ = _tmp85_->board[_tmp86_];
2352
 
                                        _tmp88_ = _tmp87_->type;
2353
 
                                        _tmp79_ = _tmp84_ != _tmp88_;
 
2234
                                _tmp37_ = i;
 
2235
                                _tmp38_ = self->board[_tmp37_];
 
2236
                                if (_tmp38_ != NULL) {
 
2237
                                        gint _tmp39_ = 0;
 
2238
                                        ChessPiece* _tmp40_ = NULL;
 
2239
                                        PieceType _tmp41_ = 0;
 
2240
                                        ChessState* _tmp42_ = NULL;
 
2241
                                        gint _tmp43_ = 0;
 
2242
                                        ChessPiece* _tmp44_ = NULL;
 
2243
                                        PieceType _tmp45_ = 0;
 
2244
                                        _tmp39_ = i;
 
2245
                                        _tmp40_ = self->board[_tmp39_];
 
2246
                                        _tmp41_ = _tmp40_->type;
 
2247
                                        _tmp42_ = state;
 
2248
                                        _tmp43_ = i;
 
2249
                                        _tmp44_ = _tmp42_->board[_tmp43_];
 
2250
                                        _tmp45_ = _tmp44_->type;
 
2251
                                        _tmp36_ = _tmp41_ != _tmp45_;
2354
2252
                                } else {
2355
 
                                        _tmp79_ = FALSE;
 
2253
                                        _tmp36_ = FALSE;
2356
2254
                                }
2357
 
                                _tmp89_ = _tmp79_;
2358
 
                                if (_tmp89_) {
 
2255
                                if (_tmp36_) {
2359
2256
                                        result = FALSE;
2360
2257
                                        return result;
2361
2258
                                }
2369
2266
 
2370
2267
gchar* chess_state_get_fen (ChessState* self) {
2371
2268
        gchar* result = NULL;
2372
 
        GString* _tmp0_;
2373
 
        GString* value;
2374
 
        GString* _tmp28_;
2375
 
        ChessPlayer* _tmp29_;
2376
 
        Color _tmp30_;
2377
 
        GString* _tmp33_;
2378
 
        gboolean _tmp34_;
2379
 
        gboolean _tmp36_;
2380
 
        gboolean _tmp38_;
2381
 
        gboolean _tmp40_;
2382
 
        gboolean _tmp42_;
2383
 
        gboolean _tmp43_;
2384
 
        gboolean _tmp44_;
2385
 
        gboolean _tmp45_;
2386
 
        GString* _tmp47_;
2387
 
        gint _tmp48_;
2388
 
        GString* _tmp55_;
2389
 
        GString* _tmp56_;
2390
 
        gint _tmp57_;
2391
 
        GString* _tmp58_;
2392
 
        ChessPlayer* _tmp59_;
2393
 
        Color _tmp60_;
2394
 
        GString* _tmp65_;
2395
 
        const gchar* _tmp66_;
2396
 
        gchar* _tmp67_;
 
2269
        GString* value = NULL;
 
2270
        GString* _tmp0_ = NULL;
 
2271
        GString* _tmp26_ = NULL;
 
2272
        ChessPlayer* _tmp27_ = NULL;
 
2273
        Color _tmp28_ = 0;
 
2274
        GString* _tmp31_ = NULL;
 
2275
        gboolean _tmp32_ = FALSE;
 
2276
        gboolean _tmp34_ = FALSE;
 
2277
        gboolean _tmp36_ = FALSE;
 
2278
        gboolean _tmp38_ = FALSE;
 
2279
        gboolean _tmp40_ = FALSE;
 
2280
        gboolean _tmp41_ = FALSE;
 
2281
        gboolean _tmp42_ = FALSE;
 
2282
        gboolean _tmp43_ = FALSE;
 
2283
        GString* _tmp45_ = NULL;
 
2284
        gint _tmp46_ = 0;
 
2285
        GString* _tmp53_ = NULL;
 
2286
        GString* _tmp54_ = NULL;
 
2287
        gint _tmp55_ = 0;
 
2288
        GString* _tmp56_ = NULL;
 
2289
        ChessPlayer* _tmp57_ = NULL;
 
2290
        Color _tmp58_ = 0;
 
2291
        GString* _tmp63_ = NULL;
 
2292
        const gchar* _tmp64_ = NULL;
 
2293
        gchar* _tmp65_ = NULL;
2397
2294
        g_return_val_if_fail (self != NULL, NULL);
2398
2295
        _tmp0_ = g_string_new ("");
2399
2296
        value = _tmp0_;
2400
2297
        {
2401
 
                gint rank;
 
2298
                gint rank = 0;
2402
2299
                rank = 7;
2403
2300
                {
2404
 
                        gboolean _tmp1_;
 
2301
                        gboolean _tmp1_ = FALSE;
2405
2302
                        _tmp1_ = TRUE;
2406
2303
                        while (TRUE) {
2407
 
                                gboolean _tmp2_;
2408
 
                                gint _tmp4_;
2409
 
                                gint skip_count;
2410
 
                                gint _tmp23_;
2411
 
                                gint _tmp26_;
2412
 
                                _tmp2_ = _tmp1_;
2413
 
                                if (!_tmp2_) {
2414
 
                                        gint _tmp3_;
2415
 
                                        _tmp3_ = rank;
2416
 
                                        rank = _tmp3_ - 1;
 
2304
                                gint _tmp3_ = 0;
 
2305
                                gint skip_count = 0;
 
2306
                                gint _tmp21_ = 0;
 
2307
                                gint _tmp24_ = 0;
 
2308
                                if (!_tmp1_) {
 
2309
                                        gint _tmp2_ = 0;
 
2310
                                        _tmp2_ = rank;
 
2311
                                        rank = _tmp2_ - 1;
2417
2312
                                }
2418
2313
                                _tmp1_ = FALSE;
2419
 
                                _tmp4_ = rank;
2420
 
                                if (!(_tmp4_ >= 0)) {
 
2314
                                _tmp3_ = rank;
 
2315
                                if (!(_tmp3_ >= 0)) {
2421
2316
                                        break;
2422
2317
                                }
2423
2318
                                skip_count = 0;
2424
2319
                                {
2425
 
                                        gint file;
 
2320
                                        gint file = 0;
2426
2321
                                        file = 0;
2427
2322
                                        {
2428
 
                                                gboolean _tmp5_;
2429
 
                                                _tmp5_ = TRUE;
 
2323
                                                gboolean _tmp4_ = FALSE;
 
2324
                                                _tmp4_ = TRUE;
2430
2325
                                                while (TRUE) {
2431
 
                                                        gboolean _tmp6_;
2432
 
                                                        gint _tmp8_;
2433
 
                                                        gint _tmp9_;
2434
 
                                                        gint _tmp10_;
2435
 
                                                        gint _tmp11_ = 0;
2436
 
                                                        ChessPiece* _tmp12_;
2437
 
                                                        ChessPiece* _tmp13_;
2438
 
                                                        ChessPiece* p;
2439
 
                                                        ChessPiece* _tmp14_;
2440
 
                                                        _tmp6_ = _tmp5_;
2441
 
                                                        if (!_tmp6_) {
2442
 
                                                                gint _tmp7_;
2443
 
                                                                _tmp7_ = file;
2444
 
                                                                file = _tmp7_ + 1;
2445
 
                                                        }
2446
 
                                                        _tmp5_ = FALSE;
 
2326
                                                        gint _tmp6_ = 0;
 
2327
                                                        ChessPiece* p = NULL;
 
2328
                                                        gint _tmp7_ = 0;
 
2329
                                                        gint _tmp8_ = 0;
 
2330
                                                        gint _tmp9_ = 0;
 
2331
                                                        ChessPiece* _tmp10_ = NULL;
 
2332
                                                        ChessPiece* _tmp11_ = NULL;
 
2333
                                                        ChessPiece* _tmp12_ = NULL;
 
2334
                                                        if (!_tmp4_) {
 
2335
                                                                gint _tmp5_ = 0;
 
2336
                                                                _tmp5_ = file;
 
2337
                                                                file = _tmp5_ + 1;
 
2338
                                                        }
 
2339
                                                        _tmp4_ = FALSE;
 
2340
                                                        _tmp6_ = file;
 
2341
                                                        if (!(_tmp6_ < 8)) {
 
2342
                                                                break;
 
2343
                                                        }
 
2344
                                                        _tmp7_ = rank;
2447
2345
                                                        _tmp8_ = file;
2448
 
                                                        if (!(_tmp8_ < 8)) {
2449
 
                                                                break;
2450
 
                                                        }
2451
 
                                                        _tmp9_ = rank;
2452
 
                                                        _tmp10_ = file;
2453
 
                                                        _tmp11_ = chess_state_get_index (self, _tmp9_, _tmp10_);
2454
 
                                                        _tmp12_ = self->board[_tmp11_];
2455
 
                                                        _tmp13_ = _chess_piece_ref0 (_tmp12_);
2456
 
                                                        p = _tmp13_;
2457
 
                                                        _tmp14_ = p;
2458
 
                                                        if (_tmp14_ == NULL) {
2459
 
                                                                gint _tmp15_;
2460
 
                                                                _tmp15_ = skip_count;
2461
 
                                                                skip_count = _tmp15_ + 1;
 
2346
                                                        _tmp9_ = chess_state_get_index (self, _tmp7_, _tmp8_);
 
2347
                                                        _tmp10_ = self->board[_tmp9_];
 
2348
                                                        _tmp11_ = _chess_piece_ref0 (_tmp10_);
 
2349
                                                        p = _tmp11_;
 
2350
                                                        _tmp12_ = p;
 
2351
                                                        if (_tmp12_ == NULL) {
 
2352
                                                                gint _tmp13_ = 0;
 
2353
                                                                _tmp13_ = skip_count;
 
2354
                                                                skip_count = _tmp13_ + 1;
2462
2355
                                                        } else {
2463
 
                                                                gint _tmp16_;
2464
 
                                                                GString* _tmp19_;
2465
 
                                                                ChessPiece* _tmp20_;
2466
 
                                                                gunichar _tmp21_;
2467
 
                                                                gunichar _tmp22_;
2468
 
                                                                _tmp16_ = skip_count;
2469
 
                                                                if (_tmp16_ > 0) {
2470
 
                                                                        GString* _tmp17_;
2471
 
                                                                        gint _tmp18_;
2472
 
                                                                        _tmp17_ = value;
2473
 
                                                                        _tmp18_ = skip_count;
2474
 
                                                                        g_string_append_printf (_tmp17_, "%d", _tmp18_);
 
2356
                                                                gint _tmp14_ = 0;
 
2357
                                                                GString* _tmp17_ = NULL;
 
2358
                                                                ChessPiece* _tmp18_ = NULL;
 
2359
                                                                gunichar _tmp19_ = 0U;
 
2360
                                                                gunichar _tmp20_ = 0U;
 
2361
                                                                _tmp14_ = skip_count;
 
2362
                                                                if (_tmp14_ > 0) {
 
2363
                                                                        GString* _tmp15_ = NULL;
 
2364
                                                                        gint _tmp16_ = 0;
 
2365
                                                                        _tmp15_ = value;
 
2366
                                                                        _tmp16_ = skip_count;
 
2367
                                                                        g_string_append_printf (_tmp15_, "%d", _tmp16_);
2475
2368
                                                                        skip_count = 0;
2476
2369
                                                                }
2477
 
                                                                _tmp19_ = value;
2478
 
                                                                _tmp20_ = p;
2479
 
                                                                _tmp21_ = chess_piece_get_symbol (_tmp20_);
2480
 
                                                                _tmp22_ = _tmp21_;
2481
 
                                                                g_string_append_printf (_tmp19_, "%c", (gint) _tmp22_);
 
2370
                                                                _tmp17_ = value;
 
2371
                                                                _tmp18_ = p;
 
2372
                                                                _tmp19_ = chess_piece_get_symbol (_tmp18_);
 
2373
                                                                _tmp20_ = _tmp19_;
 
2374
                                                                g_string_append_printf (_tmp17_, "%c", (gint) _tmp20_);
2482
2375
                                                        }
2483
2376
                                                        _chess_piece_unref0 (p);
2484
2377
                                                }
2485
2378
                                        }
2486
2379
                                }
2487
 
                                _tmp23_ = skip_count;
2488
 
                                if (_tmp23_ > 0) {
2489
 
                                        GString* _tmp24_;
2490
 
                                        gint _tmp25_;
2491
 
                                        _tmp24_ = value;
2492
 
                                        _tmp25_ = skip_count;
2493
 
                                        g_string_append_printf (_tmp24_, "%d", _tmp25_);
 
2380
                                _tmp21_ = skip_count;
 
2381
                                if (_tmp21_ > 0) {
 
2382
                                        GString* _tmp22_ = NULL;
 
2383
                                        gint _tmp23_ = 0;
 
2384
                                        _tmp22_ = value;
 
2385
                                        _tmp23_ = skip_count;
 
2386
                                        g_string_append_printf (_tmp22_, "%d", _tmp23_);
2494
2387
                                }
2495
 
                                _tmp26_ = rank;
2496
 
                                if (_tmp26_ != 0) {
2497
 
                                        GString* _tmp27_;
2498
 
                                        _tmp27_ = value;
2499
 
                                        g_string_append_c (_tmp27_, '/');
 
2388
                                _tmp24_ = rank;
 
2389
                                if (_tmp24_ != 0) {
 
2390
                                        GString* _tmp25_ = NULL;
 
2391
                                        _tmp25_ = value;
 
2392
                                        g_string_append_c (_tmp25_, '/');
2500
2393
                                }
2501
2394
                        }
2502
2395
                }
2503
2396
        }
2504
 
        _tmp28_ = value;
2505
 
        g_string_append_c (_tmp28_, ' ');
2506
 
        _tmp29_ = self->current_player;
2507
 
        _tmp30_ = _tmp29_->color;
2508
 
        if (_tmp30_ == COLOR_WHITE) {
2509
 
                GString* _tmp31_;
2510
 
                _tmp31_ = value;
2511
 
                g_string_append_c (_tmp31_, 'w');
 
2397
        _tmp26_ = value;
 
2398
        g_string_append_c (_tmp26_, ' ');
 
2399
        _tmp27_ = self->current_player;
 
2400
        _tmp28_ = _tmp27_->color;
 
2401
        if (_tmp28_ == COLOR_WHITE) {
 
2402
                GString* _tmp29_ = NULL;
 
2403
                _tmp29_ = value;
 
2404
                g_string_append_c (_tmp29_, 'w');
2512
2405
        } else {
2513
 
                GString* _tmp32_;
2514
 
                _tmp32_ = value;
2515
 
                g_string_append_c (_tmp32_, 'b');
2516
 
        }
2517
 
        _tmp33_ = value;
2518
 
        g_string_append_c (_tmp33_, ' ');
2519
 
        _tmp34_ = self->can_castle_kingside[COLOR_WHITE];
 
2406
                GString* _tmp30_ = NULL;
 
2407
                _tmp30_ = value;
 
2408
                g_string_append_c (_tmp30_, 'b');
 
2409
        }
 
2410
        _tmp31_ = value;
 
2411
        g_string_append_c (_tmp31_, ' ');
 
2412
        _tmp32_ = self->can_castle_kingside[COLOR_WHITE];
 
2413
        if (_tmp32_) {
 
2414
                GString* _tmp33_ = NULL;
 
2415
                _tmp33_ = value;
 
2416
                g_string_append_c (_tmp33_, 'K');
 
2417
        }
 
2418
        _tmp34_ = self->can_castle_queenside[COLOR_WHITE];
2520
2419
        if (_tmp34_) {
2521
 
                GString* _tmp35_;
 
2420
                GString* _tmp35_ = NULL;
2522
2421
                _tmp35_ = value;
2523
 
                g_string_append_c (_tmp35_, 'K');
 
2422
                g_string_append_c (_tmp35_, 'Q');
2524
2423
        }
2525
 
        _tmp36_ = self->can_castle_queenside[COLOR_WHITE];
 
2424
        _tmp36_ = self->can_castle_kingside[COLOR_BLACK];
2526
2425
        if (_tmp36_) {
2527
 
                GString* _tmp37_;
 
2426
                GString* _tmp37_ = NULL;
2528
2427
                _tmp37_ = value;
2529
 
                g_string_append_c (_tmp37_, 'Q');
 
2428
                g_string_append_c (_tmp37_, 'k');
2530
2429
        }
2531
 
        _tmp38_ = self->can_castle_kingside[COLOR_BLACK];
 
2430
        _tmp38_ = self->can_castle_queenside[COLOR_BLACK];
2532
2431
        if (_tmp38_) {
2533
 
                GString* _tmp39_;
 
2432
                GString* _tmp39_ = NULL;
2534
2433
                _tmp39_ = value;
2535
 
                g_string_append_c (_tmp39_, 'k');
2536
 
        }
2537
 
        _tmp40_ = self->can_castle_queenside[COLOR_BLACK];
2538
 
        if (_tmp40_) {
2539
 
                GString* _tmp41_;
2540
 
                _tmp41_ = value;
2541
 
                g_string_append_c (_tmp41_, 'q');
2542
 
        }
2543
 
        _tmp42_ = self->can_castle_kingside[COLOR_WHITE];
2544
 
        _tmp43_ = self->can_castle_queenside[COLOR_WHITE];
2545
 
        _tmp44_ = self->can_castle_kingside[COLOR_BLACK];
2546
 
        _tmp45_ = self->can_castle_queenside[COLOR_BLACK];
2547
 
        if (!(((_tmp42_ | _tmp43_) | _tmp44_) | _tmp45_)) {
2548
 
                GString* _tmp46_;
2549
 
                _tmp46_ = value;
2550
 
                g_string_append_c (_tmp46_, '-');
2551
 
        }
2552
 
        _tmp47_ = value;
2553
 
        g_string_append_c (_tmp47_, ' ');
2554
 
        _tmp48_ = self->en_passant_index;
2555
 
        if (_tmp48_ >= 0) {
2556
 
                GString* _tmp49_;
2557
 
                gint _tmp50_;
 
2434
                g_string_append_c (_tmp39_, 'q');
 
2435
        }
 
2436
        _tmp40_ = self->can_castle_kingside[COLOR_WHITE];
 
2437
        _tmp41_ = self->can_castle_queenside[COLOR_WHITE];
 
2438
        _tmp42_ = self->can_castle_kingside[COLOR_BLACK];
 
2439
        _tmp43_ = self->can_castle_queenside[COLOR_BLACK];
 
2440
        if (!(((_tmp40_ | _tmp41_) | _tmp42_) | _tmp43_)) {
 
2441
                GString* _tmp44_ = NULL;
 
2442
                _tmp44_ = value;
 
2443
                g_string_append_c (_tmp44_, '-');
 
2444
        }
 
2445
        _tmp45_ = value;
 
2446
        g_string_append_c (_tmp45_, ' ');
 
2447
        _tmp46_ = self->en_passant_index;
 
2448
        if (_tmp46_ >= 0) {
 
2449
                GString* _tmp47_ = NULL;
 
2450
                gint _tmp48_ = 0;
 
2451
                gint _tmp49_ = 0;
 
2452
                gint _tmp50_ = 0;
2558
2453
                gint _tmp51_ = 0;
2559
 
                gint _tmp52_;
2560
 
                gint _tmp53_ = 0;
2561
 
                _tmp49_ = value;
 
2454
                _tmp47_ = value;
 
2455
                _tmp48_ = self->en_passant_index;
 
2456
                _tmp49_ = chess_state_get_file (self, _tmp48_);
2562
2457
                _tmp50_ = self->en_passant_index;
2563
 
                _tmp51_ = chess_state_get_file (self, _tmp50_);
2564
 
                _tmp52_ = self->en_passant_index;
2565
 
                _tmp53_ = chess_state_get_rank (self, _tmp52_);
2566
 
                g_string_append_printf (_tmp49_, "%c%d", 'a' + _tmp51_, _tmp53_ + 1);
 
2458
                _tmp51_ = chess_state_get_rank (self, _tmp50_);
 
2459
                g_string_append_printf (_tmp47_, "%c%d", 'a' + _tmp49_, _tmp51_ + 1);
2567
2460
        } else {
2568
 
                GString* _tmp54_;
2569
 
                _tmp54_ = value;
2570
 
                g_string_append_c (_tmp54_, '-');
 
2461
                GString* _tmp52_ = NULL;
 
2462
                _tmp52_ = value;
 
2463
                g_string_append_c (_tmp52_, '-');
2571
2464
        }
2572
 
        _tmp55_ = value;
2573
 
        g_string_append_c (_tmp55_, ' ');
 
2465
        _tmp53_ = value;
 
2466
        g_string_append_c (_tmp53_, ' ');
 
2467
        _tmp54_ = value;
 
2468
        _tmp55_ = self->halfmove_clock;
 
2469
        g_string_append_printf (_tmp54_, "%d", _tmp55_);
2574
2470
        _tmp56_ = value;
2575
 
        _tmp57_ = self->halfmove_clock;
2576
 
        g_string_append_printf (_tmp56_, "%d", _tmp57_);
2577
 
        _tmp58_ = value;
2578
 
        g_string_append_c (_tmp58_, ' ');
2579
 
        _tmp59_ = self->current_player;
2580
 
        _tmp60_ = _tmp59_->color;
2581
 
        if (_tmp60_ == COLOR_WHITE) {
2582
 
                GString* _tmp61_;
2583
 
                gint _tmp62_;
 
2471
        g_string_append_c (_tmp56_, ' ');
 
2472
        _tmp57_ = self->current_player;
 
2473
        _tmp58_ = _tmp57_->color;
 
2474
        if (_tmp58_ == COLOR_WHITE) {
 
2475
                GString* _tmp59_ = NULL;
 
2476
                gint _tmp60_ = 0;
 
2477
                _tmp59_ = value;
 
2478
                _tmp60_ = self->number;
 
2479
                g_string_append_printf (_tmp59_, "%d", _tmp60_ / 2);
 
2480
        } else {
 
2481
                GString* _tmp61_ = NULL;
 
2482
                gint _tmp62_ = 0;
2584
2483
                _tmp61_ = value;
2585
2484
                _tmp62_ = self->number;
2586
 
                g_string_append_printf (_tmp61_, "%d", _tmp62_ / 2);
2587
 
        } else {
2588
 
                GString* _tmp63_;
2589
 
                gint _tmp64_;
2590
 
                _tmp63_ = value;
2591
 
                _tmp64_ = self->number;
2592
 
                g_string_append_printf (_tmp63_, "%d", (_tmp64_ / 2) + 1);
 
2485
                g_string_append_printf (_tmp61_, "%d", (_tmp62_ / 2) + 1);
2593
2486
        }
2594
 
        _tmp65_ = value;
2595
 
        _tmp66_ = _tmp65_->str;
2596
 
        _tmp67_ = g_strdup (_tmp66_);
2597
 
        result = _tmp67_;
 
2487
        _tmp63_ = value;
 
2488
        _tmp64_ = _tmp63_->str;
 
2489
        _tmp65_ = g_strdup (_tmp64_);
 
2490
        result = _tmp65_;
2598
2491
        _g_string_free0 (value);
2599
2492
        return result;
2600
2493
}
2602
2495
 
2603
2496
gint chess_state_get_index (ChessState* self, gint rank, gint file) {
2604
2497
        gint result = 0;
2605
 
        gint _tmp0_;
2606
 
        gint _tmp1_;
 
2498
        gint _tmp0_ = 0;
 
2499
        gint _tmp1_ = 0;
2607
2500
        g_return_val_if_fail (self != NULL, 0);
2608
2501
        _tmp0_ = rank;
2609
2502
        _tmp1_ = file;
2614
2507
 
2615
2508
gint chess_state_get_rank (ChessState* self, gint index) {
2616
2509
        gint result = 0;
2617
 
        gint _tmp0_;
 
2510
        gint _tmp0_ = 0;
2618
2511
        g_return_val_if_fail (self != NULL, 0);
2619
2512
        _tmp0_ = index;
2620
2513
        result = _tmp0_ / 8;
2624
2517
 
2625
2518
gint chess_state_get_file (ChessState* self, gint index) {
2626
2519
        gint result = 0;
2627
 
        gint _tmp0_;
 
2520
        gint _tmp0_ = 0;
2628
2521
        g_return_val_if_fail (self != NULL, 0);
2629
2522
        _tmp0_ = index;
2630
2523
        result = _tmp0_ % 8;
2639
2532
        gint r1 = 0;
2640
2533
        gint f1 = 0;
2641
2534
        PieceType promotion_type = 0;
2642
 
        ChessPlayer* _tmp0_;
2643
 
        const gchar* _tmp1_;
 
2535
        ChessPlayer* _tmp0_ = NULL;
 
2536
        const gchar* _tmp1_ = NULL;
2644
2537
        gint _tmp2_ = 0;
2645
2538
        gint _tmp3_ = 0;
2646
2539
        gint _tmp4_ = 0;
2647
2540
        gint _tmp5_ = 0;
2648
2541
        PieceType _tmp6_ = 0;
2649
2542
        gboolean _tmp7_ = FALSE;
2650
 
        ChessPlayer* _tmp8_;
2651
 
        gint _tmp9_;
2652
 
        gint _tmp10_;
2653
 
        gint _tmp11_;
2654
 
        gint _tmp12_;
2655
 
        PieceType _tmp13_;
2656
 
        gboolean _tmp14_;
 
2543
        ChessPlayer* _tmp8_ = NULL;
 
2544
        gint _tmp9_ = 0;
 
2545
        gint _tmp10_ = 0;
 
2546
        gint _tmp11_ = 0;
 
2547
        gint _tmp12_ = 0;
 
2548
        PieceType _tmp13_ = 0;
 
2549
        gboolean _tmp14_ = FALSE;
2657
2550
        gboolean _tmp15_ = FALSE;
2658
2551
        g_return_val_if_fail (self != NULL, FALSE);
2659
2552
        g_return_val_if_fail (move != NULL, FALSE);
2688
2581
 
2689
2582
gboolean chess_state_move_with_coords (ChessState* self, ChessPlayer* player, gint r0, gint f0, gint r1, gint f1, PieceType promotion_type, gboolean apply, gboolean test_check) {
2690
2583
        gboolean result = FALSE;
2691
 
        gint _tmp0_;
2692
 
        gint _tmp1_;
 
2584
        gint start = 0;
 
2585
        gint _tmp0_ = 0;
 
2586
        gint _tmp1_ = 0;
2693
2587
        gint _tmp2_ = 0;
2694
 
        gint start;
2695
 
        gint _tmp3_;
2696
 
        gint _tmp4_;
 
2588
        gint end = 0;
 
2589
        gint _tmp3_ = 0;
 
2590
        gint _tmp4_ = 0;
2697
2591
        gint _tmp5_ = 0;
2698
 
        gint end;
2699
 
        ChessPlayer* _tmp6_;
2700
 
        Color _tmp7_;
2701
 
        Color color;
 
2592
        Color color = 0;
 
2593
        ChessPlayer* _tmp6_ = NULL;
 
2594
        Color _tmp7_ = 0;
2702
2595
        Color _tmp8_ = 0;
2703
 
        Color _tmp9_;
2704
 
        Color _tmp10_;
2705
 
        Color opponent_color;
2706
 
        gint _tmp11_;
2707
 
        ChessPiece* _tmp12_;
2708
 
        ChessPiece* _tmp13_;
2709
 
        ChessPiece* piece;
2710
 
        gboolean _tmp14_ = FALSE;
2711
 
        ChessPiece* _tmp15_;
2712
 
        gboolean _tmp19_;
2713
 
        gint _tmp20_;
2714
 
        gint64 _tmp21_;
2715
 
        gint64 end_mask;
2716
 
        Color _tmp22_;
2717
 
        ChessPiece* _tmp23_;
2718
 
        PieceType _tmp24_;
2719
 
        gint _tmp25_;
2720
 
        gint64 _tmp26_;
2721
 
        gint64 move_mask;
2722
 
        gint64 _tmp27_;
2723
 
        gint64 _tmp28_;
2724
 
        gint _tmp29_;
2725
 
        gint _tmp30_;
2726
 
        gint64 _tmp31_;
2727
 
        gint64 over_mask;
2728
 
        gint64 _tmp32_;
2729
 
        gint64 _tmp33_;
2730
 
        gint64 _tmp34_;
2731
 
        gint _tmp35_;
2732
 
        ChessPiece* _tmp36_;
2733
 
        ChessPiece* _tmp37_;
2734
 
        ChessPiece* victim;
2735
 
        gint _tmp38_;
2736
 
        gint victim_index;
2737
 
        gboolean _tmp39_ = FALSE;
2738
 
        ChessPiece* _tmp40_;
2739
 
        gboolean _tmp44_;
2740
 
        gint rook_start;
2741
 
        gint rook_end;
2742
 
        gboolean is_promotion;
2743
 
        gboolean ambiguous_rank;
2744
 
        gboolean ambiguous_file;
2745
 
        ChessPiece* _tmp45_;
2746
 
        PieceType _tmp46_;
2747
 
        gboolean _tmp121_ = FALSE;
2748
 
        gboolean _tmp122_;
2749
 
        gboolean _tmp124_;
2750
 
        gboolean _tmp125_;
2751
 
        gint64 _tmp161_;
2752
 
        gint64 old_white_mask;
2753
 
        gint64 _tmp162_;
2754
 
        gint64 old_black_mask;
2755
 
        gboolean _tmp163_;
2756
 
        gboolean old_white_can_castle_kingside;
2757
 
        gboolean _tmp164_;
2758
 
        gboolean old_white_can_castle_queenside;
2759
 
        gboolean _tmp165_;
2760
 
        gboolean old_black_can_castle_kingside;
2761
 
        gboolean _tmp166_;
2762
 
        gboolean old_black_can_castle_queenside;
2763
 
        gint _tmp167_;
2764
 
        gint old_en_passant_index;
2765
 
        gint _tmp168_;
2766
 
        gint old_halfmove_clock;
2767
 
        gint _tmp169_;
2768
 
        ChessPiece* _tmp170_;
2769
 
        gint _tmp171_;
2770
 
        gint64 _tmp172_;
2771
 
        gint64 _tmp173_;
2772
 
        gint _tmp174_;
2773
 
        gint64 _tmp175_;
2774
 
        gint64 _tmp176_;
2775
 
        ChessPiece* _tmp177_;
2776
 
        gboolean _tmp186_;
2777
 
        Color _tmp196_;
2778
 
        gint64 _tmp197_;
2779
 
        gint64 _tmp198_;
2780
 
        Color _tmp199_;
2781
 
        gint _tmp200_;
2782
 
        gint64 _tmp201_;
2783
 
        gint64 _tmp202_;
2784
 
        gint _tmp203_;
2785
 
        ChessPiece* _tmp221_;
2786
 
        PieceType _tmp222_;
 
2596
        Color _tmp9_ = 0;
 
2597
        Color opponent_color = 0;
 
2598
        ChessPiece* piece = NULL;
 
2599
        gint _tmp10_ = 0;
 
2600
        ChessPiece* _tmp11_ = NULL;
 
2601
        ChessPiece* _tmp12_ = NULL;
 
2602
        gboolean _tmp13_ = FALSE;
 
2603
        ChessPiece* _tmp14_ = NULL;
 
2604
        gint64 end_mask = 0LL;
 
2605
        gint _tmp18_ = 0;
 
2606
        gint64 _tmp19_ = 0LL;
 
2607
        gint64 move_mask = 0LL;
 
2608
        Color _tmp20_ = 0;
 
2609
        ChessPiece* _tmp21_ = NULL;
 
2610
        PieceType _tmp22_ = 0;
 
2611
        gint _tmp23_ = 0;
 
2612
        gint64 _tmp24_ = 0LL;
 
2613
        gint64 _tmp25_ = 0LL;
 
2614
        gint64 _tmp26_ = 0LL;
 
2615
        gint64 over_mask = 0LL;
 
2616
        gint _tmp27_ = 0;
 
2617
        gint _tmp28_ = 0;
 
2618
        gint64 _tmp29_ = 0LL;
 
2619
        gint64 _tmp30_ = 0LL;
 
2620
        gint64 _tmp31_ = 0LL;
 
2621
        gint64 _tmp32_ = 0LL;
 
2622
        ChessPiece* victim = NULL;
 
2623
        gint _tmp33_ = 0;
 
2624
        ChessPiece* _tmp34_ = NULL;
 
2625
        ChessPiece* _tmp35_ = NULL;
 
2626
        gint victim_index = 0;
 
2627
        gint _tmp36_ = 0;
 
2628
        gboolean _tmp37_ = FALSE;
 
2629
        ChessPiece* _tmp38_ = NULL;
 
2630
        gint rook_start = 0;
 
2631
        gint rook_end = 0;
 
2632
        gboolean is_promotion = FALSE;
 
2633
        gboolean ambiguous_rank = FALSE;
 
2634
        gboolean ambiguous_file = FALSE;
 
2635
        ChessPiece* _tmp42_ = NULL;
 
2636
        PieceType _tmp43_ = 0;
 
2637
        gboolean _tmp111_ = FALSE;
 
2638
        gboolean _tmp112_ = FALSE;
 
2639
        gboolean _tmp114_ = FALSE;
 
2640
        gint64 old_white_mask = 0LL;
 
2641
        gint64 _tmp147_ = 0LL;
 
2642
        gint64 old_black_mask = 0LL;
 
2643
        gint64 _tmp148_ = 0LL;
 
2644
        gboolean old_white_can_castle_kingside = FALSE;
 
2645
        gboolean _tmp149_ = FALSE;
 
2646
        gboolean old_white_can_castle_queenside = FALSE;
 
2647
        gboolean _tmp150_ = FALSE;
 
2648
        gboolean old_black_can_castle_kingside = FALSE;
 
2649
        gboolean _tmp151_ = FALSE;
 
2650
        gboolean old_black_can_castle_queenside = FALSE;
 
2651
        gboolean _tmp152_ = FALSE;
 
2652
        gint old_en_passant_index = 0;
 
2653
        gint _tmp153_ = 0;
 
2654
        gint old_halfmove_clock = 0;
 
2655
        gint _tmp154_ = 0;
 
2656
        gint _tmp155_ = 0;
 
2657
        ChessPiece* _tmp156_ = NULL;
 
2658
        gint _tmp157_ = 0;
 
2659
        gint64 _tmp158_ = 0LL;
 
2660
        gint64 _tmp159_ = 0LL;
 
2661
        gint _tmp160_ = 0;
 
2662
        gint64 _tmp161_ = 0LL;
 
2663
        gint64 _tmp162_ = 0LL;
 
2664
        ChessPiece* _tmp163_ = NULL;
 
2665
        gboolean _tmp172_ = FALSE;
 
2666
        Color _tmp182_ = 0;
 
2667
        gint64 _tmp183_ = 0LL;
 
2668
        gint64 _tmp184_ = 0LL;
 
2669
        Color _tmp185_ = 0;
 
2670
        gint _tmp186_ = 0;
 
2671
        gint64 _tmp187_ = 0LL;
 
2672
        gint64 _tmp188_ = 0LL;
 
2673
        gint _tmp189_ = 0;
 
2674
        ChessPiece* _tmp207_ = NULL;
 
2675
        PieceType _tmp208_ = 0;
 
2676
        gboolean _tmp239_ = FALSE;
 
2677
        ChessPiece* _tmp240_ = NULL;
 
2678
        PieceType _tmp241_ = 0;
 
2679
        gboolean _tmp247_ = FALSE;
 
2680
        ChessPiece* _tmp248_ = NULL;
 
2681
        PieceType _tmp249_ = 0;
 
2682
        gboolean _result_ = FALSE;
 
2683
        gboolean _tmp252_ = FALSE;
 
2684
        gboolean _tmp253_ = FALSE;
2787
2685
        gboolean _tmp256_ = FALSE;
2788
 
        ChessPiece* _tmp257_;
2789
 
        PieceType _tmp258_;
2790
 
        gboolean _tmp260_;
2791
 
        gboolean _tmp265_ = FALSE;
2792
 
        ChessPiece* _tmp266_;
2793
 
        PieceType _tmp267_;
2794
 
        gboolean _tmp269_;
2795
 
        gboolean _result_;
2796
 
        gboolean _tmp271_ = FALSE;
2797
 
        gboolean _tmp272_;
2798
 
        gboolean _tmp275_;
2799
 
        gboolean _tmp276_ = FALSE;
2800
 
        gboolean _tmp277_;
2801
 
        gboolean _tmp279_;
2802
 
        ChessPlayer* _tmp315_ = NULL;
2803
 
        Color _tmp316_;
2804
 
        ChessPlayer* _tmp319_;
2805
 
        ChessPlayer* _tmp320_;
2806
 
        ChessPlayer* _tmp321_;
2807
 
        CheckState _tmp322_ = 0;
2808
 
        ChessMove* _tmp323_;
2809
 
        ChessMove* _tmp324_;
2810
 
        gint _tmp325_;
2811
 
        ChessMove* _tmp326_;
2812
 
        ChessPiece* _tmp327_;
2813
 
        ChessPiece* _tmp328_;
2814
 
        gboolean _tmp329_;
2815
 
        ChessMove* _tmp334_;
2816
 
        ChessPiece* _tmp335_;
2817
 
        ChessPiece* _tmp336_;
2818
 
        gint _tmp337_;
2819
 
        ChessMove* _tmp342_;
2820
 
        gint _tmp343_;
2821
 
        ChessMove* _tmp344_;
2822
 
        gint _tmp345_;
2823
 
        ChessMove* _tmp346_;
2824
 
        gint _tmp347_;
2825
 
        ChessMove* _tmp348_;
2826
 
        gint _tmp349_;
2827
 
        ChessMove* _tmp350_;
2828
 
        gboolean _tmp351_;
2829
 
        ChessMove* _tmp352_;
2830
 
        gboolean _tmp353_;
2831
 
        ChessMove* _tmp354_;
2832
 
        CheckState _tmp355_;
 
2686
        gboolean _tmp257_ = FALSE;
 
2687
        ChessPlayer* _tmp294_ = NULL;
 
2688
        Color _tmp295_ = 0;
 
2689
        ChessPlayer* _tmp298_ = NULL;
 
2690
        ChessPlayer* _tmp299_ = NULL;
 
2691
        CheckState _tmp300_ = 0;
 
2692
        ChessMove* _tmp301_ = NULL;
 
2693
        ChessMove* _tmp302_ = NULL;
 
2694
        gint _tmp303_ = 0;
 
2695
        ChessMove* _tmp304_ = NULL;
 
2696
        ChessPiece* _tmp305_ = NULL;
 
2697
        ChessPiece* _tmp306_ = NULL;
 
2698
        gboolean _tmp307_ = FALSE;
 
2699
        ChessMove* _tmp312_ = NULL;
 
2700
        ChessPiece* _tmp313_ = NULL;
 
2701
        ChessPiece* _tmp314_ = NULL;
 
2702
        gint _tmp315_ = 0;
 
2703
        ChessMove* _tmp320_ = NULL;
 
2704
        gint _tmp321_ = 0;
 
2705
        ChessMove* _tmp322_ = NULL;
 
2706
        gint _tmp323_ = 0;
 
2707
        ChessMove* _tmp324_ = NULL;
 
2708
        gint _tmp325_ = 0;
 
2709
        ChessMove* _tmp326_ = NULL;
 
2710
        gint _tmp327_ = 0;
 
2711
        ChessMove* _tmp328_ = NULL;
 
2712
        gboolean _tmp329_ = FALSE;
 
2713
        ChessMove* _tmp330_ = NULL;
 
2714
        gboolean _tmp331_ = FALSE;
 
2715
        ChessMove* _tmp332_ = NULL;
 
2716
        CheckState _tmp333_ = 0;
2833
2717
        g_return_val_if_fail (self != NULL, FALSE);
2834
2718
        g_return_val_if_fail (player != NULL, FALSE);
2835
2719
        _tmp0_ = r0;
2849
2733
        } else {
2850
2734
                _tmp8_ = COLOR_WHITE;
2851
2735
        }
2852
 
        _tmp10_ = _tmp8_;
2853
 
        opponent_color = _tmp10_;
2854
 
        _tmp11_ = start;
2855
 
        _tmp12_ = self->board[_tmp11_];
2856
 
        _tmp13_ = _chess_piece_ref0 (_tmp12_);
2857
 
        piece = _tmp13_;
2858
 
        _tmp15_ = piece;
2859
 
        if (_tmp15_ == NULL) {
2860
 
                _tmp14_ = TRUE;
2861
 
        } else {
2862
 
                ChessPiece* _tmp16_;
2863
 
                ChessPlayer* _tmp17_;
2864
 
                ChessPlayer* _tmp18_;
2865
 
                _tmp16_ = piece;
2866
 
                _tmp17_ = _tmp16_->player;
2867
 
                _tmp18_ = player;
2868
 
                _tmp14_ = _tmp17_ != _tmp18_;
2869
 
        }
2870
 
        _tmp19_ = _tmp14_;
2871
 
        if (_tmp19_) {
2872
 
                result = FALSE;
2873
 
                _chess_piece_unref0 (piece);
2874
 
                return result;
2875
 
        }
2876
 
        _tmp20_ = end;
2877
 
        _tmp21_ = BIT_BOARD_set_location_masks[_tmp20_];
2878
 
        end_mask = _tmp21_;
2879
 
        _tmp22_ = color;
2880
 
        _tmp23_ = piece;
2881
 
        _tmp24_ = _tmp23_->type;
2882
 
        _tmp25_ = start;
2883
 
        _tmp26_ = BIT_BOARD_move_masks[(((_tmp22_ * 64) * 6) + (_tmp24_ * 64)) + _tmp25_];
2884
 
        move_mask = _tmp26_;
2885
 
        _tmp27_ = end_mask;
2886
 
        _tmp28_ = move_mask;
2887
 
        if ((_tmp27_ & _tmp28_) == ((gint64) 0)) {
2888
 
                result = FALSE;
2889
 
                _chess_piece_unref0 (piece);
2890
 
                return result;
2891
 
        }
2892
 
        _tmp29_ = start;
2893
 
        _tmp30_ = end;
2894
 
        _tmp31_ = BIT_BOARD_over_masks[(_tmp29_ * 64) + _tmp30_];
2895
 
        over_mask = _tmp31_;
2896
 
        _tmp32_ = over_mask;
2897
 
        _tmp33_ = self->priv->piece_masks[COLOR_WHITE];
2898
 
        _tmp34_ = self->priv->piece_masks[COLOR_BLACK];
2899
 
        if ((_tmp32_ & (_tmp33_ | _tmp34_)) != ((gint64) 0)) {
2900
 
                result = FALSE;
2901
 
                _chess_piece_unref0 (piece);
2902
 
                return result;
2903
 
        }
2904
 
        _tmp35_ = end;
2905
 
        _tmp36_ = self->board[_tmp35_];
2906
 
        _tmp37_ = _chess_piece_ref0 (_tmp36_);
2907
 
        victim = _tmp37_;
2908
 
        _tmp38_ = end;
2909
 
        victim_index = _tmp38_;
2910
 
        _tmp40_ = victim;
2911
 
        if (_tmp40_ != NULL) {
2912
 
                ChessPiece* _tmp41_;
2913
 
                ChessPlayer* _tmp42_;
2914
 
                ChessPlayer* _tmp43_;
2915
 
                _tmp41_ = victim;
2916
 
                _tmp42_ = _tmp41_->player;
2917
 
                _tmp43_ = player;
2918
 
                _tmp39_ = _tmp42_ == _tmp43_;
2919
 
        } else {
2920
 
                _tmp39_ = FALSE;
2921
 
        }
2922
 
        _tmp44_ = _tmp39_;
2923
 
        if (_tmp44_) {
 
2736
        opponent_color = _tmp8_;
 
2737
        _tmp10_ = start;
 
2738
        _tmp11_ = self->board[_tmp10_];
 
2739
        _tmp12_ = _chess_piece_ref0 (_tmp11_);
 
2740
        piece = _tmp12_;
 
2741
        _tmp14_ = piece;
 
2742
        if (_tmp14_ == NULL) {
 
2743
                _tmp13_ = TRUE;
 
2744
        } else {
 
2745
                ChessPiece* _tmp15_ = NULL;
 
2746
                ChessPlayer* _tmp16_ = NULL;
 
2747
                ChessPlayer* _tmp17_ = NULL;
 
2748
                _tmp15_ = piece;
 
2749
                _tmp16_ = _tmp15_->player;
 
2750
                _tmp17_ = player;
 
2751
                _tmp13_ = _tmp16_ != _tmp17_;
 
2752
        }
 
2753
        if (_tmp13_) {
 
2754
                result = FALSE;
 
2755
                _chess_piece_unref0 (piece);
 
2756
                return result;
 
2757
        }
 
2758
        _tmp18_ = end;
 
2759
        _tmp19_ = BIT_BOARD_set_location_masks[_tmp18_];
 
2760
        end_mask = _tmp19_;
 
2761
        _tmp20_ = color;
 
2762
        _tmp21_ = piece;
 
2763
        _tmp22_ = _tmp21_->type;
 
2764
        _tmp23_ = start;
 
2765
        _tmp24_ = BIT_BOARD_move_masks[(((_tmp20_ * 64) * 6) + (_tmp22_ * 64)) + _tmp23_];
 
2766
        move_mask = _tmp24_;
 
2767
        _tmp25_ = end_mask;
 
2768
        _tmp26_ = move_mask;
 
2769
        if ((_tmp25_ & _tmp26_) == ((gint64) 0)) {
 
2770
                result = FALSE;
 
2771
                _chess_piece_unref0 (piece);
 
2772
                return result;
 
2773
        }
 
2774
        _tmp27_ = start;
 
2775
        _tmp28_ = end;
 
2776
        _tmp29_ = BIT_BOARD_over_masks[(_tmp27_ * 64) + _tmp28_];
 
2777
        over_mask = _tmp29_;
 
2778
        _tmp30_ = over_mask;
 
2779
        _tmp31_ = self->priv->piece_masks[COLOR_WHITE];
 
2780
        _tmp32_ = self->priv->piece_masks[COLOR_BLACK];
 
2781
        if ((_tmp30_ & (_tmp31_ | _tmp32_)) != ((gint64) 0)) {
 
2782
                result = FALSE;
 
2783
                _chess_piece_unref0 (piece);
 
2784
                return result;
 
2785
        }
 
2786
        _tmp33_ = end;
 
2787
        _tmp34_ = self->board[_tmp33_];
 
2788
        _tmp35_ = _chess_piece_ref0 (_tmp34_);
 
2789
        victim = _tmp35_;
 
2790
        _tmp36_ = end;
 
2791
        victim_index = _tmp36_;
 
2792
        _tmp38_ = victim;
 
2793
        if (_tmp38_ != NULL) {
 
2794
                ChessPiece* _tmp39_ = NULL;
 
2795
                ChessPlayer* _tmp40_ = NULL;
 
2796
                ChessPlayer* _tmp41_ = NULL;
 
2797
                _tmp39_ = victim;
 
2798
                _tmp40_ = _tmp39_->player;
 
2799
                _tmp41_ = player;
 
2800
                _tmp37_ = _tmp40_ == _tmp41_;
 
2801
        } else {
 
2802
                _tmp37_ = FALSE;
 
2803
        }
 
2804
        if (_tmp37_) {
2924
2805
                result = FALSE;
2925
2806
                _chess_piece_unref0 (victim);
2926
2807
                _chess_piece_unref0 (piece);
2931
2812
        is_promotion = FALSE;
2932
2813
        ambiguous_rank = FALSE;
2933
2814
        ambiguous_file = FALSE;
2934
 
        _tmp45_ = piece;
2935
 
        _tmp46_ = _tmp45_->type;
2936
 
        switch (_tmp46_) {
 
2815
        _tmp42_ = piece;
 
2816
        _tmp43_ = _tmp42_->type;
 
2817
        switch (_tmp43_) {
2937
2818
                case PIECE_TYPE_PAWN:
2938
2819
                {
2939
 
                        gboolean _tmp47_ = FALSE;
2940
 
                        ChessPiece* _tmp48_;
2941
 
                        gboolean _tmp51_;
2942
 
                        gint _tmp60_;
2943
 
                        gint _tmp61_;
2944
 
                        gboolean _tmp64_ = FALSE;
2945
 
                        gint _tmp65_;
2946
 
                        gboolean _tmp67_;
2947
 
                        ChessPiece* _tmp68_;
2948
 
                        _tmp48_ = victim;
2949
 
                        if (_tmp48_ == NULL) {
2950
 
                                gint _tmp49_;
2951
 
                                gint _tmp50_;
2952
 
                                _tmp49_ = end;
2953
 
                                _tmp50_ = self->en_passant_index;
2954
 
                                _tmp47_ = _tmp49_ == _tmp50_;
 
2820
                        gboolean _tmp44_ = FALSE;
 
2821
                        ChessPiece* _tmp45_ = NULL;
 
2822
                        gint _tmp55_ = 0;
 
2823
                        gint _tmp56_ = 0;
 
2824
                        gboolean _tmp59_ = FALSE;
 
2825
                        gint _tmp60_ = 0;
 
2826
                        ChessPiece* _tmp62_ = NULL;
 
2827
                        _tmp45_ = victim;
 
2828
                        if (_tmp45_ == NULL) {
 
2829
                                gint _tmp46_ = 0;
 
2830
                                gint _tmp47_ = 0;
 
2831
                                _tmp46_ = end;
 
2832
                                _tmp47_ = self->en_passant_index;
 
2833
                                _tmp44_ = _tmp46_ == _tmp47_;
2955
2834
                        } else {
2956
 
                                _tmp47_ = FALSE;
 
2835
                                _tmp44_ = FALSE;
2957
2836
                        }
2958
 
                        _tmp51_ = _tmp47_;
2959
 
                        if (_tmp51_) {
 
2837
                        if (_tmp44_) {
 
2838
                                gint _tmp48_ = 0;
 
2839
                                gint _tmp49_ = 0;
 
2840
                                gint _tmp50_ = 0;
 
2841
                                gint _tmp51_ = 0;
2960
2842
                                gint _tmp52_ = 0;
2961
 
                                gint _tmp53_;
2962
 
                                gint _tmp54_;
2963
 
                                gint _tmp55_;
2964
 
                                gint _tmp56_ = 0;
2965
 
                                gint _tmp57_;
2966
 
                                ChessPiece* _tmp58_;
2967
 
                                ChessPiece* _tmp59_;
2968
 
                                _tmp53_ = r1;
2969
 
                                if (_tmp53_ == 2) {
2970
 
                                        _tmp52_ = 3;
 
2843
                                ChessPiece* _tmp53_ = NULL;
 
2844
                                ChessPiece* _tmp54_ = NULL;
 
2845
                                _tmp49_ = r1;
 
2846
                                if (_tmp49_ == 2) {
 
2847
                                        _tmp48_ = 3;
2971
2848
                                } else {
2972
 
                                        _tmp52_ = 4;
 
2849
                                        _tmp48_ = 4;
2973
2850
                                }
2974
 
                                _tmp54_ = _tmp52_;
2975
 
                                _tmp55_ = f1;
2976
 
                                _tmp56_ = chess_state_get_index (self, _tmp54_, _tmp55_);
2977
 
                                victim_index = _tmp56_;
2978
 
                                _tmp57_ = victim_index;
2979
 
                                _tmp58_ = self->board[_tmp57_];
2980
 
                                _tmp59_ = _chess_piece_ref0 (_tmp58_);
 
2851
                                _tmp50_ = f1;
 
2852
                                _tmp51_ = chess_state_get_index (self, _tmp48_, _tmp50_);
 
2853
                                victim_index = _tmp51_;
 
2854
                                _tmp52_ = victim_index;
 
2855
                                _tmp53_ = self->board[_tmp52_];
 
2856
                                _tmp54_ = _chess_piece_ref0 (_tmp53_);
2981
2857
                                _chess_piece_unref0 (victim);
2982
 
                                victim = _tmp59_;
2983
 
                        }
2984
 
                        _tmp60_ = f0;
2985
 
                        _tmp61_ = f1;
2986
 
                        if (_tmp60_ != _tmp61_) {
2987
 
                                ChessPiece* _tmp62_;
2988
 
                                _tmp62_ = victim;
2989
 
                                if (_tmp62_ == NULL) {
2990
 
                                        result = FALSE;
2991
 
                                        _chess_piece_unref0 (victim);
2992
 
                                        _chess_piece_unref0 (piece);
2993
 
                                        return result;
2994
 
                                }
2995
 
                        } else {
2996
 
                                ChessPiece* _tmp63_;
2997
 
                                _tmp63_ = victim;
2998
 
                                if (_tmp63_ != NULL) {
2999
 
                                        result = FALSE;
3000
 
                                        _chess_piece_unref0 (victim);
3001
 
                                        _chess_piece_unref0 (piece);
3002
 
                                        return result;
3003
 
                                }
3004
 
                        }
3005
 
                        _tmp65_ = r1;
3006
 
                        if (_tmp65_ == 0) {
3007
 
                                _tmp64_ = TRUE;
3008
 
                        } else {
3009
 
                                gint _tmp66_;
3010
 
                                _tmp66_ = r1;
3011
 
                                _tmp64_ = _tmp66_ == 7;
3012
 
                        }
3013
 
                        _tmp67_ = _tmp64_;
3014
 
                        is_promotion = _tmp67_;
3015
 
                        _tmp68_ = victim;
3016
 
                        if (_tmp68_ != NULL) {
 
2858
                                victim = _tmp54_;
 
2859
                        }
 
2860
                        _tmp55_ = f0;
 
2861
                        _tmp56_ = f1;
 
2862
                        if (_tmp55_ != _tmp56_) {
 
2863
                                ChessPiece* _tmp57_ = NULL;
 
2864
                                _tmp57_ = victim;
 
2865
                                if (_tmp57_ == NULL) {
 
2866
                                        result = FALSE;
 
2867
                                        _chess_piece_unref0 (victim);
 
2868
                                        _chess_piece_unref0 (piece);
 
2869
                                        return result;
 
2870
                                }
 
2871
                        } else {
 
2872
                                ChessPiece* _tmp58_ = NULL;
 
2873
                                _tmp58_ = victim;
 
2874
                                if (_tmp58_ != NULL) {
 
2875
                                        result = FALSE;
 
2876
                                        _chess_piece_unref0 (victim);
 
2877
                                        _chess_piece_unref0 (piece);
 
2878
                                        return result;
 
2879
                                }
 
2880
                        }
 
2881
                        _tmp60_ = r1;
 
2882
                        if (_tmp60_ == 0) {
 
2883
                                _tmp59_ = TRUE;
 
2884
                        } else {
 
2885
                                gint _tmp61_ = 0;
 
2886
                                _tmp61_ = r1;
 
2887
                                _tmp59_ = _tmp61_ == 7;
 
2888
                        }
 
2889
                        is_promotion = _tmp59_;
 
2890
                        _tmp62_ = victim;
 
2891
                        if (_tmp62_ != NULL) {
3017
2892
                                ambiguous_file = TRUE;
3018
2893
                        }
3019
2894
                        break;
3020
2895
                }
3021
2896
                case PIECE_TYPE_KING:
3022
2897
                {
3023
 
                        gint _tmp69_;
3024
 
                        gint _tmp70_;
3025
 
                        gint _tmp71_ = 0;
3026
 
                        _tmp69_ = f0;
3027
 
                        _tmp70_ = f1;
3028
 
                        _tmp71_ = abs (_tmp69_ - _tmp70_);
3029
 
                        if (_tmp71_ > 1) {
 
2898
                        gint _tmp63_ = 0;
 
2899
                        gint _tmp64_ = 0;
 
2900
                        gint _tmp65_ = 0;
 
2901
                        _tmp63_ = f0;
 
2902
                        _tmp64_ = f1;
 
2903
                        _tmp65_ = abs (_tmp63_ - _tmp64_);
 
2904
                        if (_tmp65_ > 1) {
 
2905
                                gint _tmp66_ = 0;
 
2906
                                gint _tmp67_ = 0;
 
2907
                                gint _tmp68_ = 0;
 
2908
                                gint _tmp69_ = 0;
 
2909
                                gint _tmp70_ = 0;
 
2910
                                gint _tmp71_ = 0;
3030
2911
                                gint _tmp72_ = 0;
3031
 
                                gint _tmp73_;
3032
 
                                gint _tmp74_;
3033
 
                                gint _tmp75_;
3034
 
                                gint _tmp76_;
 
2912
                                gint _tmp73_ = 0;
 
2913
                                gint _tmp76_ = 0;
3035
2914
                                gint _tmp77_ = 0;
3036
2915
                                gint _tmp78_ = 0;
3037
 
                                gint _tmp79_;
3038
 
                                gint _tmp80_;
3039
 
                                gint _tmp83_;
3040
 
                                gint _tmp84_;
3041
 
                                gint _tmp85_ = 0;
3042
 
                                gint _tmp86_;
3043
 
                                gint _tmp87_;
3044
 
                                gint _tmp92_;
3045
 
                                ChessPiece* _tmp93_;
3046
 
                                ChessPiece* _tmp94_;
3047
 
                                ChessPiece* rook;
3048
 
                                gboolean _tmp95_ = FALSE;
3049
 
                                gboolean _tmp96_ = FALSE;
3050
 
                                ChessPiece* _tmp97_;
3051
 
                                gboolean _tmp100_;
3052
 
                                gboolean _tmp105_;
3053
 
                                gint _tmp106_;
3054
 
                                gint _tmp107_;
3055
 
                                gint64 _tmp108_;
3056
 
                                gint64 rook_over_mask;
3057
 
                                gint64 _tmp109_;
3058
 
                                gint64 _tmp110_;
3059
 
                                gint64 _tmp111_;
3060
 
                                CheckState _tmp112_;
3061
 
                                ChessPlayer* _tmp113_;
3062
 
                                gint _tmp114_;
3063
 
                                gint _tmp115_;
3064
 
                                gint _tmp116_;
3065
 
                                gint _tmp117_ = 0;
3066
 
                                gint _tmp118_;
3067
 
                                gint _tmp119_ = 0;
3068
 
                                gboolean _tmp120_ = FALSE;
3069
 
                                _tmp73_ = f1;
3070
 
                                _tmp74_ = f0;
3071
 
                                if (_tmp73_ > _tmp74_) {
3072
 
                                        _tmp72_ = 7;
3073
 
                                } else {
3074
 
                                        _tmp72_ = 0;
3075
 
                                }
3076
 
                                _tmp75_ = r0;
3077
 
                                _tmp76_ = _tmp72_;
3078
 
                                _tmp77_ = chess_state_get_index (self, _tmp75_, _tmp76_);
3079
 
                                rook_start = _tmp77_;
3080
 
                                _tmp79_ = f1;
3081
 
                                _tmp80_ = f0;
3082
 
                                if (_tmp79_ > _tmp80_) {
3083
 
                                        gint _tmp81_;
3084
 
                                        _tmp81_ = f1;
3085
 
                                        _tmp78_ = _tmp81_ - 1;
3086
 
                                } else {
3087
 
                                        gint _tmp82_;
3088
 
                                        _tmp82_ = f1;
3089
 
                                        _tmp78_ = _tmp82_ + 1;
3090
 
                                }
3091
 
                                _tmp83_ = r0;
3092
 
                                _tmp84_ = _tmp78_;
3093
 
                                _tmp85_ = chess_state_get_index (self, _tmp83_, _tmp84_);
3094
 
                                rook_end = _tmp85_;
3095
 
                                _tmp86_ = f1;
3096
 
                                _tmp87_ = f0;
3097
 
                                if (_tmp86_ > _tmp87_) {
3098
 
                                        Color _tmp88_;
3099
 
                                        gboolean _tmp89_;
3100
 
                                        _tmp88_ = color;
3101
 
                                        _tmp89_ = self->can_castle_kingside[_tmp88_];
3102
 
                                        if (!_tmp89_) {
3103
 
                                                result = FALSE;
3104
 
                                                _chess_piece_unref0 (victim);
3105
 
                                                _chess_piece_unref0 (piece);
3106
 
                                                return result;
3107
 
                                        }
3108
 
                                } else {
3109
 
                                        Color _tmp90_;
3110
 
                                        gboolean _tmp91_;
3111
 
                                        _tmp90_ = color;
3112
 
                                        _tmp91_ = self->can_castle_queenside[_tmp90_];
3113
 
                                        if (!_tmp91_) {
3114
 
                                                result = FALSE;
3115
 
                                                _chess_piece_unref0 (victim);
3116
 
                                                _chess_piece_unref0 (piece);
3117
 
                                                return result;
3118
 
                                        }
3119
 
                                }
3120
 
                                _tmp92_ = rook_start;
3121
 
                                _tmp93_ = self->board[_tmp92_];
3122
 
                                _tmp94_ = _chess_piece_ref0 (_tmp93_);
3123
 
                                rook = _tmp94_;
3124
 
                                _tmp97_ = rook;
3125
 
                                if (_tmp97_ == NULL) {
3126
 
                                        _tmp96_ = TRUE;
3127
 
                                } else {
3128
 
                                        ChessPiece* _tmp98_;
3129
 
                                        PieceType _tmp99_;
3130
 
                                        _tmp98_ = rook;
3131
 
                                        _tmp99_ = _tmp98_->type;
3132
 
                                        _tmp96_ = _tmp99_ != PIECE_TYPE_ROOK;
3133
 
                                }
3134
 
                                _tmp100_ = _tmp96_;
3135
 
                                if (_tmp100_) {
3136
 
                                        _tmp95_ = TRUE;
3137
 
                                } else {
3138
 
                                        ChessPiece* _tmp101_;
3139
 
                                        Color _tmp102_;
3140
 
                                        Color _tmp103_;
3141
 
                                        Color _tmp104_;
3142
 
                                        _tmp101_ = rook;
3143
 
                                        _tmp102_ = chess_piece_get_color (_tmp101_);
3144
 
                                        _tmp103_ = _tmp102_;
3145
 
                                        _tmp104_ = color;
3146
 
                                        _tmp95_ = _tmp103_ != _tmp104_;
3147
 
                                }
3148
 
                                _tmp105_ = _tmp95_;
3149
 
                                if (_tmp105_) {
3150
 
                                        result = FALSE;
3151
 
                                        _chess_piece_unref0 (rook);
3152
 
                                        _chess_piece_unref0 (victim);
3153
 
                                        _chess_piece_unref0 (piece);
3154
 
                                        return result;
3155
 
                                }
3156
 
                                _tmp106_ = rook_start;
3157
 
                                _tmp107_ = rook_end;
3158
 
                                _tmp108_ = BIT_BOARD_over_masks[(_tmp106_ * 64) + _tmp107_];
3159
 
                                rook_over_mask = _tmp108_;
3160
 
                                _tmp109_ = rook_over_mask;
3161
 
                                _tmp110_ = self->priv->piece_masks[COLOR_WHITE];
3162
 
                                _tmp111_ = self->priv->piece_masks[COLOR_BLACK];
3163
 
                                if ((_tmp109_ & (_tmp110_ | _tmp111_)) != ((gint64) 0)) {
3164
 
                                        result = FALSE;
3165
 
                                        _chess_piece_unref0 (rook);
3166
 
                                        _chess_piece_unref0 (victim);
3167
 
                                        _chess_piece_unref0 (piece);
3168
 
                                        return result;
3169
 
                                }
3170
 
                                _tmp112_ = self->check_state;
3171
 
                                if (_tmp112_ == CHECK_STATE_CHECK) {
3172
 
                                        result = FALSE;
3173
 
                                        _chess_piece_unref0 (rook);
3174
 
                                        _chess_piece_unref0 (victim);
3175
 
                                        _chess_piece_unref0 (piece);
3176
 
                                        return result;
3177
 
                                }
3178
 
                                _tmp113_ = player;
3179
 
                                _tmp114_ = r0;
3180
 
                                _tmp115_ = f0;
3181
 
                                _tmp116_ = rook_end;
3182
 
                                _tmp117_ = chess_state_get_rank (self, _tmp116_);
3183
 
                                _tmp118_ = rook_end;
3184
 
                                _tmp119_ = chess_state_get_file (self, _tmp118_);
3185
 
                                _tmp120_ = chess_state_move_with_coords (self, _tmp113_, _tmp114_, _tmp115_, _tmp117_, _tmp119_, PIECE_TYPE_QUEEN, FALSE, TRUE);
3186
 
                                if (!_tmp120_) {
 
2916
                                gint _tmp79_ = 0;
 
2917
                                ChessPiece* rook = NULL;
 
2918
                                gint _tmp84_ = 0;
 
2919
                                ChessPiece* _tmp85_ = NULL;
 
2920
                                ChessPiece* _tmp86_ = NULL;
 
2921
                                gboolean _tmp87_ = FALSE;
 
2922
                                gboolean _tmp88_ = FALSE;
 
2923
                                ChessPiece* _tmp89_ = NULL;
 
2924
                                gint64 rook_over_mask = 0LL;
 
2925
                                gint _tmp96_ = 0;
 
2926
                                gint _tmp97_ = 0;
 
2927
                                gint64 _tmp98_ = 0LL;
 
2928
                                gint64 _tmp99_ = 0LL;
 
2929
                                gint64 _tmp100_ = 0LL;
 
2930
                                gint64 _tmp101_ = 0LL;
 
2931
                                CheckState _tmp102_ = 0;
 
2932
                                ChessPlayer* _tmp103_ = NULL;
 
2933
                                gint _tmp104_ = 0;
 
2934
                                gint _tmp105_ = 0;
 
2935
                                gint _tmp106_ = 0;
 
2936
                                gint _tmp107_ = 0;
 
2937
                                gint _tmp108_ = 0;
 
2938
                                gint _tmp109_ = 0;
 
2939
                                gboolean _tmp110_ = FALSE;
 
2940
                                _tmp67_ = f1;
 
2941
                                _tmp68_ = f0;
 
2942
                                if (_tmp67_ > _tmp68_) {
 
2943
                                        _tmp66_ = 7;
 
2944
                                } else {
 
2945
                                        _tmp66_ = 0;
 
2946
                                }
 
2947
                                _tmp69_ = r0;
 
2948
                                _tmp70_ = chess_state_get_index (self, _tmp69_, _tmp66_);
 
2949
                                rook_start = _tmp70_;
 
2950
                                _tmp72_ = f1;
 
2951
                                _tmp73_ = f0;
 
2952
                                if (_tmp72_ > _tmp73_) {
 
2953
                                        gint _tmp74_ = 0;
 
2954
                                        _tmp74_ = f1;
 
2955
                                        _tmp71_ = _tmp74_ - 1;
 
2956
                                } else {
 
2957
                                        gint _tmp75_ = 0;
 
2958
                                        _tmp75_ = f1;
 
2959
                                        _tmp71_ = _tmp75_ + 1;
 
2960
                                }
 
2961
                                _tmp76_ = r0;
 
2962
                                _tmp77_ = chess_state_get_index (self, _tmp76_, _tmp71_);
 
2963
                                rook_end = _tmp77_;
 
2964
                                _tmp78_ = f1;
 
2965
                                _tmp79_ = f0;
 
2966
                                if (_tmp78_ > _tmp79_) {
 
2967
                                        Color _tmp80_ = 0;
 
2968
                                        gboolean _tmp81_ = FALSE;
 
2969
                                        _tmp80_ = color;
 
2970
                                        _tmp81_ = self->can_castle_kingside[_tmp80_];
 
2971
                                        if (!_tmp81_) {
 
2972
                                                result = FALSE;
 
2973
                                                _chess_piece_unref0 (victim);
 
2974
                                                _chess_piece_unref0 (piece);
 
2975
                                                return result;
 
2976
                                        }
 
2977
                                } else {
 
2978
                                        Color _tmp82_ = 0;
 
2979
                                        gboolean _tmp83_ = FALSE;
 
2980
                                        _tmp82_ = color;
 
2981
                                        _tmp83_ = self->can_castle_queenside[_tmp82_];
 
2982
                                        if (!_tmp83_) {
 
2983
                                                result = FALSE;
 
2984
                                                _chess_piece_unref0 (victim);
 
2985
                                                _chess_piece_unref0 (piece);
 
2986
                                                return result;
 
2987
                                        }
 
2988
                                }
 
2989
                                _tmp84_ = rook_start;
 
2990
                                _tmp85_ = self->board[_tmp84_];
 
2991
                                _tmp86_ = _chess_piece_ref0 (_tmp85_);
 
2992
                                rook = _tmp86_;
 
2993
                                _tmp89_ = rook;
 
2994
                                if (_tmp89_ == NULL) {
 
2995
                                        _tmp88_ = TRUE;
 
2996
                                } else {
 
2997
                                        ChessPiece* _tmp90_ = NULL;
 
2998
                                        PieceType _tmp91_ = 0;
 
2999
                                        _tmp90_ = rook;
 
3000
                                        _tmp91_ = _tmp90_->type;
 
3001
                                        _tmp88_ = _tmp91_ != PIECE_TYPE_ROOK;
 
3002
                                }
 
3003
                                if (_tmp88_) {
 
3004
                                        _tmp87_ = TRUE;
 
3005
                                } else {
 
3006
                                        ChessPiece* _tmp92_ = NULL;
 
3007
                                        Color _tmp93_ = 0;
 
3008
                                        Color _tmp94_ = 0;
 
3009
                                        Color _tmp95_ = 0;
 
3010
                                        _tmp92_ = rook;
 
3011
                                        _tmp93_ = chess_piece_get_color (_tmp92_);
 
3012
                                        _tmp94_ = _tmp93_;
 
3013
                                        _tmp95_ = color;
 
3014
                                        _tmp87_ = _tmp94_ != _tmp95_;
 
3015
                                }
 
3016
                                if (_tmp87_) {
 
3017
                                        result = FALSE;
 
3018
                                        _chess_piece_unref0 (rook);
 
3019
                                        _chess_piece_unref0 (victim);
 
3020
                                        _chess_piece_unref0 (piece);
 
3021
                                        return result;
 
3022
                                }
 
3023
                                _tmp96_ = rook_start;
 
3024
                                _tmp97_ = rook_end;
 
3025
                                _tmp98_ = BIT_BOARD_over_masks[(_tmp96_ * 64) + _tmp97_];
 
3026
                                rook_over_mask = _tmp98_;
 
3027
                                _tmp99_ = rook_over_mask;
 
3028
                                _tmp100_ = self->priv->piece_masks[COLOR_WHITE];
 
3029
                                _tmp101_ = self->priv->piece_masks[COLOR_BLACK];
 
3030
                                if ((_tmp99_ & (_tmp100_ | _tmp101_)) != ((gint64) 0)) {
 
3031
                                        result = FALSE;
 
3032
                                        _chess_piece_unref0 (rook);
 
3033
                                        _chess_piece_unref0 (victim);
 
3034
                                        _chess_piece_unref0 (piece);
 
3035
                                        return result;
 
3036
                                }
 
3037
                                _tmp102_ = self->check_state;
 
3038
                                if (_tmp102_ == CHECK_STATE_CHECK) {
 
3039
                                        result = FALSE;
 
3040
                                        _chess_piece_unref0 (rook);
 
3041
                                        _chess_piece_unref0 (victim);
 
3042
                                        _chess_piece_unref0 (piece);
 
3043
                                        return result;
 
3044
                                }
 
3045
                                _tmp103_ = player;
 
3046
                                _tmp104_ = r0;
 
3047
                                _tmp105_ = f0;
 
3048
                                _tmp106_ = rook_end;
 
3049
                                _tmp107_ = chess_state_get_rank (self, _tmp106_);
 
3050
                                _tmp108_ = rook_end;
 
3051
                                _tmp109_ = chess_state_get_file (self, _tmp108_);
 
3052
                                _tmp110_ = chess_state_move_with_coords (self, _tmp103_, _tmp104_, _tmp105_, _tmp107_, _tmp109_, PIECE_TYPE_QUEEN, FALSE, TRUE);
 
3053
                                if (!_tmp110_) {
3187
3054
                                        result = FALSE;
3188
3055
                                        _chess_piece_unref0 (rook);
3189
3056
                                        _chess_piece_unref0 (victim);
3199
3066
                        break;
3200
3067
                }
3201
3068
        }
3202
 
        _tmp122_ = apply;
3203
 
        if (!_tmp122_) {
3204
 
                gboolean _tmp123_;
3205
 
                _tmp123_ = test_check;
3206
 
                _tmp121_ = !_tmp123_;
 
3069
        _tmp112_ = apply;
 
3070
        if (!_tmp112_) {
 
3071
                gboolean _tmp113_ = FALSE;
 
3072
                _tmp113_ = test_check;
 
3073
                _tmp111_ = !_tmp113_;
3207
3074
        } else {
3208
 
                _tmp121_ = FALSE;
 
3075
                _tmp111_ = FALSE;
3209
3076
        }
3210
 
        _tmp124_ = _tmp121_;
3211
 
        if (_tmp124_) {
 
3077
        if (_tmp111_) {
3212
3078
                result = TRUE;
3213
3079
                _chess_piece_unref0 (victim);
3214
3080
                _chess_piece_unref0 (piece);
3215
3081
                return result;
3216
3082
        }
3217
 
        _tmp125_ = apply;
3218
 
        if (_tmp125_) {
 
3083
        _tmp114_ = apply;
 
3084
        if (_tmp114_) {
3219
3085
                {
3220
 
                        gint i;
 
3086
                        gint i = 0;
3221
3087
                        i = 0;
3222
3088
                        {
3223
 
                                gboolean _tmp126_;
3224
 
                                _tmp126_ = TRUE;
 
3089
                                gboolean _tmp115_ = FALSE;
 
3090
                                _tmp115_ = TRUE;
3225
3091
                                while (TRUE) {
3226
 
                                        gboolean _tmp127_;
3227
 
                                        gint _tmp129_;
3228
 
                                        gint _tmp130_;
3229
 
                                        gint _tmp131_;
3230
 
                                        gint _tmp132_;
3231
 
                                        ChessPiece* _tmp133_;
3232
 
                                        ChessPiece* _tmp134_;
3233
 
                                        ChessPiece* p;
3234
 
                                        gboolean _tmp135_ = FALSE;
3235
 
                                        gboolean _tmp136_ = FALSE;
3236
 
                                        ChessPiece* _tmp137_;
3237
 
                                        gboolean _tmp141_;
3238
 
                                        gboolean _tmp146_;
3239
 
                                        gint _tmp147_;
3240
 
                                        gint _tmp148_ = 0;
3241
 
                                        gint r;
3242
 
                                        gint _tmp149_;
3243
 
                                        gint _tmp150_ = 0;
3244
 
                                        gint f;
3245
 
                                        ChessPlayer* _tmp151_;
3246
 
                                        gint _tmp152_;
3247
 
                                        gint _tmp153_;
3248
 
                                        gint _tmp154_;
3249
 
                                        gint _tmp155_;
3250
 
                                        gboolean _tmp156_ = FALSE;
3251
 
                                        _tmp127_ = _tmp126_;
3252
 
                                        if (!_tmp127_) {
3253
 
                                                gint _tmp128_;
3254
 
                                                _tmp128_ = i;
3255
 
                                                i = _tmp128_ + 1;
 
3092
                                        gint _tmp117_ = 0;
 
3093
                                        gint _tmp118_ = 0;
 
3094
                                        gint _tmp119_ = 0;
 
3095
                                        ChessPiece* p = NULL;
 
3096
                                        gint _tmp120_ = 0;
 
3097
                                        ChessPiece* _tmp121_ = NULL;
 
3098
                                        ChessPiece* _tmp122_ = NULL;
 
3099
                                        gboolean _tmp123_ = FALSE;
 
3100
                                        gboolean _tmp124_ = FALSE;
 
3101
                                        ChessPiece* _tmp125_ = NULL;
 
3102
                                        gint r = 0;
 
3103
                                        gint _tmp133_ = 0;
 
3104
                                        gint _tmp134_ = 0;
 
3105
                                        gint f = 0;
 
3106
                                        gint _tmp135_ = 0;
 
3107
                                        gint _tmp136_ = 0;
 
3108
                                        ChessPlayer* _tmp137_ = NULL;
 
3109
                                        gint _tmp138_ = 0;
 
3110
                                        gint _tmp139_ = 0;
 
3111
                                        gint _tmp140_ = 0;
 
3112
                                        gint _tmp141_ = 0;
 
3113
                                        gboolean _tmp142_ = FALSE;
 
3114
                                        if (!_tmp115_) {
 
3115
                                                gint _tmp116_ = 0;
 
3116
                                                _tmp116_ = i;
 
3117
                                                i = _tmp116_ + 1;
3256
3118
                                        }
3257
 
                                        _tmp126_ = FALSE;
3258
 
                                        _tmp129_ = i;
3259
 
                                        if (!(_tmp129_ < 64)) {
 
3119
                                        _tmp115_ = FALSE;
 
3120
                                        _tmp117_ = i;
 
3121
                                        if (!(_tmp117_ < 64)) {
3260
3122
                                                break;
3261
3123
                                        }
3262
 
                                        _tmp130_ = i;
3263
 
                                        _tmp131_ = start;
3264
 
                                        if (_tmp130_ == _tmp131_) {
 
3124
                                        _tmp118_ = i;
 
3125
                                        _tmp119_ = start;
 
3126
                                        if (_tmp118_ == _tmp119_) {
3265
3127
                                                continue;
3266
3128
                                        }
3267
 
                                        _tmp132_ = i;
3268
 
                                        _tmp133_ = self->board[_tmp132_];
3269
 
                                        _tmp134_ = _chess_piece_ref0 (_tmp133_);
3270
 
                                        p = _tmp134_;
3271
 
                                        _tmp137_ = p;
3272
 
                                        if (_tmp137_ == NULL) {
3273
 
                                                _tmp136_ = TRUE;
3274
 
                                        } else {
3275
 
                                                ChessPiece* _tmp138_;
3276
 
                                                ChessPlayer* _tmp139_;
3277
 
                                                ChessPlayer* _tmp140_;
3278
 
                                                _tmp138_ = p;
3279
 
                                                _tmp139_ = _tmp138_->player;
3280
 
                                                _tmp140_ = player;
3281
 
                                                _tmp136_ = _tmp139_ != _tmp140_;
3282
 
                                        }
3283
 
                                        _tmp141_ = _tmp136_;
3284
 
                                        if (_tmp141_) {
3285
 
                                                _tmp135_ = TRUE;
3286
 
                                        } else {
3287
 
                                                ChessPiece* _tmp142_;
3288
 
                                                PieceType _tmp143_;
3289
 
                                                ChessPiece* _tmp144_;
3290
 
                                                PieceType _tmp145_;
3291
 
                                                _tmp142_ = p;
3292
 
                                                _tmp143_ = _tmp142_->type;
3293
 
                                                _tmp144_ = piece;
3294
 
                                                _tmp145_ = _tmp144_->type;
3295
 
                                                _tmp135_ = _tmp143_ != _tmp145_;
3296
 
                                        }
3297
 
                                        _tmp146_ = _tmp135_;
3298
 
                                        if (_tmp146_) {
 
3129
                                        _tmp120_ = i;
 
3130
                                        _tmp121_ = self->board[_tmp120_];
 
3131
                                        _tmp122_ = _chess_piece_ref0 (_tmp121_);
 
3132
                                        p = _tmp122_;
 
3133
                                        _tmp125_ = p;
 
3134
                                        if (_tmp125_ == NULL) {
 
3135
                                                _tmp124_ = TRUE;
 
3136
                                        } else {
 
3137
                                                ChessPiece* _tmp126_ = NULL;
 
3138
                                                ChessPlayer* _tmp127_ = NULL;
 
3139
                                                ChessPlayer* _tmp128_ = NULL;
 
3140
                                                _tmp126_ = p;
 
3141
                                                _tmp127_ = _tmp126_->player;
 
3142
                                                _tmp128_ = player;
 
3143
                                                _tmp124_ = _tmp127_ != _tmp128_;
 
3144
                                        }
 
3145
                                        if (_tmp124_) {
 
3146
                                                _tmp123_ = TRUE;
 
3147
                                        } else {
 
3148
                                                ChessPiece* _tmp129_ = NULL;
 
3149
                                                PieceType _tmp130_ = 0;
 
3150
                                                ChessPiece* _tmp131_ = NULL;
 
3151
                                                PieceType _tmp132_ = 0;
 
3152
                                                _tmp129_ = p;
 
3153
                                                _tmp130_ = _tmp129_->type;
 
3154
                                                _tmp131_ = piece;
 
3155
                                                _tmp132_ = _tmp131_->type;
 
3156
                                                _tmp123_ = _tmp130_ != _tmp132_;
 
3157
                                        }
 
3158
                                        if (_tmp123_) {
3299
3159
                                                _chess_piece_unref0 (p);
3300
3160
                                                continue;
3301
3161
                                        }
3302
 
                                        _tmp147_ = i;
3303
 
                                        _tmp148_ = chess_state_get_rank (self, _tmp147_);
3304
 
                                        r = _tmp148_;
3305
 
                                        _tmp149_ = i;
3306
 
                                        _tmp150_ = chess_state_get_file (self, _tmp149_);
3307
 
                                        f = _tmp150_;
3308
 
                                        _tmp151_ = player;
3309
 
                                        _tmp152_ = r;
3310
 
                                        _tmp153_ = f;
3311
 
                                        _tmp154_ = r1;
3312
 
                                        _tmp155_ = f1;
3313
 
                                        _tmp156_ = chess_state_move_with_coords (self, _tmp151_, _tmp152_, _tmp153_, _tmp154_, _tmp155_, PIECE_TYPE_QUEEN, FALSE, TRUE);
3314
 
                                        if (_tmp156_) {
3315
 
                                                gint _tmp157_;
3316
 
                                                gint _tmp158_;
3317
 
                                                gint _tmp159_;
3318
 
                                                gint _tmp160_;
3319
 
                                                _tmp157_ = r;
3320
 
                                                _tmp158_ = r0;
3321
 
                                                if (_tmp157_ != _tmp158_) {
 
3162
                                        _tmp133_ = i;
 
3163
                                        _tmp134_ = chess_state_get_rank (self, _tmp133_);
 
3164
                                        r = _tmp134_;
 
3165
                                        _tmp135_ = i;
 
3166
                                        _tmp136_ = chess_state_get_file (self, _tmp135_);
 
3167
                                        f = _tmp136_;
 
3168
                                        _tmp137_ = player;
 
3169
                                        _tmp138_ = r;
 
3170
                                        _tmp139_ = f;
 
3171
                                        _tmp140_ = r1;
 
3172
                                        _tmp141_ = f1;
 
3173
                                        _tmp142_ = chess_state_move_with_coords (self, _tmp137_, _tmp138_, _tmp139_, _tmp140_, _tmp141_, PIECE_TYPE_QUEEN, FALSE, TRUE);
 
3174
                                        if (_tmp142_) {
 
3175
                                                gint _tmp143_ = 0;
 
3176
                                                gint _tmp144_ = 0;
 
3177
                                                gint _tmp145_ = 0;
 
3178
                                                gint _tmp146_ = 0;
 
3179
                                                _tmp143_ = r;
 
3180
                                                _tmp144_ = r0;
 
3181
                                                if (_tmp143_ != _tmp144_) {
3322
3182
                                                        ambiguous_rank = TRUE;
3323
3183
                                                }
3324
 
                                                _tmp159_ = f;
3325
 
                                                _tmp160_ = f0;
3326
 
                                                if (_tmp159_ != _tmp160_) {
 
3184
                                                _tmp145_ = f;
 
3185
                                                _tmp146_ = f0;
 
3186
                                                if (_tmp145_ != _tmp146_) {
3327
3187
                                                        ambiguous_file = TRUE;
3328
3188
                                                }
3329
3189
                                        }
3332
3192
                        }
3333
3193
                }
3334
3194
        }
3335
 
        _tmp161_ = self->priv->piece_masks[COLOR_WHITE];
3336
 
        old_white_mask = _tmp161_;
 
3195
        _tmp147_ = self->priv->piece_masks[COLOR_WHITE];
 
3196
        old_white_mask = _tmp147_;
 
3197
        _tmp148_ = self->priv->piece_masks[COLOR_BLACK];
 
3198
        old_black_mask = _tmp148_;
 
3199
        _tmp149_ = self->can_castle_kingside[COLOR_WHITE];
 
3200
        old_white_can_castle_kingside = _tmp149_;
 
3201
        _tmp150_ = self->can_castle_queenside[COLOR_WHITE];
 
3202
        old_white_can_castle_queenside = _tmp150_;
 
3203
        _tmp151_ = self->can_castle_kingside[COLOR_BLACK];
 
3204
        old_black_can_castle_kingside = _tmp151_;
 
3205
        _tmp152_ = self->can_castle_queenside[COLOR_BLACK];
 
3206
        old_black_can_castle_queenside = _tmp152_;
 
3207
        _tmp153_ = self->en_passant_index;
 
3208
        old_en_passant_index = _tmp153_;
 
3209
        _tmp154_ = self->halfmove_clock;
 
3210
        old_halfmove_clock = _tmp154_;
 
3211
        _tmp155_ = start;
 
3212
        _chess_piece_unref0 (self->board[_tmp155_]);
 
3213
        self->board[_tmp155_] = NULL;
 
3214
        _tmp156_ = self->board[_tmp155_];
 
3215
        _tmp157_ = start;
 
3216
        _tmp158_ = BIT_BOARD_clear_location_masks[_tmp157_];
 
3217
        self->priv->piece_masks[COLOR_WHITE] &= _tmp158_;
 
3218
        _tmp159_ = self->priv->piece_masks[COLOR_WHITE];
 
3219
        _tmp160_ = start;
 
3220
        _tmp161_ = BIT_BOARD_clear_location_masks[_tmp160_];
 
3221
        self->priv->piece_masks[COLOR_BLACK] &= _tmp161_;
3337
3222
        _tmp162_ = self->priv->piece_masks[COLOR_BLACK];
3338
 
        old_black_mask = _tmp162_;
3339
 
        _tmp163_ = self->can_castle_kingside[COLOR_WHITE];
3340
 
        old_white_can_castle_kingside = _tmp163_;
3341
 
        _tmp164_ = self->can_castle_queenside[COLOR_WHITE];
3342
 
        old_white_can_castle_queenside = _tmp164_;
3343
 
        _tmp165_ = self->can_castle_kingside[COLOR_BLACK];
3344
 
        old_black_can_castle_kingside = _tmp165_;
3345
 
        _tmp166_ = self->can_castle_queenside[COLOR_BLACK];
3346
 
        old_black_can_castle_queenside = _tmp166_;
3347
 
        _tmp167_ = self->en_passant_index;
3348
 
        old_en_passant_index = _tmp167_;
3349
 
        _tmp168_ = self->halfmove_clock;
3350
 
        old_halfmove_clock = _tmp168_;
3351
 
        _tmp169_ = start;
3352
 
        _chess_piece_unref0 (self->board[_tmp169_]);
3353
 
        self->board[_tmp169_] = NULL;
3354
 
        _tmp170_ = self->board[_tmp169_];
3355
 
        _tmp171_ = start;
3356
 
        _tmp172_ = BIT_BOARD_clear_location_masks[_tmp171_];
3357
 
        self->priv->piece_masks[COLOR_WHITE] &= _tmp172_;
3358
 
        _tmp173_ = self->priv->piece_masks[COLOR_WHITE];
3359
 
        _tmp174_ = start;
3360
 
        _tmp175_ = BIT_BOARD_clear_location_masks[_tmp174_];
3361
 
        self->priv->piece_masks[COLOR_BLACK] &= _tmp175_;
3362
 
        _tmp176_ = self->priv->piece_masks[COLOR_BLACK];
3363
 
        _tmp177_ = victim;
3364
 
        if (_tmp177_ != NULL) {
3365
 
                gint _tmp178_;
3366
 
                ChessPiece* _tmp179_;
3367
 
                gint _tmp180_;
3368
 
                gint64 _tmp181_;
3369
 
                gint64 _tmp182_;
3370
 
                gint _tmp183_;
3371
 
                gint64 _tmp184_;
3372
 
                gint64 _tmp185_;
3373
 
                _tmp178_ = victim_index;
 
3223
        _tmp163_ = victim;
 
3224
        if (_tmp163_ != NULL) {
 
3225
                gint _tmp164_ = 0;
 
3226
                ChessPiece* _tmp165_ = NULL;
 
3227
                gint _tmp166_ = 0;
 
3228
                gint64 _tmp167_ = 0LL;
 
3229
                gint64 _tmp168_ = 0LL;
 
3230
                gint _tmp169_ = 0;
 
3231
                gint64 _tmp170_ = 0LL;
 
3232
                gint64 _tmp171_ = 0LL;
 
3233
                _tmp164_ = victim_index;
 
3234
                _chess_piece_unref0 (self->board[_tmp164_]);
 
3235
                self->board[_tmp164_] = NULL;
 
3236
                _tmp165_ = self->board[_tmp164_];
 
3237
                _tmp166_ = victim_index;
 
3238
                _tmp167_ = BIT_BOARD_clear_location_masks[_tmp166_];
 
3239
                self->priv->piece_masks[COLOR_WHITE] &= _tmp167_;
 
3240
                _tmp168_ = self->priv->piece_masks[COLOR_WHITE];
 
3241
                _tmp169_ = victim_index;
 
3242
                _tmp170_ = BIT_BOARD_clear_location_masks[_tmp169_];
 
3243
                self->priv->piece_masks[COLOR_BLACK] &= _tmp170_;
 
3244
                _tmp171_ = self->priv->piece_masks[COLOR_BLACK];
 
3245
        }
 
3246
        _tmp172_ = is_promotion;
 
3247
        if (_tmp172_) {
 
3248
                gint _tmp173_ = 0;
 
3249
                ChessPlayer* _tmp174_ = NULL;
 
3250
                PieceType _tmp175_ = 0;
 
3251
                ChessPiece* _tmp176_ = NULL;
 
3252
                ChessPiece* _tmp177_ = NULL;
 
3253
                _tmp173_ = end;
 
3254
                _tmp174_ = player;
 
3255
                _tmp175_ = promotion_type;
 
3256
                _tmp176_ = chess_piece_new (_tmp174_, _tmp175_);
 
3257
                _chess_piece_unref0 (self->board[_tmp173_]);
 
3258
                self->board[_tmp173_] = _tmp176_;
 
3259
                _tmp177_ = self->board[_tmp173_];
 
3260
        } else {
 
3261
                gint _tmp178_ = 0;
 
3262
                ChessPiece* _tmp179_ = NULL;
 
3263
                ChessPiece* _tmp180_ = NULL;
 
3264
                ChessPiece* _tmp181_ = NULL;
 
3265
                _tmp178_ = end;
 
3266
                _tmp179_ = piece;
 
3267
                _tmp180_ = _chess_piece_ref0 (_tmp179_);
3374
3268
                _chess_piece_unref0 (self->board[_tmp178_]);
3375
 
                self->board[_tmp178_] = NULL;
3376
 
                _tmp179_ = self->board[_tmp178_];
3377
 
                _tmp180_ = victim_index;
3378
 
                _tmp181_ = BIT_BOARD_clear_location_masks[_tmp180_];
3379
 
                self->priv->piece_masks[COLOR_WHITE] &= _tmp181_;
3380
 
                _tmp182_ = self->priv->piece_masks[COLOR_WHITE];
3381
 
                _tmp183_ = victim_index;
3382
 
                _tmp184_ = BIT_BOARD_clear_location_masks[_tmp183_];
3383
 
                self->priv->piece_masks[COLOR_BLACK] &= _tmp184_;
3384
 
                _tmp185_ = self->priv->piece_masks[COLOR_BLACK];
3385
 
        }
3386
 
        _tmp186_ = is_promotion;
3387
 
        if (_tmp186_) {
3388
 
                gint _tmp187_;
3389
 
                ChessPlayer* _tmp188_;
3390
 
                PieceType _tmp189_;
3391
 
                ChessPiece* _tmp190_;
3392
 
                ChessPiece* _tmp191_;
3393
 
                _tmp187_ = end;
3394
 
                _tmp188_ = player;
3395
 
                _tmp189_ = promotion_type;
3396
 
                _tmp190_ = chess_piece_new (_tmp188_, _tmp189_);
3397
 
                _chess_piece_unref0 (self->board[_tmp187_]);
3398
 
                self->board[_tmp187_] = _tmp190_;
3399
 
                _tmp191_ = self->board[_tmp187_];
3400
 
        } else {
3401
 
                gint _tmp192_;
3402
 
                ChessPiece* _tmp193_;
3403
 
                ChessPiece* _tmp194_;
3404
 
                ChessPiece* _tmp195_;
3405
 
                _tmp192_ = end;
3406
 
                _tmp193_ = piece;
3407
 
                _tmp194_ = _chess_piece_ref0 (_tmp193_);
3408
 
                _chess_piece_unref0 (self->board[_tmp192_]);
3409
 
                self->board[_tmp192_] = _tmp194_;
3410
 
                _tmp195_ = self->board[_tmp192_];
3411
 
        }
3412
 
        _tmp196_ = color;
3413
 
        _tmp197_ = end_mask;
3414
 
        self->priv->piece_masks[_tmp196_] |= _tmp197_;
3415
 
        _tmp198_ = self->priv->piece_masks[_tmp196_];
3416
 
        _tmp199_ = opponent_color;
3417
 
        _tmp200_ = end;
3418
 
        _tmp201_ = BIT_BOARD_clear_location_masks[_tmp200_];
3419
 
        self->priv->piece_masks[_tmp199_] &= _tmp201_;
3420
 
        _tmp202_ = self->priv->piece_masks[_tmp199_];
3421
 
        _tmp203_ = rook_start;
3422
 
        if (_tmp203_ >= 0) {
3423
 
                gint _tmp204_;
3424
 
                ChessPiece* _tmp205_;
3425
 
                ChessPiece* _tmp206_;
3426
 
                ChessPiece* rook;
3427
 
                gint _tmp207_;
3428
 
                ChessPiece* _tmp208_;
3429
 
                Color _tmp209_;
3430
 
                gint _tmp210_;
3431
 
                gint64 _tmp211_;
3432
 
                gint64 _tmp212_;
3433
 
                gint _tmp213_;
3434
 
                ChessPiece* _tmp214_;
3435
 
                ChessPiece* _tmp215_;
3436
 
                ChessPiece* _tmp216_;
3437
 
                Color _tmp217_;
3438
 
                gint _tmp218_;
3439
 
                gint64 _tmp219_;
3440
 
                gint64 _tmp220_;
3441
 
                _tmp204_ = rook_start;
3442
 
                _tmp205_ = self->board[_tmp204_];
3443
 
                _tmp206_ = _chess_piece_ref0 (_tmp205_);
3444
 
                rook = _tmp206_;
3445
 
                _tmp207_ = rook_start;
3446
 
                _chess_piece_unref0 (self->board[_tmp207_]);
3447
 
                self->board[_tmp207_] = NULL;
3448
 
                _tmp208_ = self->board[_tmp207_];
 
3269
                self->board[_tmp178_] = _tmp180_;
 
3270
                _tmp181_ = self->board[_tmp178_];
 
3271
        }
 
3272
        _tmp182_ = color;
 
3273
        _tmp183_ = end_mask;
 
3274
        self->priv->piece_masks[_tmp182_] |= _tmp183_;
 
3275
        _tmp184_ = self->priv->piece_masks[_tmp182_];
 
3276
        _tmp185_ = opponent_color;
 
3277
        _tmp186_ = end;
 
3278
        _tmp187_ = BIT_BOARD_clear_location_masks[_tmp186_];
 
3279
        self->priv->piece_masks[_tmp185_] &= _tmp187_;
 
3280
        _tmp188_ = self->priv->piece_masks[_tmp185_];
 
3281
        _tmp189_ = rook_start;
 
3282
        if (_tmp189_ >= 0) {
 
3283
                ChessPiece* rook = NULL;
 
3284
                gint _tmp190_ = 0;
 
3285
                ChessPiece* _tmp191_ = NULL;
 
3286
                ChessPiece* _tmp192_ = NULL;
 
3287
                gint _tmp193_ = 0;
 
3288
                ChessPiece* _tmp194_ = NULL;
 
3289
                Color _tmp195_ = 0;
 
3290
                gint _tmp196_ = 0;
 
3291
                gint64 _tmp197_ = 0LL;
 
3292
                gint64 _tmp198_ = 0LL;
 
3293
                gint _tmp199_ = 0;
 
3294
                ChessPiece* _tmp200_ = NULL;
 
3295
                ChessPiece* _tmp201_ = NULL;
 
3296
                ChessPiece* _tmp202_ = NULL;
 
3297
                Color _tmp203_ = 0;
 
3298
                gint _tmp204_ = 0;
 
3299
                gint64 _tmp205_ = 0LL;
 
3300
                gint64 _tmp206_ = 0LL;
 
3301
                _tmp190_ = rook_start;
 
3302
                _tmp191_ = self->board[_tmp190_];
 
3303
                _tmp192_ = _chess_piece_ref0 (_tmp191_);
 
3304
                rook = _tmp192_;
 
3305
                _tmp193_ = rook_start;
 
3306
                _chess_piece_unref0 (self->board[_tmp193_]);
 
3307
                self->board[_tmp193_] = NULL;
 
3308
                _tmp194_ = self->board[_tmp193_];
 
3309
                _tmp195_ = color;
 
3310
                _tmp196_ = rook_start;
 
3311
                _tmp197_ = BIT_BOARD_clear_location_masks[_tmp196_];
 
3312
                self->priv->piece_masks[_tmp195_] &= _tmp197_;
 
3313
                _tmp198_ = self->priv->piece_masks[_tmp195_];
 
3314
                _tmp199_ = rook_end;
 
3315
                _tmp200_ = rook;
 
3316
                _tmp201_ = _chess_piece_ref0 (_tmp200_);
 
3317
                _chess_piece_unref0 (self->board[_tmp199_]);
 
3318
                self->board[_tmp199_] = _tmp201_;
 
3319
                _tmp202_ = self->board[_tmp199_];
 
3320
                _tmp203_ = color;
 
3321
                _tmp204_ = rook_end;
 
3322
                _tmp205_ = BIT_BOARD_set_location_masks[_tmp204_];
 
3323
                self->priv->piece_masks[_tmp203_] |= _tmp205_;
 
3324
                _tmp206_ = self->priv->piece_masks[_tmp203_];
 
3325
                _chess_piece_unref0 (rook);
 
3326
        }
 
3327
        _tmp207_ = piece;
 
3328
        _tmp208_ = _tmp207_->type;
 
3329
        if (_tmp208_ == PIECE_TYPE_KING) {
 
3330
                Color _tmp209_ = 0;
 
3331
                gboolean _tmp210_ = FALSE;
 
3332
                Color _tmp211_ = 0;
 
3333
                gboolean _tmp212_ = FALSE;
3449
3334
                _tmp209_ = color;
3450
 
                _tmp210_ = rook_start;
3451
 
                _tmp211_ = BIT_BOARD_clear_location_masks[_tmp210_];
3452
 
                self->priv->piece_masks[_tmp209_] &= _tmp211_;
3453
 
                _tmp212_ = self->priv->piece_masks[_tmp209_];
3454
 
                _tmp213_ = rook_end;
3455
 
                _tmp214_ = rook;
3456
 
                _tmp215_ = _chess_piece_ref0 (_tmp214_);
3457
 
                _chess_piece_unref0 (self->board[_tmp213_]);
3458
 
                self->board[_tmp213_] = _tmp215_;
3459
 
                _tmp216_ = self->board[_tmp213_];
3460
 
                _tmp217_ = color;
3461
 
                _tmp218_ = rook_end;
3462
 
                _tmp219_ = BIT_BOARD_set_location_masks[_tmp218_];
3463
 
                self->priv->piece_masks[_tmp217_] |= _tmp219_;
3464
 
                _tmp220_ = self->priv->piece_masks[_tmp217_];
3465
 
                _chess_piece_unref0 (rook);
3466
 
        }
3467
 
        _tmp221_ = piece;
3468
 
        _tmp222_ = _tmp221_->type;
3469
 
        if (_tmp222_ == PIECE_TYPE_KING) {
3470
 
                Color _tmp223_;
3471
 
                gboolean _tmp224_;
3472
 
                Color _tmp225_;
3473
 
                gboolean _tmp226_;
3474
 
                _tmp223_ = color;
3475
 
                self->can_castle_kingside[_tmp223_] = FALSE;
3476
 
                _tmp224_ = self->can_castle_kingside[_tmp223_];
3477
 
                _tmp225_ = color;
3478
 
                self->can_castle_queenside[_tmp225_] = FALSE;
3479
 
                _tmp226_ = self->can_castle_queenside[_tmp225_];
 
3335
                self->can_castle_kingside[_tmp209_] = FALSE;
 
3336
                _tmp210_ = self->can_castle_kingside[_tmp209_];
 
3337
                _tmp211_ = color;
 
3338
                self->can_castle_queenside[_tmp211_] = FALSE;
 
3339
                _tmp212_ = self->can_castle_queenside[_tmp211_];
3480
3340
        } else {
3481
 
                ChessPiece* _tmp227_;
3482
 
                PieceType _tmp228_;
3483
 
                _tmp227_ = piece;
3484
 
                _tmp228_ = _tmp227_->type;
3485
 
                if (_tmp228_ == PIECE_TYPE_ROOK) {
3486
 
                        gint _tmp229_ = 0;
3487
 
                        Color _tmp230_;
3488
 
                        gint _tmp231_;
3489
 
                        gint base_rank;
3490
 
                        gint _tmp232_;
3491
 
                        gint _tmp233_;
3492
 
                        _tmp230_ = color;
3493
 
                        if (_tmp230_ == COLOR_WHITE) {
3494
 
                                _tmp229_ = 0;
 
3341
                ChessPiece* _tmp213_ = NULL;
 
3342
                PieceType _tmp214_ = 0;
 
3343
                _tmp213_ = piece;
 
3344
                _tmp214_ = _tmp213_->type;
 
3345
                if (_tmp214_ == PIECE_TYPE_ROOK) {
 
3346
                        gint _tmp215_ = 0;
 
3347
                        Color _tmp216_ = 0;
 
3348
                        gint base_rank = 0;
 
3349
                        gint _tmp217_ = 0;
 
3350
                        gint _tmp218_ = 0;
 
3351
                        _tmp216_ = color;
 
3352
                        if (_tmp216_ == COLOR_WHITE) {
 
3353
                                _tmp215_ = 0;
3495
3354
                        } else {
3496
 
                                _tmp229_ = 7;
 
3355
                                _tmp215_ = 7;
3497
3356
                        }
3498
 
                        _tmp231_ = _tmp229_;
3499
 
                        base_rank = _tmp231_;
3500
 
                        _tmp232_ = r0;
3501
 
                        _tmp233_ = base_rank;
3502
 
                        if (_tmp232_ == _tmp233_) {
3503
 
                                gint _tmp234_;
3504
 
                                _tmp234_ = f0;
3505
 
                                if (_tmp234_ == 0) {
3506
 
                                        Color _tmp235_;
3507
 
                                        gboolean _tmp236_;
3508
 
                                        _tmp235_ = color;
3509
 
                                        self->can_castle_queenside[_tmp235_] = FALSE;
3510
 
                                        _tmp236_ = self->can_castle_queenside[_tmp235_];
 
3357
                        base_rank = _tmp215_;
 
3358
                        _tmp217_ = r0;
 
3359
                        _tmp218_ = base_rank;
 
3360
                        if (_tmp217_ == _tmp218_) {
 
3361
                                gint _tmp219_ = 0;
 
3362
                                _tmp219_ = f0;
 
3363
                                if (_tmp219_ == 0) {
 
3364
                                        Color _tmp220_ = 0;
 
3365
                                        gboolean _tmp221_ = FALSE;
 
3366
                                        _tmp220_ = color;
 
3367
                                        self->can_castle_queenside[_tmp220_] = FALSE;
 
3368
                                        _tmp221_ = self->can_castle_queenside[_tmp220_];
3511
3369
                                } else {
3512
 
                                        gint _tmp237_;
3513
 
                                        _tmp237_ = f0;
3514
 
                                        if (_tmp237_ == 7) {
3515
 
                                                Color _tmp238_;
3516
 
                                                gboolean _tmp239_;
3517
 
                                                _tmp238_ = color;
3518
 
                                                self->can_castle_kingside[_tmp238_] = FALSE;
3519
 
                                                _tmp239_ = self->can_castle_kingside[_tmp238_];
 
3370
                                        gint _tmp222_ = 0;
 
3371
                                        _tmp222_ = f0;
 
3372
                                        if (_tmp222_ == 7) {
 
3373
                                                Color _tmp223_ = 0;
 
3374
                                                gboolean _tmp224_ = FALSE;
 
3375
                                                _tmp223_ = color;
 
3376
                                                self->can_castle_kingside[_tmp223_] = FALSE;
 
3377
                                                _tmp224_ = self->can_castle_kingside[_tmp223_];
3520
3378
                                        }
3521
3379
                                }
3522
3380
                        }
3523
3381
                } else {
3524
 
                        gboolean _tmp240_ = FALSE;
3525
 
                        ChessPiece* _tmp241_;
3526
 
                        gboolean _tmp244_;
3527
 
                        _tmp241_ = victim;
3528
 
                        if (_tmp241_ != NULL) {
3529
 
                                ChessPiece* _tmp242_;
3530
 
                                PieceType _tmp243_;
3531
 
                                _tmp242_ = victim;
3532
 
                                _tmp243_ = _tmp242_->type;
3533
 
                                _tmp240_ = _tmp243_ == PIECE_TYPE_ROOK;
 
3382
                        gboolean _tmp225_ = FALSE;
 
3383
                        ChessPiece* _tmp226_ = NULL;
 
3384
                        _tmp226_ = victim;
 
3385
                        if (_tmp226_ != NULL) {
 
3386
                                ChessPiece* _tmp227_ = NULL;
 
3387
                                PieceType _tmp228_ = 0;
 
3388
                                _tmp227_ = victim;
 
3389
                                _tmp228_ = _tmp227_->type;
 
3390
                                _tmp225_ = _tmp228_ == PIECE_TYPE_ROOK;
3534
3391
                        } else {
3535
 
                                _tmp240_ = FALSE;
 
3392
                                _tmp225_ = FALSE;
3536
3393
                        }
3537
 
                        _tmp244_ = _tmp240_;
3538
 
                        if (_tmp244_) {
3539
 
                                gint _tmp245_ = 0;
3540
 
                                Color _tmp246_;
3541
 
                                gint _tmp247_;
3542
 
                                gint base_rank;
3543
 
                                gint _tmp248_;
3544
 
                                gint _tmp249_;
3545
 
                                _tmp246_ = opponent_color;
3546
 
                                if (_tmp246_ == COLOR_WHITE) {
3547
 
                                        _tmp245_ = 0;
 
3394
                        if (_tmp225_) {
 
3395
                                gint _tmp229_ = 0;
 
3396
                                Color _tmp230_ = 0;
 
3397
                                gint base_rank = 0;
 
3398
                                gint _tmp231_ = 0;
 
3399
                                gint _tmp232_ = 0;
 
3400
                                _tmp230_ = opponent_color;
 
3401
                                if (_tmp230_ == COLOR_WHITE) {
 
3402
                                        _tmp229_ = 0;
3548
3403
                                } else {
3549
 
                                        _tmp245_ = 7;
 
3404
                                        _tmp229_ = 7;
3550
3405
                                }
3551
 
                                _tmp247_ = _tmp245_;
3552
 
                                base_rank = _tmp247_;
3553
 
                                _tmp248_ = r1;
3554
 
                                _tmp249_ = base_rank;
3555
 
                                if (_tmp248_ == _tmp249_) {
3556
 
                                        gint _tmp250_;
3557
 
                                        _tmp250_ = f1;
3558
 
                                        if (_tmp250_ == 0) {
3559
 
                                                Color _tmp251_;
3560
 
                                                gboolean _tmp252_;
3561
 
                                                _tmp251_ = opponent_color;
3562
 
                                                self->can_castle_queenside[_tmp251_] = FALSE;
3563
 
                                                _tmp252_ = self->can_castle_queenside[_tmp251_];
 
3406
                                base_rank = _tmp229_;
 
3407
                                _tmp231_ = r1;
 
3408
                                _tmp232_ = base_rank;
 
3409
                                if (_tmp231_ == _tmp232_) {
 
3410
                                        gint _tmp233_ = 0;
 
3411
                                        _tmp233_ = f1;
 
3412
                                        if (_tmp233_ == 0) {
 
3413
                                                Color _tmp234_ = 0;
 
3414
                                                gboolean _tmp235_ = FALSE;
 
3415
                                                _tmp234_ = opponent_color;
 
3416
                                                self->can_castle_queenside[_tmp234_] = FALSE;
 
3417
                                                _tmp235_ = self->can_castle_queenside[_tmp234_];
3564
3418
                                        } else {
3565
 
                                                gint _tmp253_;
3566
 
                                                _tmp253_ = f1;
3567
 
                                                if (_tmp253_ == 7) {
3568
 
                                                        Color _tmp254_;
3569
 
                                                        gboolean _tmp255_;
3570
 
                                                        _tmp254_ = opponent_color;
3571
 
                                                        self->can_castle_kingside[_tmp254_] = FALSE;
3572
 
                                                        _tmp255_ = self->can_castle_kingside[_tmp254_];
 
3419
                                                gint _tmp236_ = 0;
 
3420
                                                _tmp236_ = f1;
 
3421
                                                if (_tmp236_ == 7) {
 
3422
                                                        Color _tmp237_ = 0;
 
3423
                                                        gboolean _tmp238_ = FALSE;
 
3424
                                                        _tmp237_ = opponent_color;
 
3425
                                                        self->can_castle_kingside[_tmp237_] = FALSE;
 
3426
                                                        _tmp238_ = self->can_castle_kingside[_tmp237_];
3573
3427
                                                }
3574
3428
                                        }
3575
3429
                                }
3576
3430
                        }
3577
3431
                }
3578
3432
        }
3579
 
        _tmp257_ = piece;
3580
 
        _tmp258_ = _tmp257_->type;
3581
 
        if (_tmp258_ == PIECE_TYPE_PAWN) {
3582
 
                gint64 _tmp259_;
3583
 
                _tmp259_ = over_mask;
3584
 
                _tmp256_ = _tmp259_ != ((gint64) 0);
 
3433
        _tmp240_ = piece;
 
3434
        _tmp241_ = _tmp240_->type;
 
3435
        if (_tmp241_ == PIECE_TYPE_PAWN) {
 
3436
                gint64 _tmp242_ = 0LL;
 
3437
                _tmp242_ = over_mask;
 
3438
                _tmp239_ = _tmp242_ != ((gint64) 0);
3585
3439
        } else {
3586
 
                _tmp256_ = FALSE;
 
3440
                _tmp239_ = FALSE;
3587
3441
        }
3588
 
        _tmp260_ = _tmp256_;
3589
 
        if (_tmp260_) {
3590
 
                gint _tmp261_;
3591
 
                gint _tmp262_;
3592
 
                gint _tmp263_;
3593
 
                gint _tmp264_ = 0;
3594
 
                _tmp261_ = r0;
3595
 
                _tmp262_ = r1;
3596
 
                _tmp263_ = f0;
3597
 
                _tmp264_ = chess_state_get_index (self, (_tmp261_ + _tmp262_) / 2, _tmp263_);
3598
 
                self->en_passant_index = _tmp264_;
 
3442
        if (_tmp239_) {
 
3443
                gint _tmp243_ = 0;
 
3444
                gint _tmp244_ = 0;
 
3445
                gint _tmp245_ = 0;
 
3446
                gint _tmp246_ = 0;
 
3447
                _tmp243_ = r0;
 
3448
                _tmp244_ = r1;
 
3449
                _tmp245_ = f0;
 
3450
                _tmp246_ = chess_state_get_index (self, (_tmp243_ + _tmp244_) / 2, _tmp245_);
 
3451
                self->en_passant_index = _tmp246_;
3599
3452
        } else {
3600
3453
                self->en_passant_index = -1;
3601
3454
        }
3602
 
        _tmp266_ = piece;
3603
 
        _tmp267_ = _tmp266_->type;
3604
 
        if (_tmp267_ == PIECE_TYPE_PAWN) {
3605
 
                _tmp265_ = TRUE;
 
3455
        _tmp248_ = piece;
 
3456
        _tmp249_ = _tmp248_->type;
 
3457
        if (_tmp249_ == PIECE_TYPE_PAWN) {
 
3458
                _tmp247_ = TRUE;
3606
3459
        } else {
3607
 
                ChessPiece* _tmp268_;
3608
 
                _tmp268_ = victim;
3609
 
                _tmp265_ = _tmp268_ != NULL;
 
3460
                ChessPiece* _tmp250_ = NULL;
 
3461
                _tmp250_ = victim;
 
3462
                _tmp247_ = _tmp250_ != NULL;
3610
3463
        }
3611
 
        _tmp269_ = _tmp265_;
3612
 
        if (_tmp269_) {
 
3464
        if (_tmp247_) {
3613
3465
                self->halfmove_clock = 0;
3614
3466
        } else {
3615
 
                gint _tmp270_;
3616
 
                _tmp270_ = self->halfmove_clock;
3617
 
                self->halfmove_clock = _tmp270_ + 1;
 
3467
                gint _tmp251_ = 0;
 
3468
                _tmp251_ = self->halfmove_clock;
 
3469
                self->halfmove_clock = _tmp251_ + 1;
3618
3470
        }
3619
3471
        _result_ = TRUE;
3620
 
        _tmp272_ = test_check;
3621
 
        if (_tmp272_) {
3622
 
                ChessPlayer* _tmp273_;
3623
 
                gboolean _tmp274_ = FALSE;
3624
 
                _tmp273_ = player;
3625
 
                _tmp274_ = chess_state_is_in_check (self, _tmp273_);
3626
 
                _tmp271_ = _tmp274_;
 
3472
        _tmp253_ = test_check;
 
3473
        if (_tmp253_) {
 
3474
                ChessPlayer* _tmp254_ = NULL;
 
3475
                gboolean _tmp255_ = FALSE;
 
3476
                _tmp254_ = player;
 
3477
                _tmp255_ = chess_state_is_in_check (self, _tmp254_);
 
3478
                _tmp252_ = _tmp255_;
3627
3479
        } else {
3628
 
                _tmp271_ = FALSE;
 
3480
                _tmp252_ = FALSE;
3629
3481
        }
3630
 
        _tmp275_ = _tmp271_;
3631
 
        if (_tmp275_) {
 
3482
        if (_tmp252_) {
3632
3483
                _result_ = FALSE;
3633
3484
        }
3634
 
        _tmp277_ = apply;
3635
 
        if (!_tmp277_) {
3636
 
                _tmp276_ = TRUE;
 
3485
        _tmp257_ = apply;
 
3486
        if (!_tmp257_) {
 
3487
                _tmp256_ = TRUE;
3637
3488
        } else {
3638
 
                gboolean _tmp278_;
3639
 
                _tmp278_ = _result_;
3640
 
                _tmp276_ = !_tmp278_;
 
3489
                gboolean _tmp258_ = FALSE;
 
3490
                _tmp258_ = _result_;
 
3491
                _tmp256_ = !_tmp258_;
3641
3492
        }
3642
 
        _tmp279_ = _tmp276_;
3643
 
        if (_tmp279_) {
3644
 
                gint _tmp280_;
3645
 
                ChessPiece* _tmp281_;
3646
 
                ChessPiece* _tmp282_;
3647
 
                ChessPiece* _tmp283_;
3648
 
                gint _tmp284_;
3649
 
                ChessPiece* _tmp285_;
3650
 
                ChessPiece* _tmp286_;
3651
 
                gint _tmp291_;
3652
 
                gint64 _tmp301_;
3653
 
                gint64 _tmp302_;
3654
 
                gint64 _tmp303_;
3655
 
                gint64 _tmp304_;
3656
 
                gboolean _tmp305_;
3657
 
                gboolean _tmp306_;
3658
 
                gboolean _tmp307_;
3659
 
                gboolean _tmp308_;
3660
 
                gboolean _tmp309_;
3661
 
                gboolean _tmp310_;
3662
 
                gboolean _tmp311_;
3663
 
                gboolean _tmp312_;
3664
 
                gint _tmp313_;
3665
 
                gint _tmp314_;
3666
 
                _tmp280_ = start;
3667
 
                _tmp281_ = piece;
3668
 
                _tmp282_ = _chess_piece_ref0 (_tmp281_);
3669
 
                _chess_piece_unref0 (self->board[_tmp280_]);
3670
 
                self->board[_tmp280_] = _tmp282_;
3671
 
                _tmp283_ = self->board[_tmp280_];
3672
 
                _tmp284_ = end;
3673
 
                _chess_piece_unref0 (self->board[_tmp284_]);
3674
 
                self->board[_tmp284_] = NULL;
3675
 
                _tmp285_ = self->board[_tmp284_];
3676
 
                _tmp286_ = victim;
3677
 
                if (_tmp286_ != NULL) {
3678
 
                        gint _tmp287_;
3679
 
                        ChessPiece* _tmp288_;
3680
 
                        ChessPiece* _tmp289_;
3681
 
                        ChessPiece* _tmp290_;
3682
 
                        _tmp287_ = victim_index;
3683
 
                        _tmp288_ = victim;
3684
 
                        _tmp289_ = _chess_piece_ref0 (_tmp288_);
3685
 
                        _chess_piece_unref0 (self->board[_tmp287_]);
3686
 
                        self->board[_tmp287_] = _tmp289_;
3687
 
                        _tmp290_ = self->board[_tmp287_];
 
3493
        if (_tmp256_) {
 
3494
                gint _tmp259_ = 0;
 
3495
                ChessPiece* _tmp260_ = NULL;
 
3496
                ChessPiece* _tmp261_ = NULL;
 
3497
                ChessPiece* _tmp262_ = NULL;
 
3498
                gint _tmp263_ = 0;
 
3499
                ChessPiece* _tmp264_ = NULL;
 
3500
                ChessPiece* _tmp265_ = NULL;
 
3501
                gint _tmp270_ = 0;
 
3502
                gint64 _tmp280_ = 0LL;
 
3503
                gint64 _tmp281_ = 0LL;
 
3504
                gint64 _tmp282_ = 0LL;
 
3505
                gint64 _tmp283_ = 0LL;
 
3506
                gboolean _tmp284_ = FALSE;
 
3507
                gboolean _tmp285_ = FALSE;
 
3508
                gboolean _tmp286_ = FALSE;
 
3509
                gboolean _tmp287_ = FALSE;
 
3510
                gboolean _tmp288_ = FALSE;
 
3511
                gboolean _tmp289_ = FALSE;
 
3512
                gboolean _tmp290_ = FALSE;
 
3513
                gboolean _tmp291_ = FALSE;
 
3514
                gint _tmp292_ = 0;
 
3515
                gint _tmp293_ = 0;
 
3516
                _tmp259_ = start;
 
3517
                _tmp260_ = piece;
 
3518
                _tmp261_ = _chess_piece_ref0 (_tmp260_);
 
3519
                _chess_piece_unref0 (self->board[_tmp259_]);
 
3520
                self->board[_tmp259_] = _tmp261_;
 
3521
                _tmp262_ = self->board[_tmp259_];
 
3522
                _tmp263_ = end;
 
3523
                _chess_piece_unref0 (self->board[_tmp263_]);
 
3524
                self->board[_tmp263_] = NULL;
 
3525
                _tmp264_ = self->board[_tmp263_];
 
3526
                _tmp265_ = victim;
 
3527
                if (_tmp265_ != NULL) {
 
3528
                        gint _tmp266_ = 0;
 
3529
                        ChessPiece* _tmp267_ = NULL;
 
3530
                        ChessPiece* _tmp268_ = NULL;
 
3531
                        ChessPiece* _tmp269_ = NULL;
 
3532
                        _tmp266_ = victim_index;
 
3533
                        _tmp267_ = victim;
 
3534
                        _tmp268_ = _chess_piece_ref0 (_tmp267_);
 
3535
                        _chess_piece_unref0 (self->board[_tmp266_]);
 
3536
                        self->board[_tmp266_] = _tmp268_;
 
3537
                        _tmp269_ = self->board[_tmp266_];
3688
3538
                }
3689
 
                _tmp291_ = rook_start;
3690
 
                if (_tmp291_ >= 0) {
3691
 
                        gint _tmp292_;
3692
 
                        ChessPiece* _tmp293_;
3693
 
                        ChessPiece* _tmp294_;
3694
 
                        ChessPiece* rook;
3695
 
                        gint _tmp295_;
3696
 
                        ChessPiece* _tmp296_;
3697
 
                        ChessPiece* _tmp297_;
3698
 
                        ChessPiece* _tmp298_;
3699
 
                        gint _tmp299_;
3700
 
                        ChessPiece* _tmp300_;
3701
 
                        _tmp292_ = rook_end;
3702
 
                        _tmp293_ = self->board[_tmp292_];
3703
 
                        _tmp294_ = _chess_piece_ref0 (_tmp293_);
3704
 
                        rook = _tmp294_;
3705
 
                        _tmp295_ = rook_start;
3706
 
                        _tmp296_ = rook;
3707
 
                        _tmp297_ = _chess_piece_ref0 (_tmp296_);
3708
 
                        _chess_piece_unref0 (self->board[_tmp295_]);
3709
 
                        self->board[_tmp295_] = _tmp297_;
3710
 
                        _tmp298_ = self->board[_tmp295_];
3711
 
                        _tmp299_ = rook_end;
3712
 
                        _chess_piece_unref0 (self->board[_tmp299_]);
3713
 
                        self->board[_tmp299_] = NULL;
3714
 
                        _tmp300_ = self->board[_tmp299_];
 
3539
                _tmp270_ = rook_start;
 
3540
                if (_tmp270_ >= 0) {
 
3541
                        ChessPiece* rook = NULL;
 
3542
                        gint _tmp271_ = 0;
 
3543
                        ChessPiece* _tmp272_ = NULL;
 
3544
                        ChessPiece* _tmp273_ = NULL;
 
3545
                        gint _tmp274_ = 0;
 
3546
                        ChessPiece* _tmp275_ = NULL;
 
3547
                        ChessPiece* _tmp276_ = NULL;
 
3548
                        ChessPiece* _tmp277_ = NULL;
 
3549
                        gint _tmp278_ = 0;
 
3550
                        ChessPiece* _tmp279_ = NULL;
 
3551
                        _tmp271_ = rook_end;
 
3552
                        _tmp272_ = self->board[_tmp271_];
 
3553
                        _tmp273_ = _chess_piece_ref0 (_tmp272_);
 
3554
                        rook = _tmp273_;
 
3555
                        _tmp274_ = rook_start;
 
3556
                        _tmp275_ = rook;
 
3557
                        _tmp276_ = _chess_piece_ref0 (_tmp275_);
 
3558
                        _chess_piece_unref0 (self->board[_tmp274_]);
 
3559
                        self->board[_tmp274_] = _tmp276_;
 
3560
                        _tmp277_ = self->board[_tmp274_];
 
3561
                        _tmp278_ = rook_end;
 
3562
                        _chess_piece_unref0 (self->board[_tmp278_]);
 
3563
                        self->board[_tmp278_] = NULL;
 
3564
                        _tmp279_ = self->board[_tmp278_];
3715
3565
                        _chess_piece_unref0 (rook);
3716
3566
                }
3717
 
                _tmp301_ = old_white_mask;
3718
 
                self->priv->piece_masks[COLOR_WHITE] = _tmp301_;
3719
 
                _tmp302_ = self->priv->piece_masks[COLOR_WHITE];
3720
 
                _tmp303_ = old_black_mask;
3721
 
                self->priv->piece_masks[COLOR_BLACK] = _tmp303_;
3722
 
                _tmp304_ = self->priv->piece_masks[COLOR_BLACK];
3723
 
                _tmp305_ = old_white_can_castle_kingside;
3724
 
                self->can_castle_kingside[COLOR_WHITE] = _tmp305_;
3725
 
                _tmp306_ = self->can_castle_kingside[COLOR_WHITE];
3726
 
                _tmp307_ = old_white_can_castle_queenside;
3727
 
                self->can_castle_queenside[COLOR_WHITE] = _tmp307_;
3728
 
                _tmp308_ = self->can_castle_queenside[COLOR_WHITE];
3729
 
                _tmp309_ = old_black_can_castle_kingside;
3730
 
                self->can_castle_kingside[COLOR_BLACK] = _tmp309_;
3731
 
                _tmp310_ = self->can_castle_kingside[COLOR_BLACK];
3732
 
                _tmp311_ = old_black_can_castle_queenside;
3733
 
                self->can_castle_queenside[COLOR_BLACK] = _tmp311_;
3734
 
                _tmp312_ = self->can_castle_queenside[COLOR_BLACK];
3735
 
                _tmp313_ = old_en_passant_index;
3736
 
                self->en_passant_index = _tmp313_;
3737
 
                _tmp314_ = old_halfmove_clock;
3738
 
                self->halfmove_clock = _tmp314_;
 
3567
                _tmp280_ = old_white_mask;
 
3568
                self->priv->piece_masks[COLOR_WHITE] = _tmp280_;
 
3569
                _tmp281_ = self->priv->piece_masks[COLOR_WHITE];
 
3570
                _tmp282_ = old_black_mask;
 
3571
                self->priv->piece_masks[COLOR_BLACK] = _tmp282_;
 
3572
                _tmp283_ = self->priv->piece_masks[COLOR_BLACK];
 
3573
                _tmp284_ = old_white_can_castle_kingside;
 
3574
                self->can_castle_kingside[COLOR_WHITE] = _tmp284_;
 
3575
                _tmp285_ = self->can_castle_kingside[COLOR_WHITE];
 
3576
                _tmp286_ = old_white_can_castle_queenside;
 
3577
                self->can_castle_queenside[COLOR_WHITE] = _tmp286_;
 
3578
                _tmp287_ = self->can_castle_queenside[COLOR_WHITE];
 
3579
                _tmp288_ = old_black_can_castle_kingside;
 
3580
                self->can_castle_kingside[COLOR_BLACK] = _tmp288_;
 
3581
                _tmp289_ = self->can_castle_kingside[COLOR_BLACK];
 
3582
                _tmp290_ = old_black_can_castle_queenside;
 
3583
                self->can_castle_queenside[COLOR_BLACK] = _tmp290_;
 
3584
                _tmp291_ = self->can_castle_queenside[COLOR_BLACK];
 
3585
                _tmp292_ = old_en_passant_index;
 
3586
                self->en_passant_index = _tmp292_;
 
3587
                _tmp293_ = old_halfmove_clock;
 
3588
                self->halfmove_clock = _tmp293_;
3739
3589
                result = _result_;
3740
3590
                _chess_piece_unref0 (victim);
3741
3591
                _chess_piece_unref0 (piece);
3742
3592
                return result;
3743
3593
        }
3744
 
        _tmp316_ = color;
3745
 
        if (_tmp316_ == COLOR_WHITE) {
3746
 
                ChessPlayer* _tmp317_;
3747
 
                _tmp317_ = self->players[COLOR_BLACK];
3748
 
                _tmp315_ = _tmp317_;
 
3594
        _tmp295_ = color;
 
3595
        if (_tmp295_ == COLOR_WHITE) {
 
3596
                ChessPlayer* _tmp296_ = NULL;
 
3597
                _tmp296_ = self->players[COLOR_BLACK];
 
3598
                _tmp294_ = _tmp296_;
3749
3599
        } else {
3750
 
                ChessPlayer* _tmp318_;
3751
 
                _tmp318_ = self->players[COLOR_WHITE];
3752
 
                _tmp315_ = _tmp318_;
 
3600
                ChessPlayer* _tmp297_ = NULL;
 
3601
                _tmp297_ = self->players[COLOR_WHITE];
 
3602
                _tmp294_ = _tmp297_;
3753
3603
        }
3754
 
        _tmp319_ = _tmp315_;
3755
 
        _tmp320_ = _g_object_ref0 (_tmp319_);
 
3604
        _tmp298_ = _g_object_ref0 (_tmp294_);
3756
3605
        _g_object_unref0 (self->current_player);
3757
 
        self->current_player = _tmp320_;
3758
 
        _tmp321_ = self->current_player;
3759
 
        _tmp322_ = chess_state_get_check_state (self, _tmp321_);
3760
 
        self->check_state = _tmp322_;
3761
 
        _tmp323_ = chess_move_new ();
 
3606
        self->current_player = _tmp298_;
 
3607
        _tmp299_ = self->current_player;
 
3608
        _tmp300_ = chess_state_get_check_state (self, _tmp299_);
 
3609
        self->check_state = _tmp300_;
 
3610
        _tmp301_ = chess_move_new ();
3762
3611
        _chess_move_unref0 (self->last_move);
3763
 
        self->last_move = _tmp323_;
 
3612
        self->last_move = _tmp301_;
 
3613
        _tmp302_ = self->last_move;
 
3614
        _tmp303_ = self->number;
 
3615
        _tmp302_->number = _tmp303_;
 
3616
        _tmp304_ = self->last_move;
 
3617
        _tmp305_ = piece;
 
3618
        _tmp306_ = _chess_piece_ref0 (_tmp305_);
 
3619
        _chess_piece_unref0 (_tmp304_->piece);
 
3620
        _tmp304_->piece = _tmp306_;
 
3621
        _tmp307_ = is_promotion;
 
3622
        if (_tmp307_) {
 
3623
                ChessMove* _tmp308_ = NULL;
 
3624
                gint _tmp309_ = 0;
 
3625
                ChessPiece* _tmp310_ = NULL;
 
3626
                ChessPiece* _tmp311_ = NULL;
 
3627
                _tmp308_ = self->last_move;
 
3628
                _tmp309_ = end;
 
3629
                _tmp310_ = self->board[_tmp309_];
 
3630
                _tmp311_ = _chess_piece_ref0 (_tmp310_);
 
3631
                _chess_piece_unref0 (_tmp308_->promotion_piece);
 
3632
                _tmp308_->promotion_piece = _tmp311_;
 
3633
        }
 
3634
        _tmp312_ = self->last_move;
 
3635
        _tmp313_ = victim;
 
3636
        _tmp314_ = _chess_piece_ref0 (_tmp313_);
 
3637
        _chess_piece_unref0 (_tmp312_->victim);
 
3638
        _tmp312_->victim = _tmp314_;
 
3639
        _tmp315_ = rook_end;
 
3640
        if (_tmp315_ >= 0) {
 
3641
                ChessMove* _tmp316_ = NULL;
 
3642
                gint _tmp317_ = 0;
 
3643
                ChessPiece* _tmp318_ = NULL;
 
3644
                ChessPiece* _tmp319_ = NULL;
 
3645
                _tmp316_ = self->last_move;
 
3646
                _tmp317_ = rook_end;
 
3647
                _tmp318_ = self->board[_tmp317_];
 
3648
                _tmp319_ = _chess_piece_ref0 (_tmp318_);
 
3649
                _chess_piece_unref0 (_tmp316_->moved_rook);
 
3650
                _tmp316_->moved_rook = _tmp319_;
 
3651
        }
 
3652
        _tmp320_ = self->last_move;
 
3653
        _tmp321_ = r0;
 
3654
        _tmp320_->r0 = _tmp321_;
 
3655
        _tmp322_ = self->last_move;
 
3656
        _tmp323_ = f0;
 
3657
        _tmp322_->f0 = _tmp323_;
3764
3658
        _tmp324_ = self->last_move;
3765
 
        _tmp325_ = self->number;
3766
 
        _tmp324_->number = _tmp325_;
 
3659
        _tmp325_ = r1;
 
3660
        _tmp324_->r1 = _tmp325_;
3767
3661
        _tmp326_ = self->last_move;
3768
 
        _tmp327_ = piece;
3769
 
        _tmp328_ = _chess_piece_ref0 (_tmp327_);
3770
 
        _chess_piece_unref0 (_tmp326_->piece);
3771
 
        _tmp326_->piece = _tmp328_;
3772
 
        _tmp329_ = is_promotion;
3773
 
        if (_tmp329_) {
3774
 
                ChessMove* _tmp330_;
3775
 
                gint _tmp331_;
3776
 
                ChessPiece* _tmp332_;
3777
 
                ChessPiece* _tmp333_;
3778
 
                _tmp330_ = self->last_move;
3779
 
                _tmp331_ = end;
3780
 
                _tmp332_ = self->board[_tmp331_];
3781
 
                _tmp333_ = _chess_piece_ref0 (_tmp332_);
3782
 
                _chess_piece_unref0 (_tmp330_->promotion_piece);
3783
 
                _tmp330_->promotion_piece = _tmp333_;
3784
 
        }
3785
 
        _tmp334_ = self->last_move;
3786
 
        _tmp335_ = victim;
3787
 
        _tmp336_ = _chess_piece_ref0 (_tmp335_);
3788
 
        _chess_piece_unref0 (_tmp334_->victim);
3789
 
        _tmp334_->victim = _tmp336_;
3790
 
        _tmp337_ = rook_end;
3791
 
        if (_tmp337_ >= 0) {
3792
 
                ChessMove* _tmp338_;
3793
 
                gint _tmp339_;
3794
 
                ChessPiece* _tmp340_;
3795
 
                ChessPiece* _tmp341_;
3796
 
                _tmp338_ = self->last_move;
3797
 
                _tmp339_ = rook_end;
3798
 
                _tmp340_ = self->board[_tmp339_];
3799
 
                _tmp341_ = _chess_piece_ref0 (_tmp340_);
3800
 
                _chess_piece_unref0 (_tmp338_->moved_rook);
3801
 
                _tmp338_->moved_rook = _tmp341_;
3802
 
        }
3803
 
        _tmp342_ = self->last_move;
3804
 
        _tmp343_ = r0;
3805
 
        _tmp342_->r0 = _tmp343_;
3806
 
        _tmp344_ = self->last_move;
3807
 
        _tmp345_ = f0;
3808
 
        _tmp344_->f0 = _tmp345_;
3809
 
        _tmp346_ = self->last_move;
3810
 
        _tmp347_ = r1;
3811
 
        _tmp346_->r1 = _tmp347_;
3812
 
        _tmp348_ = self->last_move;
3813
 
        _tmp349_ = f1;
3814
 
        _tmp348_->f1 = _tmp349_;
3815
 
        _tmp350_ = self->last_move;
3816
 
        _tmp351_ = ambiguous_rank;
3817
 
        _tmp350_->ambiguous_rank = _tmp351_;
3818
 
        _tmp352_ = self->last_move;
3819
 
        _tmp353_ = ambiguous_file;
3820
 
        _tmp352_->ambiguous_file = _tmp353_;
3821
 
        _tmp354_ = self->last_move;
3822
 
        _tmp355_ = self->check_state;
3823
 
        _tmp354_->check_state = _tmp355_;
 
3662
        _tmp327_ = f1;
 
3663
        _tmp326_->f1 = _tmp327_;
 
3664
        _tmp328_ = self->last_move;
 
3665
        _tmp329_ = ambiguous_rank;
 
3666
        _tmp328_->ambiguous_rank = _tmp329_;
 
3667
        _tmp330_ = self->last_move;
 
3668
        _tmp331_ = ambiguous_file;
 
3669
        _tmp330_->ambiguous_file = _tmp331_;
 
3670
        _tmp332_ = self->last_move;
 
3671
        _tmp333_ = self->check_state;
 
3672
        _tmp332_->check_state = _tmp333_;
3824
3673
        result = TRUE;
3825
3674
        _chess_piece_unref0 (victim);
3826
3675
        _chess_piece_unref0 (piece);
3831
3680
ChessResult chess_state_get_result (ChessState* self, ChessRule* rule) {
3832
3681
        ChessRule _vala_rule = 0;
3833
3682
        ChessResult result = 0;
3834
 
        CheckState _tmp0_;
3835
 
        ChessPlayer* _tmp3_;
 
3683
        CheckState _tmp0_ = 0;
 
3684
        ChessPlayer* _tmp3_ = NULL;
3836
3685
        gboolean _tmp4_ = FALSE;
3837
3686
        gboolean _tmp5_ = FALSE;
3838
3687
        gboolean _tmp6_ = FALSE;
3839
 
        ChessMove* _tmp7_;
3840
 
        gboolean _tmp10_;
3841
 
        gboolean _tmp12_;
 
3688
        ChessMove* _tmp7_ = NULL;
3842
3689
        g_return_val_if_fail (self != NULL, 0);
3843
3690
        _vala_rule = CHESS_RULE_CHECKMATE;
3844
3691
        _tmp0_ = self->check_state;
3845
3692
        if (_tmp0_ == CHECK_STATE_CHECKMATE) {
3846
 
                ChessPlayer* _tmp1_;
3847
 
                Color _tmp2_;
 
3693
                ChessPlayer* _tmp1_ = NULL;
 
3694
                Color _tmp2_ = 0;
3848
3695
                _tmp1_ = self->current_player;
3849
3696
                _tmp2_ = _tmp1_->color;
3850
3697
                if (_tmp2_ == COLOR_WHITE) {
3875
3722
        }
3876
3723
        _tmp7_ = self->last_move;
3877
3724
        if (_tmp7_ != NULL) {
3878
 
                ChessMove* _tmp8_;
3879
 
                ChessPiece* _tmp9_;
 
3725
                ChessMove* _tmp8_ = NULL;
 
3726
                ChessPiece* _tmp9_ = NULL;
3880
3727
                _tmp8_ = self->last_move;
3881
3728
                _tmp9_ = _tmp8_->victim;
3882
3729
                _tmp6_ = _tmp9_ != NULL;
3883
3730
        } else {
3884
3731
                _tmp6_ = FALSE;
3885
3732
        }
3886
 
        _tmp10_ = _tmp6_;
3887
 
        if (_tmp10_) {
3888
 
                gboolean _tmp11_ = FALSE;
3889
 
                _tmp11_ = chess_state_have_sufficient_material (self);
3890
 
                _tmp5_ = !_tmp11_;
 
3733
        if (_tmp6_) {
 
3734
                gboolean _tmp10_ = FALSE;
 
3735
                _tmp10_ = chess_state_have_sufficient_material (self);
 
3736
                _tmp5_ = !_tmp10_;
3891
3737
        } else {
3892
3738
                _tmp5_ = FALSE;
3893
3739
        }
3894
 
        _tmp12_ = _tmp5_;
3895
 
        if (_tmp12_) {
 
3740
        if (_tmp5_) {
3896
3741
                _vala_rule = CHESS_RULE_INSUFFICIENT_MATERIAL;
3897
3742
                result = CHESS_RESULT_DRAW;
3898
3743
                if (rule) {
3910
3755
 
3911
3756
static CheckState chess_state_get_check_state (ChessState* self, ChessPlayer* player) {
3912
3757
        CheckState result = 0;
3913
 
        ChessPlayer* _tmp0_;
 
3758
        ChessPlayer* _tmp0_ = NULL;
3914
3759
        gboolean _tmp1_ = FALSE;
3915
3760
        g_return_val_if_fail (self != NULL, 0);
3916
3761
        g_return_val_if_fail (player != NULL, 0);
3917
3762
        _tmp0_ = player;
3918
3763
        _tmp1_ = chess_state_is_in_check (self, _tmp0_);
3919
3764
        if (_tmp1_) {
3920
 
                ChessPlayer* _tmp2_;
 
3765
                ChessPlayer* _tmp2_ = NULL;
3921
3766
                gboolean _tmp3_ = FALSE;
3922
3767
                _tmp2_ = player;
3923
3768
                _tmp3_ = chess_state_is_in_checkmate (self, _tmp2_);
3934
3779
}
3935
3780
 
3936
3781
 
3937
 
static gboolean chess_state_is_in_check (ChessState* self, ChessPlayer* player) {
 
3782
gboolean chess_state_is_in_check (ChessState* self, ChessPlayer* player) {
3938
3783
        gboolean result = FALSE;
3939
3784
        ChessPlayer* _tmp0_ = NULL;
3940
 
        ChessPlayer* _tmp1_;
3941
 
        Color _tmp2_;
3942
 
        ChessPlayer* _tmp5_;
3943
 
        ChessPlayer* _tmp6_;
3944
 
        ChessPlayer* opponent;
 
3785
        ChessPlayer* _tmp1_ = NULL;
 
3786
        Color _tmp2_ = 0;
 
3787
        ChessPlayer* opponent = NULL;
 
3788
        ChessPlayer* _tmp5_ = NULL;
3945
3789
        g_return_val_if_fail (self != NULL, FALSE);
3946
3790
        g_return_val_if_fail (player != NULL, FALSE);
3947
3791
        _tmp1_ = player;
3948
3792
        _tmp2_ = _tmp1_->color;
3949
3793
        if (_tmp2_ == COLOR_WHITE) {
3950
 
                ChessPlayer* _tmp3_;
 
3794
                ChessPlayer* _tmp3_ = NULL;
3951
3795
                _tmp3_ = self->players[COLOR_BLACK];
3952
3796
                _tmp0_ = _tmp3_;
3953
3797
        } else {
3954
 
                ChessPlayer* _tmp4_;
 
3798
                ChessPlayer* _tmp4_ = NULL;
3955
3799
                _tmp4_ = self->players[COLOR_WHITE];
3956
3800
                _tmp0_ = _tmp4_;
3957
3801
        }
3958
 
        _tmp5_ = _tmp0_;
3959
 
        _tmp6_ = _g_object_ref0 (_tmp5_);
3960
 
        opponent = _tmp6_;
 
3802
        _tmp5_ = _g_object_ref0 (_tmp0_);
 
3803
        opponent = _tmp5_;
3961
3804
        {
3962
 
                gint king_index;
 
3805
                gint king_index = 0;
3963
3806
                king_index = 0;
3964
3807
                {
3965
 
                        gboolean _tmp7_;
3966
 
                        _tmp7_ = TRUE;
 
3808
                        gboolean _tmp6_ = FALSE;
 
3809
                        _tmp6_ = TRUE;
3967
3810
                        while (TRUE) {
3968
 
                                gboolean _tmp8_;
3969
 
                                gint _tmp10_;
3970
 
                                gint _tmp11_;
3971
 
                                ChessPiece* _tmp12_;
3972
 
                                ChessPiece* _tmp13_;
3973
 
                                ChessPiece* p;
3974
 
                                gboolean _tmp14_ = FALSE;
3975
 
                                gboolean _tmp15_ = FALSE;
3976
 
                                ChessPiece* _tmp16_;
3977
 
                                gboolean _tmp20_;
3978
 
                                gboolean _tmp23_;
3979
 
                                _tmp8_ = _tmp7_;
3980
 
                                if (!_tmp8_) {
3981
 
                                        gint _tmp9_;
3982
 
                                        _tmp9_ = king_index;
3983
 
                                        king_index = _tmp9_ + 1;
 
3811
                                gint _tmp8_ = 0;
 
3812
                                ChessPiece* p = NULL;
 
3813
                                gint _tmp9_ = 0;
 
3814
                                ChessPiece* _tmp10_ = NULL;
 
3815
                                ChessPiece* _tmp11_ = NULL;
 
3816
                                gboolean _tmp12_ = FALSE;
 
3817
                                gboolean _tmp13_ = FALSE;
 
3818
                                ChessPiece* _tmp14_ = NULL;
 
3819
                                if (!_tmp6_) {
 
3820
                                        gint _tmp7_ = 0;
 
3821
                                        _tmp7_ = king_index;
 
3822
                                        king_index = _tmp7_ + 1;
3984
3823
                                }
3985
 
                                _tmp7_ = FALSE;
3986
 
                                _tmp10_ = king_index;
3987
 
                                if (!(_tmp10_ < 64)) {
 
3824
                                _tmp6_ = FALSE;
 
3825
                                _tmp8_ = king_index;
 
3826
                                if (!(_tmp8_ < 64)) {
3988
3827
                                        break;
3989
3828
                                }
3990
 
                                _tmp11_ = king_index;
3991
 
                                _tmp12_ = self->board[_tmp11_];
3992
 
                                _tmp13_ = _chess_piece_ref0 (_tmp12_);
3993
 
                                p = _tmp13_;
3994
 
                                _tmp16_ = p;
3995
 
                                if (_tmp16_ != NULL) {
3996
 
                                        ChessPiece* _tmp17_;
3997
 
                                        ChessPlayer* _tmp18_;
3998
 
                                        ChessPlayer* _tmp19_;
3999
 
                                        _tmp17_ = p;
4000
 
                                        _tmp18_ = _tmp17_->player;
4001
 
                                        _tmp19_ = player;
4002
 
                                        _tmp15_ = _tmp18_ == _tmp19_;
4003
 
                                } else {
4004
 
                                        _tmp15_ = FALSE;
4005
 
                                }
4006
 
                                _tmp20_ = _tmp15_;
4007
 
                                if (_tmp20_) {
4008
 
                                        ChessPiece* _tmp21_;
4009
 
                                        PieceType _tmp22_;
4010
 
                                        _tmp21_ = p;
4011
 
                                        _tmp22_ = _tmp21_->type;
4012
 
                                        _tmp14_ = _tmp22_ == PIECE_TYPE_KING;
4013
 
                                } else {
4014
 
                                        _tmp14_ = FALSE;
4015
 
                                }
4016
 
                                _tmp23_ = _tmp14_;
4017
 
                                if (_tmp23_) {
 
3829
                                _tmp9_ = king_index;
 
3830
                                _tmp10_ = self->board[_tmp9_];
 
3831
                                _tmp11_ = _chess_piece_ref0 (_tmp10_);
 
3832
                                p = _tmp11_;
 
3833
                                _tmp14_ = p;
 
3834
                                if (_tmp14_ != NULL) {
 
3835
                                        ChessPiece* _tmp15_ = NULL;
 
3836
                                        ChessPlayer* _tmp16_ = NULL;
 
3837
                                        ChessPlayer* _tmp17_ = NULL;
 
3838
                                        _tmp15_ = p;
 
3839
                                        _tmp16_ = _tmp15_->player;
 
3840
                                        _tmp17_ = player;
 
3841
                                        _tmp13_ = _tmp16_ == _tmp17_;
 
3842
                                } else {
 
3843
                                        _tmp13_ = FALSE;
 
3844
                                }
 
3845
                                if (_tmp13_) {
 
3846
                                        ChessPiece* _tmp18_ = NULL;
 
3847
                                        PieceType _tmp19_ = 0;
 
3848
                                        _tmp18_ = p;
 
3849
                                        _tmp19_ = _tmp18_->type;
 
3850
                                        _tmp12_ = _tmp19_ == PIECE_TYPE_KING;
 
3851
                                } else {
 
3852
                                        _tmp12_ = FALSE;
 
3853
                                }
 
3854
                                if (_tmp12_) {
4018
3855
                                        {
4019
 
                                                gint start;
 
3856
                                                gint start = 0;
4020
3857
                                                start = 0;
4021
3858
                                                {
4022
 
                                                        gboolean _tmp24_;
4023
 
                                                        _tmp24_ = TRUE;
 
3859
                                                        gboolean _tmp20_ = FALSE;
 
3860
                                                        _tmp20_ = TRUE;
4024
3861
                                                        while (TRUE) {
4025
 
                                                                gboolean _tmp25_;
4026
 
                                                                gint _tmp27_;
4027
 
                                                                ChessPlayer* _tmp28_;
4028
 
                                                                gint _tmp29_;
 
3862
                                                                gint _tmp22_ = 0;
 
3863
                                                                ChessPlayer* _tmp23_ = NULL;
 
3864
                                                                gint _tmp24_ = 0;
 
3865
                                                                gint _tmp25_ = 0;
 
3866
                                                                gint _tmp26_ = 0;
 
3867
                                                                gint _tmp27_ = 0;
 
3868
                                                                gint _tmp28_ = 0;
 
3869
                                                                gint _tmp29_ = 0;
4029
3870
                                                                gint _tmp30_ = 0;
4030
 
                                                                gint _tmp31_;
4031
 
                                                                gint _tmp32_ = 0;
4032
 
                                                                gint _tmp33_;
4033
 
                                                                gint _tmp34_ = 0;
4034
 
                                                                gint _tmp35_;
4035
 
                                                                gint _tmp36_ = 0;
4036
 
                                                                gboolean _tmp37_ = FALSE;
4037
 
                                                                _tmp25_ = _tmp24_;
4038
 
                                                                if (!_tmp25_) {
4039
 
                                                                        gint _tmp26_;
4040
 
                                                                        _tmp26_ = start;
4041
 
                                                                        start = _tmp26_ + 1;
 
3871
                                                                gint _tmp31_ = 0;
 
3872
                                                                gboolean _tmp32_ = FALSE;
 
3873
                                                                if (!_tmp20_) {
 
3874
                                                                        gint _tmp21_ = 0;
 
3875
                                                                        _tmp21_ = start;
 
3876
                                                                        start = _tmp21_ + 1;
4042
3877
                                                                }
4043
 
                                                                _tmp24_ = FALSE;
4044
 
                                                                _tmp27_ = start;
4045
 
                                                                if (!(_tmp27_ < 64)) {
 
3878
                                                                _tmp20_ = FALSE;
 
3879
                                                                _tmp22_ = start;
 
3880
                                                                if (!(_tmp22_ < 64)) {
4046
3881
                                                                        break;
4047
3882
                                                                }
4048
 
                                                                _tmp28_ = opponent;
4049
 
                                                                _tmp29_ = start;
4050
 
                                                                _tmp30_ = chess_state_get_rank (self, _tmp29_);
4051
 
                                                                _tmp31_ = start;
4052
 
                                                                _tmp32_ = chess_state_get_file (self, _tmp31_);
4053
 
                                                                _tmp33_ = king_index;
4054
 
                                                                _tmp34_ = chess_state_get_rank (self, _tmp33_);
4055
 
                                                                _tmp35_ = king_index;
4056
 
                                                                _tmp36_ = chess_state_get_file (self, _tmp35_);
4057
 
                                                                _tmp37_ = chess_state_move_with_coords (self, _tmp28_, _tmp30_, _tmp32_, _tmp34_, _tmp36_, PIECE_TYPE_QUEEN, FALSE, FALSE);
4058
 
                                                                if (_tmp37_) {
 
3883
                                                                _tmp23_ = opponent;
 
3884
                                                                _tmp24_ = start;
 
3885
                                                                _tmp25_ = chess_state_get_rank (self, _tmp24_);
 
3886
                                                                _tmp26_ = start;
 
3887
                                                                _tmp27_ = chess_state_get_file (self, _tmp26_);
 
3888
                                                                _tmp28_ = king_index;
 
3889
                                                                _tmp29_ = chess_state_get_rank (self, _tmp28_);
 
3890
                                                                _tmp30_ = king_index;
 
3891
                                                                _tmp31_ = chess_state_get_file (self, _tmp30_);
 
3892
                                                                _tmp32_ = chess_state_move_with_coords (self, _tmp23_, _tmp25_, _tmp27_, _tmp29_, _tmp31_, PIECE_TYPE_QUEEN, FALSE, FALSE);
 
3893
                                                                if (_tmp32_) {
4059
3894
                                                                        result = TRUE;
4060
3895
                                                                        _chess_piece_unref0 (p);
4061
3896
                                                                        _g_object_unref0 (opponent);
4080
3915
        g_return_val_if_fail (self != NULL, FALSE);
4081
3916
        g_return_val_if_fail (player != NULL, FALSE);
4082
3917
        {
4083
 
                gint piece_index;
 
3918
                gint piece_index = 0;
4084
3919
                piece_index = 0;
4085
3920
                {
4086
 
                        gboolean _tmp0_;
 
3921
                        gboolean _tmp0_ = FALSE;
4087
3922
                        _tmp0_ = TRUE;
4088
3923
                        while (TRUE) {
4089
 
                                gboolean _tmp1_;
4090
 
                                gint _tmp3_;
4091
 
                                gint _tmp4_;
4092
 
                                ChessPiece* _tmp5_;
4093
 
                                ChessPiece* _tmp6_;
4094
 
                                ChessPiece* p;
4095
 
                                gboolean _tmp7_ = FALSE;
4096
 
                                ChessPiece* _tmp8_;
4097
 
                                gboolean _tmp12_;
4098
 
                                _tmp1_ = _tmp0_;
4099
 
                                if (!_tmp1_) {
4100
 
                                        gint _tmp2_;
4101
 
                                        _tmp2_ = piece_index;
4102
 
                                        piece_index = _tmp2_ + 1;
 
3924
                                gint _tmp2_ = 0;
 
3925
                                ChessPiece* p = NULL;
 
3926
                                gint _tmp3_ = 0;
 
3927
                                ChessPiece* _tmp4_ = NULL;
 
3928
                                ChessPiece* _tmp5_ = NULL;
 
3929
                                gboolean _tmp6_ = FALSE;
 
3930
                                ChessPiece* _tmp7_ = NULL;
 
3931
                                if (!_tmp0_) {
 
3932
                                        gint _tmp1_ = 0;
 
3933
                                        _tmp1_ = piece_index;
 
3934
                                        piece_index = _tmp1_ + 1;
4103
3935
                                }
4104
3936
                                _tmp0_ = FALSE;
 
3937
                                _tmp2_ = piece_index;
 
3938
                                if (!(_tmp2_ < 64)) {
 
3939
                                        break;
 
3940
                                }
4105
3941
                                _tmp3_ = piece_index;
4106
 
                                if (!(_tmp3_ < 64)) {
4107
 
                                        break;
4108
 
                                }
4109
 
                                _tmp4_ = piece_index;
4110
 
                                _tmp5_ = self->board[_tmp4_];
4111
 
                                _tmp6_ = _chess_piece_ref0 (_tmp5_);
4112
 
                                p = _tmp6_;
4113
 
                                _tmp8_ = p;
4114
 
                                if (_tmp8_ != NULL) {
4115
 
                                        ChessPiece* _tmp9_;
4116
 
                                        ChessPlayer* _tmp10_;
4117
 
                                        ChessPlayer* _tmp11_;
4118
 
                                        _tmp9_ = p;
4119
 
                                        _tmp10_ = _tmp9_->player;
4120
 
                                        _tmp11_ = player;
4121
 
                                        _tmp7_ = _tmp10_ == _tmp11_;
 
3942
                                _tmp4_ = self->board[_tmp3_];
 
3943
                                _tmp5_ = _chess_piece_ref0 (_tmp4_);
 
3944
                                p = _tmp5_;
 
3945
                                _tmp7_ = p;
 
3946
                                if (_tmp7_ != NULL) {
 
3947
                                        ChessPiece* _tmp8_ = NULL;
 
3948
                                        ChessPlayer* _tmp9_ = NULL;
 
3949
                                        ChessPlayer* _tmp10_ = NULL;
 
3950
                                        _tmp8_ = p;
 
3951
                                        _tmp9_ = _tmp8_->player;
 
3952
                                        _tmp10_ = player;
 
3953
                                        _tmp6_ = _tmp9_ == _tmp10_;
4122
3954
                                } else {
4123
 
                                        _tmp7_ = FALSE;
 
3955
                                        _tmp6_ = FALSE;
4124
3956
                                }
4125
 
                                _tmp12_ = _tmp7_;
4126
 
                                if (_tmp12_) {
 
3957
                                if (_tmp6_) {
4127
3958
                                        {
4128
 
                                                gint end;
 
3959
                                                gint end = 0;
4129
3960
                                                end = 0;
4130
3961
                                                {
4131
 
                                                        gboolean _tmp13_;
4132
 
                                                        _tmp13_ = TRUE;
 
3962
                                                        gboolean _tmp11_ = FALSE;
 
3963
                                                        _tmp11_ = TRUE;
4133
3964
                                                        while (TRUE) {
4134
 
                                                                gboolean _tmp14_;
4135
 
                                                                gint _tmp16_;
4136
 
                                                                ChessPlayer* _tmp17_;
4137
 
                                                                gint _tmp18_;
 
3965
                                                                gint _tmp13_ = 0;
 
3966
                                                                ChessPlayer* _tmp14_ = NULL;
 
3967
                                                                gint _tmp15_ = 0;
 
3968
                                                                gint _tmp16_ = 0;
 
3969
                                                                gint _tmp17_ = 0;
 
3970
                                                                gint _tmp18_ = 0;
4138
3971
                                                                gint _tmp19_ = 0;
4139
 
                                                                gint _tmp20_;
 
3972
                                                                gint _tmp20_ = 0;
4140
3973
                                                                gint _tmp21_ = 0;
4141
 
                                                                gint _tmp22_;
4142
 
                                                                gint _tmp23_ = 0;
4143
 
                                                                gint _tmp24_;
4144
 
                                                                gint _tmp25_ = 0;
4145
 
                                                                gboolean _tmp26_ = FALSE;
4146
 
                                                                _tmp14_ = _tmp13_;
4147
 
                                                                if (!_tmp14_) {
4148
 
                                                                        gint _tmp15_;
4149
 
                                                                        _tmp15_ = end;
4150
 
                                                                        end = _tmp15_ + 1;
 
3974
                                                                gint _tmp22_ = 0;
 
3975
                                                                gboolean _tmp23_ = FALSE;
 
3976
                                                                if (!_tmp11_) {
 
3977
                                                                        gint _tmp12_ = 0;
 
3978
                                                                        _tmp12_ = end;
 
3979
                                                                        end = _tmp12_ + 1;
4151
3980
                                                                }
4152
 
                                                                _tmp13_ = FALSE;
4153
 
                                                                _tmp16_ = end;
4154
 
                                                                if (!(_tmp16_ < 64)) {
 
3981
                                                                _tmp11_ = FALSE;
 
3982
                                                                _tmp13_ = end;
 
3983
                                                                if (!(_tmp13_ < 64)) {
4155
3984
                                                                        break;
4156
3985
                                                                }
4157
 
                                                                _tmp17_ = player;
4158
 
                                                                _tmp18_ = piece_index;
4159
 
                                                                _tmp19_ = chess_state_get_rank (self, _tmp18_);
4160
 
                                                                _tmp20_ = piece_index;
4161
 
                                                                _tmp21_ = chess_state_get_file (self, _tmp20_);
4162
 
                                                                _tmp22_ = end;
4163
 
                                                                _tmp23_ = chess_state_get_rank (self, _tmp22_);
4164
 
                                                                _tmp24_ = end;
4165
 
                                                                _tmp25_ = chess_state_get_file (self, _tmp24_);
4166
 
                                                                _tmp26_ = chess_state_move_with_coords (self, _tmp17_, _tmp19_, _tmp21_, _tmp23_, _tmp25_, PIECE_TYPE_QUEEN, FALSE, TRUE);
4167
 
                                                                if (_tmp26_) {
 
3986
                                                                _tmp14_ = player;
 
3987
                                                                _tmp15_ = piece_index;
 
3988
                                                                _tmp16_ = chess_state_get_rank (self, _tmp15_);
 
3989
                                                                _tmp17_ = piece_index;
 
3990
                                                                _tmp18_ = chess_state_get_file (self, _tmp17_);
 
3991
                                                                _tmp19_ = end;
 
3992
                                                                _tmp20_ = chess_state_get_rank (self, _tmp19_);
 
3993
                                                                _tmp21_ = end;
 
3994
                                                                _tmp22_ = chess_state_get_file (self, _tmp21_);
 
3995
                                                                _tmp23_ = chess_state_move_with_coords (self, _tmp14_, _tmp16_, _tmp18_, _tmp20_, _tmp22_, PIECE_TYPE_QUEEN, FALSE, TRUE);
 
3996
                                                                if (_tmp23_) {
4168
3997
                                                                        result = FALSE;
4169
3998
                                                                        _chess_piece_unref0 (p);
4170
3999
                                                                        return result;
4184
4013
 
4185
4014
static gboolean chess_state_can_move (ChessState* self, ChessPlayer* player) {
4186
4015
        gboolean result = FALSE;
4187
 
        gboolean have_pieces;
4188
 
        gboolean _tmp27_;
 
4016
        gboolean have_pieces = FALSE;
 
4017
        gboolean _tmp24_ = FALSE;
4189
4018
        g_return_val_if_fail (self != NULL, FALSE);
4190
4019
        g_return_val_if_fail (player != NULL, FALSE);
4191
4020
        have_pieces = FALSE;
4192
4021
        {
4193
 
                gint start;
 
4022
                gint start = 0;
4194
4023
                start = 0;
4195
4024
                {
4196
 
                        gboolean _tmp0_;
 
4025
                        gboolean _tmp0_ = FALSE;
4197
4026
                        _tmp0_ = TRUE;
4198
4027
                        while (TRUE) {
4199
 
                                gboolean _tmp1_;
4200
 
                                gint _tmp3_;
4201
 
                                gint _tmp4_;
4202
 
                                ChessPiece* _tmp5_;
4203
 
                                ChessPiece* _tmp6_;
4204
 
                                ChessPiece* p;
4205
 
                                gboolean _tmp7_ = FALSE;
4206
 
                                ChessPiece* _tmp8_;
4207
 
                                gboolean _tmp12_;
4208
 
                                _tmp1_ = _tmp0_;
4209
 
                                if (!_tmp1_) {
4210
 
                                        gint _tmp2_;
4211
 
                                        _tmp2_ = start;
4212
 
                                        start = _tmp2_ + 1;
 
4028
                                gint _tmp2_ = 0;
 
4029
                                ChessPiece* p = NULL;
 
4030
                                gint _tmp3_ = 0;
 
4031
                                ChessPiece* _tmp4_ = NULL;
 
4032
                                ChessPiece* _tmp5_ = NULL;
 
4033
                                gboolean _tmp6_ = FALSE;
 
4034
                                ChessPiece* _tmp7_ = NULL;
 
4035
                                if (!_tmp0_) {
 
4036
                                        gint _tmp1_ = 0;
 
4037
                                        _tmp1_ = start;
 
4038
                                        start = _tmp1_ + 1;
4213
4039
                                }
4214
4040
                                _tmp0_ = FALSE;
 
4041
                                _tmp2_ = start;
 
4042
                                if (!(_tmp2_ < 64)) {
 
4043
                                        break;
 
4044
                                }
4215
4045
                                _tmp3_ = start;
4216
 
                                if (!(_tmp3_ < 64)) {
4217
 
                                        break;
4218
 
                                }
4219
 
                                _tmp4_ = start;
4220
 
                                _tmp5_ = self->board[_tmp4_];
4221
 
                                _tmp6_ = _chess_piece_ref0 (_tmp5_);
4222
 
                                p = _tmp6_;
4223
 
                                _tmp8_ = p;
4224
 
                                if (_tmp8_ != NULL) {
4225
 
                                        ChessPiece* _tmp9_;
4226
 
                                        ChessPlayer* _tmp10_;
4227
 
                                        ChessPlayer* _tmp11_;
4228
 
                                        _tmp9_ = p;
4229
 
                                        _tmp10_ = _tmp9_->player;
4230
 
                                        _tmp11_ = player;
4231
 
                                        _tmp7_ = _tmp10_ == _tmp11_;
 
4046
                                _tmp4_ = self->board[_tmp3_];
 
4047
                                _tmp5_ = _chess_piece_ref0 (_tmp4_);
 
4048
                                p = _tmp5_;
 
4049
                                _tmp7_ = p;
 
4050
                                if (_tmp7_ != NULL) {
 
4051
                                        ChessPiece* _tmp8_ = NULL;
 
4052
                                        ChessPlayer* _tmp9_ = NULL;
 
4053
                                        ChessPlayer* _tmp10_ = NULL;
 
4054
                                        _tmp8_ = p;
 
4055
                                        _tmp9_ = _tmp8_->player;
 
4056
                                        _tmp10_ = player;
 
4057
                                        _tmp6_ = _tmp9_ == _tmp10_;
4232
4058
                                } else {
4233
 
                                        _tmp7_ = FALSE;
 
4059
                                        _tmp6_ = FALSE;
4234
4060
                                }
4235
 
                                _tmp12_ = _tmp7_;
4236
 
                                if (_tmp12_) {
 
4061
                                if (_tmp6_) {
4237
4062
                                        have_pieces = TRUE;
4238
4063
                                        {
4239
 
                                                gint end;
 
4064
                                                gint end = 0;
4240
4065
                                                end = 0;
4241
4066
                                                {
4242
 
                                                        gboolean _tmp13_;
4243
 
                                                        _tmp13_ = TRUE;
 
4067
                                                        gboolean _tmp11_ = FALSE;
 
4068
                                                        _tmp11_ = TRUE;
4244
4069
                                                        while (TRUE) {
4245
 
                                                                gboolean _tmp14_;
4246
 
                                                                gint _tmp16_;
4247
 
                                                                ChessPlayer* _tmp17_;
4248
 
                                                                gint _tmp18_;
 
4070
                                                                gint _tmp13_ = 0;
 
4071
                                                                ChessPlayer* _tmp14_ = NULL;
 
4072
                                                                gint _tmp15_ = 0;
 
4073
                                                                gint _tmp16_ = 0;
 
4074
                                                                gint _tmp17_ = 0;
 
4075
                                                                gint _tmp18_ = 0;
4249
4076
                                                                gint _tmp19_ = 0;
4250
 
                                                                gint _tmp20_;
 
4077
                                                                gint _tmp20_ = 0;
4251
4078
                                                                gint _tmp21_ = 0;
4252
 
                                                                gint _tmp22_;
4253
 
                                                                gint _tmp23_ = 0;
4254
 
                                                                gint _tmp24_;
4255
 
                                                                gint _tmp25_ = 0;
4256
 
                                                                gboolean _tmp26_ = FALSE;
4257
 
                                                                _tmp14_ = _tmp13_;
4258
 
                                                                if (!_tmp14_) {
4259
 
                                                                        gint _tmp15_;
4260
 
                                                                        _tmp15_ = end;
4261
 
                                                                        end = _tmp15_ + 1;
 
4079
                                                                gint _tmp22_ = 0;
 
4080
                                                                gboolean _tmp23_ = FALSE;
 
4081
                                                                if (!_tmp11_) {
 
4082
                                                                        gint _tmp12_ = 0;
 
4083
                                                                        _tmp12_ = end;
 
4084
                                                                        end = _tmp12_ + 1;
4262
4085
                                                                }
4263
 
                                                                _tmp13_ = FALSE;
4264
 
                                                                _tmp16_ = end;
4265
 
                                                                if (!(_tmp16_ < 64)) {
 
4086
                                                                _tmp11_ = FALSE;
 
4087
                                                                _tmp13_ = end;
 
4088
                                                                if (!(_tmp13_ < 64)) {
4266
4089
                                                                        break;
4267
4090
                                                                }
4268
 
                                                                _tmp17_ = player;
4269
 
                                                                _tmp18_ = start;
4270
 
                                                                _tmp19_ = chess_state_get_rank (self, _tmp18_);
4271
 
                                                                _tmp20_ = start;
4272
 
                                                                _tmp21_ = chess_state_get_file (self, _tmp20_);
4273
 
                                                                _tmp22_ = end;
4274
 
                                                                _tmp23_ = chess_state_get_rank (self, _tmp22_);
4275
 
                                                                _tmp24_ = end;
4276
 
                                                                _tmp25_ = chess_state_get_file (self, _tmp24_);
4277
 
                                                                _tmp26_ = chess_state_move_with_coords (self, _tmp17_, _tmp19_, _tmp21_, _tmp23_, _tmp25_, PIECE_TYPE_QUEEN, FALSE, TRUE);
4278
 
                                                                if (_tmp26_) {
 
4091
                                                                _tmp14_ = player;
 
4092
                                                                _tmp15_ = start;
 
4093
                                                                _tmp16_ = chess_state_get_rank (self, _tmp15_);
 
4094
                                                                _tmp17_ = start;
 
4095
                                                                _tmp18_ = chess_state_get_file (self, _tmp17_);
 
4096
                                                                _tmp19_ = end;
 
4097
                                                                _tmp20_ = chess_state_get_rank (self, _tmp19_);
 
4098
                                                                _tmp21_ = end;
 
4099
                                                                _tmp22_ = chess_state_get_file (self, _tmp21_);
 
4100
                                                                _tmp23_ = chess_state_move_with_coords (self, _tmp14_, _tmp16_, _tmp18_, _tmp20_, _tmp22_, PIECE_TYPE_QUEEN, FALSE, TRUE);
 
4101
                                                                if (_tmp23_) {
4279
4102
                                                                        result = TRUE;
4280
4103
                                                                        _chess_piece_unref0 (p);
4281
4104
                                                                        return result;
4288
4111
                        }
4289
4112
                }
4290
4113
        }
4291
 
        _tmp27_ = have_pieces;
4292
 
        if (_tmp27_) {
 
4114
        _tmp24_ = have_pieces;
 
4115
        if (_tmp24_) {
4293
4116
                result = FALSE;
4294
4117
                return result;
4295
4118
        } else {
4301
4124
 
4302
4125
gboolean chess_state_have_sufficient_material (ChessState* self) {
4303
4126
        gboolean result = FALSE;
4304
 
        gint white_knight_count;
4305
 
        gint white_bishop_count;
4306
 
        gboolean white_bishop_on_white_square;
4307
 
        gboolean white_bishop_on_black_square;
4308
 
        gint black_knight_count;
4309
 
        gint black_bishop_count;
4310
 
        gboolean black_bishop_on_white_square;
4311
 
        gboolean black_bishop_on_black_square;
 
4127
        gint white_knight_count = 0;
 
4128
        gint white_bishop_count = 0;
 
4129
        gboolean white_bishop_on_white_square = FALSE;
 
4130
        gboolean white_bishop_on_black_square = FALSE;
 
4131
        gint black_knight_count = 0;
 
4132
        gint black_bishop_count = 0;
 
4133
        gboolean black_bishop_on_white_square = FALSE;
 
4134
        gboolean black_bishop_on_black_square = FALSE;
4312
4135
        g_return_val_if_fail (self != NULL, FALSE);
4313
4136
        white_knight_count = 0;
4314
4137
        white_bishop_count = 0;
4319
4142
        black_bishop_on_white_square = FALSE;
4320
4143
        black_bishop_on_black_square = FALSE;
4321
4144
        {
4322
 
                gint i;
 
4145
                gint i = 0;
4323
4146
                i = 0;
4324
4147
                {
4325
 
                        gboolean _tmp0_;
 
4148
                        gboolean _tmp0_ = FALSE;
4326
4149
                        _tmp0_ = TRUE;
4327
4150
                        while (TRUE) {
4328
 
                                gboolean _tmp1_;
4329
 
                                gint _tmp3_;
4330
 
                                gint _tmp4_;
4331
 
                                ChessPiece* _tmp5_;
4332
 
                                ChessPiece* _tmp6_;
4333
 
                                ChessPiece* p;
4334
 
                                ChessPiece* _tmp7_;
 
4151
                                gint _tmp2_ = 0;
 
4152
                                ChessPiece* p = NULL;
 
4153
                                gint _tmp3_ = 0;
 
4154
                                ChessPiece* _tmp4_ = NULL;
 
4155
                                ChessPiece* _tmp5_ = NULL;
 
4156
                                ChessPiece* _tmp6_ = NULL;
 
4157
                                gboolean _tmp7_ = FALSE;
4335
4158
                                gboolean _tmp8_ = FALSE;
4336
 
                                gboolean _tmp9_ = FALSE;
4337
 
                                ChessPiece* _tmp10_;
4338
 
                                PieceType _tmp11_;
4339
 
                                gboolean _tmp14_;
4340
 
                                gboolean _tmp17_;
4341
 
                                ChessPiece* _tmp18_;
4342
 
                                PieceType _tmp19_;
4343
 
                                ChessPiece* _tmp25_;
4344
 
                                PieceType _tmp26_;
 
4159
                                ChessPiece* _tmp9_ = NULL;
 
4160
                                PieceType _tmp10_ = 0;
 
4161
                                ChessPiece* _tmp15_ = NULL;
 
4162
                                PieceType _tmp16_ = 0;
 
4163
                                ChessPiece* _tmp22_ = NULL;
 
4164
                                PieceType _tmp23_ = 0;
 
4165
                                gboolean _tmp33_ = FALSE;
 
4166
                                gint _tmp34_ = 0;
4345
4167
                                gboolean _tmp36_ = FALSE;
4346
 
                                gint _tmp37_;
4347
 
                                gboolean _tmp39_;
4348
 
                                gboolean _tmp40_ = FALSE;
4349
 
                                gint _tmp41_;
4350
 
                                gboolean _tmp43_;
4351
 
                                gboolean _tmp44_ = FALSE;
4352
 
                                gint _tmp45_;
4353
 
                                gboolean _tmp47_;
 
4168
                                gint _tmp37_ = 0;
 
4169
                                gboolean _tmp39_ = FALSE;
 
4170
                                gint _tmp40_ = 0;
 
4171
                                gboolean _tmp42_ = FALSE;
 
4172
                                gboolean _tmp43_ = FALSE;
 
4173
                                gboolean _tmp45_ = FALSE;
 
4174
                                gboolean _tmp46_ = FALSE;
4354
4175
                                gboolean _tmp48_ = FALSE;
4355
 
                                gboolean _tmp49_;
4356
 
                                gboolean _tmp51_;
4357
 
                                gboolean _tmp52_ = FALSE;
4358
 
                                gboolean _tmp53_;
4359
 
                                gboolean _tmp55_;
4360
 
                                gboolean _tmp56_ = FALSE;
4361
 
                                gboolean _tmp57_ = FALSE;
4362
 
                                gint _tmp58_;
4363
 
                                gboolean _tmp60_;
4364
 
                                gboolean _tmp62_;
4365
 
                                gboolean _tmp63_ = FALSE;
4366
 
                                gboolean _tmp64_ = FALSE;
4367
 
                                gint _tmp65_;
4368
 
                                gboolean _tmp67_;
4369
 
                                gboolean _tmp69_;
4370
 
                                gboolean _tmp70_ = FALSE;
4371
 
                                gint _tmp71_;
4372
 
                                gboolean _tmp73_;
4373
 
                                _tmp1_ = _tmp0_;
4374
 
                                if (!_tmp1_) {
4375
 
                                        gint _tmp2_;
4376
 
                                        _tmp2_ = i;
4377
 
                                        i = _tmp2_ + 1;
 
4176
                                gboolean _tmp49_ = FALSE;
 
4177
                                gint _tmp50_ = 0;
 
4178
                                gboolean _tmp53_ = FALSE;
 
4179
                                gboolean _tmp54_ = FALSE;
 
4180
                                gint _tmp55_ = 0;
 
4181
                                gboolean _tmp58_ = FALSE;
 
4182
                                gint _tmp59_ = 0;
 
4183
                                if (!_tmp0_) {
 
4184
                                        gint _tmp1_ = 0;
 
4185
                                        _tmp1_ = i;
 
4186
                                        i = _tmp1_ + 1;
4378
4187
                                }
4379
4188
                                _tmp0_ = FALSE;
 
4189
                                _tmp2_ = i;
 
4190
                                if (!(_tmp2_ < 64)) {
 
4191
                                        break;
 
4192
                                }
4380
4193
                                _tmp3_ = i;
4381
 
                                if (!(_tmp3_ < 64)) {
4382
 
                                        break;
4383
 
                                }
4384
 
                                _tmp4_ = i;
4385
 
                                _tmp5_ = self->board[_tmp4_];
4386
 
                                _tmp6_ = _chess_piece_ref0 (_tmp5_);
4387
 
                                p = _tmp6_;
4388
 
                                _tmp7_ = p;
4389
 
                                if (_tmp7_ == NULL) {
 
4194
                                _tmp4_ = self->board[_tmp3_];
 
4195
                                _tmp5_ = _chess_piece_ref0 (_tmp4_);
 
4196
                                p = _tmp5_;
 
4197
                                _tmp6_ = p;
 
4198
                                if (_tmp6_ == NULL) {
4390
4199
                                        _chess_piece_unref0 (p);
4391
4200
                                        continue;
4392
4201
                                }
4393
 
                                _tmp10_ = p;
4394
 
                                _tmp11_ = _tmp10_->type;
4395
 
                                if (_tmp11_ == PIECE_TYPE_PAWN) {
4396
 
                                        _tmp9_ = TRUE;
4397
 
                                } else {
4398
 
                                        ChessPiece* _tmp12_;
4399
 
                                        PieceType _tmp13_;
4400
 
                                        _tmp12_ = p;
4401
 
                                        _tmp13_ = _tmp12_->type;
4402
 
                                        _tmp9_ = _tmp13_ == PIECE_TYPE_ROOK;
4403
 
                                }
4404
 
                                _tmp14_ = _tmp9_;
4405
 
                                if (_tmp14_) {
 
4202
                                _tmp9_ = p;
 
4203
                                _tmp10_ = _tmp9_->type;
 
4204
                                if (_tmp10_ == PIECE_TYPE_PAWN) {
4406
4205
                                        _tmp8_ = TRUE;
4407
4206
                                } else {
4408
 
                                        ChessPiece* _tmp15_;
4409
 
                                        PieceType _tmp16_;
4410
 
                                        _tmp15_ = p;
4411
 
                                        _tmp16_ = _tmp15_->type;
4412
 
                                        _tmp8_ = _tmp16_ == PIECE_TYPE_QUEEN;
4413
 
                                }
4414
 
                                _tmp17_ = _tmp8_;
4415
 
                                if (_tmp17_) {
 
4207
                                        ChessPiece* _tmp11_ = NULL;
 
4208
                                        PieceType _tmp12_ = 0;
 
4209
                                        _tmp11_ = p;
 
4210
                                        _tmp12_ = _tmp11_->type;
 
4211
                                        _tmp8_ = _tmp12_ == PIECE_TYPE_ROOK;
 
4212
                                }
 
4213
                                if (_tmp8_) {
 
4214
                                        _tmp7_ = TRUE;
 
4215
                                } else {
 
4216
                                        ChessPiece* _tmp13_ = NULL;
 
4217
                                        PieceType _tmp14_ = 0;
 
4218
                                        _tmp13_ = p;
 
4219
                                        _tmp14_ = _tmp13_->type;
 
4220
                                        _tmp7_ = _tmp14_ == PIECE_TYPE_QUEEN;
 
4221
                                }
 
4222
                                if (_tmp7_) {
4416
4223
                                        result = TRUE;
4417
4224
                                        _chess_piece_unref0 (p);
4418
4225
                                        return result;
4419
4226
                                }
4420
 
                                _tmp18_ = p;
4421
 
                                _tmp19_ = _tmp18_->type;
4422
 
                                if (_tmp19_ == PIECE_TYPE_KNIGHT) {
4423
 
                                        ChessPiece* _tmp20_;
4424
 
                                        Color _tmp21_;
4425
 
                                        Color _tmp22_;
4426
 
                                        _tmp20_ = p;
4427
 
                                        _tmp21_ = chess_piece_get_color (_tmp20_);
4428
 
                                        _tmp22_ = _tmp21_;
4429
 
                                        if (_tmp22_ == COLOR_WHITE) {
4430
 
                                                gint _tmp23_;
4431
 
                                                _tmp23_ = white_knight_count;
4432
 
                                                white_knight_count = _tmp23_ + 1;
 
4227
                                _tmp15_ = p;
 
4228
                                _tmp16_ = _tmp15_->type;
 
4229
                                if (_tmp16_ == PIECE_TYPE_KNIGHT) {
 
4230
                                        ChessPiece* _tmp17_ = NULL;
 
4231
                                        Color _tmp18_ = 0;
 
4232
                                        Color _tmp19_ = 0;
 
4233
                                        _tmp17_ = p;
 
4234
                                        _tmp18_ = chess_piece_get_color (_tmp17_);
 
4235
                                        _tmp19_ = _tmp18_;
 
4236
                                        if (_tmp19_ == COLOR_WHITE) {
 
4237
                                                gint _tmp20_ = 0;
 
4238
                                                _tmp20_ = white_knight_count;
 
4239
                                                white_knight_count = _tmp20_ + 1;
4433
4240
                                        } else {
4434
 
                                                gint _tmp24_;
4435
 
                                                _tmp24_ = black_knight_count;
4436
 
                                                black_knight_count = _tmp24_ + 1;
 
4241
                                                gint _tmp21_ = 0;
 
4242
                                                _tmp21_ = black_knight_count;
 
4243
                                                black_knight_count = _tmp21_ + 1;
4437
4244
                                        }
4438
4245
                                }
4439
 
                                _tmp25_ = p;
4440
 
                                _tmp26_ = _tmp25_->type;
4441
 
                                if (_tmp26_ == PIECE_TYPE_BISHOP) {
4442
 
                                        Color color;
4443
 
                                        gint _tmp27_;
4444
 
                                        gint _tmp28_;
4445
 
                                        ChessPiece* _tmp29_;
4446
 
                                        Color _tmp30_;
4447
 
                                        Color _tmp31_;
 
4246
                                _tmp22_ = p;
 
4247
                                _tmp23_ = _tmp22_->type;
 
4248
                                if (_tmp23_ == PIECE_TYPE_BISHOP) {
 
4249
                                        Color color = 0;
 
4250
                                        gint _tmp24_ = 0;
 
4251
                                        gint _tmp25_ = 0;
 
4252
                                        ChessPiece* _tmp26_ = NULL;
 
4253
                                        Color _tmp27_ = 0;
 
4254
                                        Color _tmp28_ = 0;
4448
4255
                                        color = COLOR_BLACK;
4449
 
                                        _tmp27_ = i;
4450
 
                                        _tmp28_ = i;
4451
 
                                        if (((_tmp27_ + (_tmp28_ / 8)) % 2) != 0) {
 
4256
                                        _tmp24_ = i;
 
4257
                                        _tmp25_ = i;
 
4258
                                        if (((_tmp24_ + (_tmp25_ / 8)) % 2) != 0) {
4452
4259
                                                color = COLOR_WHITE;
4453
4260
                                        }
4454
 
                                        _tmp29_ = p;
4455
 
                                        _tmp30_ = chess_piece_get_color (_tmp29_);
4456
 
                                        _tmp31_ = _tmp30_;
4457
 
                                        if (_tmp31_ == COLOR_WHITE) {
4458
 
                                                Color _tmp32_;
4459
 
                                                gint _tmp33_;
4460
 
                                                _tmp32_ = color;
4461
 
                                                if (_tmp32_ == COLOR_WHITE) {
 
4261
                                        _tmp26_ = p;
 
4262
                                        _tmp27_ = chess_piece_get_color (_tmp26_);
 
4263
                                        _tmp28_ = _tmp27_;
 
4264
                                        if (_tmp28_ == COLOR_WHITE) {
 
4265
                                                Color _tmp29_ = 0;
 
4266
                                                gint _tmp30_ = 0;
 
4267
                                                _tmp29_ = color;
 
4268
                                                if (_tmp29_ == COLOR_WHITE) {
4462
4269
                                                        white_bishop_on_white_square = TRUE;
4463
4270
                                                } else {
4464
4271
                                                        white_bishop_on_black_square = TRUE;
4465
4272
                                                }
4466
 
                                                _tmp33_ = white_bishop_count;
4467
 
                                                white_bishop_count = _tmp33_ + 1;
 
4273
                                                _tmp30_ = white_bishop_count;
 
4274
                                                white_bishop_count = _tmp30_ + 1;
4468
4275
                                        } else {
4469
 
                                                Color _tmp34_;
4470
 
                                                gint _tmp35_;
4471
 
                                                _tmp34_ = color;
4472
 
                                                if (_tmp34_ == COLOR_WHITE) {
 
4276
                                                Color _tmp31_ = 0;
 
4277
                                                gint _tmp32_ = 0;
 
4278
                                                _tmp31_ = color;
 
4279
                                                if (_tmp31_ == COLOR_WHITE) {
4473
4280
                                                        black_bishop_on_white_square = TRUE;
4474
4281
                                                } else {
4475
4282
                                                        black_bishop_on_black_square = TRUE;
4476
4283
                                                }
4477
 
                                                _tmp35_ = black_bishop_count;
4478
 
                                                black_bishop_count = _tmp35_ + 1;
 
4284
                                                _tmp32_ = black_bishop_count;
 
4285
                                                black_bishop_count = _tmp32_ + 1;
4479
4286
                                        }
4480
4287
                                }
4481
 
                                _tmp37_ = white_knight_count;
4482
 
                                if (_tmp37_ > 1) {
4483
 
                                        _tmp36_ = TRUE;
4484
 
                                } else {
4485
 
                                        gint _tmp38_;
4486
 
                                        _tmp38_ = black_knight_count;
4487
 
                                        _tmp36_ = _tmp38_ > 1;
4488
 
                                }
4489
 
                                _tmp39_ = _tmp36_;
 
4288
                                _tmp34_ = white_knight_count;
 
4289
                                if (_tmp34_ > 1) {
 
4290
                                        _tmp33_ = TRUE;
 
4291
                                } else {
 
4292
                                        gint _tmp35_ = 0;
 
4293
                                        _tmp35_ = black_knight_count;
 
4294
                                        _tmp33_ = _tmp35_ > 1;
 
4295
                                }
 
4296
                                if (_tmp33_) {
 
4297
                                        result = TRUE;
 
4298
                                        _chess_piece_unref0 (p);
 
4299
                                        return result;
 
4300
                                }
 
4301
                                _tmp37_ = white_bishop_count;
 
4302
                                if (_tmp37_ > 0) {
 
4303
                                        gint _tmp38_ = 0;
 
4304
                                        _tmp38_ = white_knight_count;
 
4305
                                        _tmp36_ = _tmp38_ > 0;
 
4306
                                } else {
 
4307
                                        _tmp36_ = FALSE;
 
4308
                                }
 
4309
                                if (_tmp36_) {
 
4310
                                        result = TRUE;
 
4311
                                        _chess_piece_unref0 (p);
 
4312
                                        return result;
 
4313
                                }
 
4314
                                _tmp40_ = black_bishop_count;
 
4315
                                if (_tmp40_ > 0) {
 
4316
                                        gint _tmp41_ = 0;
 
4317
                                        _tmp41_ = black_knight_count;
 
4318
                                        _tmp39_ = _tmp41_ > 0;
 
4319
                                } else {
 
4320
                                        _tmp39_ = FALSE;
 
4321
                                }
4490
4322
                                if (_tmp39_) {
4491
4323
                                        result = TRUE;
4492
4324
                                        _chess_piece_unref0 (p);
4493
4325
                                        return result;
4494
4326
                                }
4495
 
                                _tmp41_ = white_bishop_count;
4496
 
                                if (_tmp41_ > 0) {
4497
 
                                        gint _tmp42_;
4498
 
                                        _tmp42_ = white_knight_count;
4499
 
                                        _tmp40_ = _tmp42_ > 0;
4500
 
                                } else {
4501
 
                                        _tmp40_ = FALSE;
4502
 
                                }
4503
 
                                _tmp43_ = _tmp40_;
 
4327
                                _tmp43_ = white_bishop_on_white_square;
4504
4328
                                if (_tmp43_) {
4505
 
                                        result = TRUE;
4506
 
                                        _chess_piece_unref0 (p);
4507
 
                                        return result;
4508
 
                                }
4509
 
                                _tmp45_ = black_bishop_count;
4510
 
                                if (_tmp45_ > 0) {
4511
 
                                        gint _tmp46_;
4512
 
                                        _tmp46_ = black_knight_count;
4513
 
                                        _tmp44_ = _tmp46_ > 0;
4514
 
                                } else {
4515
 
                                        _tmp44_ = FALSE;
4516
 
                                }
4517
 
                                _tmp47_ = _tmp44_;
4518
 
                                if (_tmp47_) {
4519
 
                                        result = TRUE;
4520
 
                                        _chess_piece_unref0 (p);
4521
 
                                        return result;
4522
 
                                }
4523
 
                                _tmp49_ = white_bishop_on_white_square;
 
4329
                                        gboolean _tmp44_ = FALSE;
 
4330
                                        _tmp44_ = white_bishop_on_black_square;
 
4331
                                        _tmp42_ = _tmp44_;
 
4332
                                } else {
 
4333
                                        _tmp42_ = FALSE;
 
4334
                                }
 
4335
                                if (_tmp42_) {
 
4336
                                        result = TRUE;
 
4337
                                        _chess_piece_unref0 (p);
 
4338
                                        return result;
 
4339
                                }
 
4340
                                _tmp46_ = black_bishop_on_white_square;
 
4341
                                if (_tmp46_) {
 
4342
                                        gboolean _tmp47_ = FALSE;
 
4343
                                        _tmp47_ = black_bishop_on_black_square;
 
4344
                                        _tmp45_ = _tmp47_;
 
4345
                                } else {
 
4346
                                        _tmp45_ = FALSE;
 
4347
                                }
 
4348
                                if (_tmp45_) {
 
4349
                                        result = TRUE;
 
4350
                                        _chess_piece_unref0 (p);
 
4351
                                        return result;
 
4352
                                }
 
4353
                                _tmp50_ = white_bishop_count;
 
4354
                                if (_tmp50_ > 0) {
 
4355
                                        _tmp49_ = TRUE;
 
4356
                                } else {
 
4357
                                        gint _tmp51_ = 0;
 
4358
                                        _tmp51_ = white_knight_count;
 
4359
                                        _tmp49_ = _tmp51_ > 0;
 
4360
                                }
4524
4361
                                if (_tmp49_) {
4525
 
                                        gboolean _tmp50_;
4526
 
                                        _tmp50_ = white_bishop_on_black_square;
4527
 
                                        _tmp48_ = _tmp50_;
 
4362
                                        gint _tmp52_ = 0;
 
4363
                                        _tmp52_ = black_knight_count;
 
4364
                                        _tmp48_ = _tmp52_ > 0;
4528
4365
                                } else {
4529
4366
                                        _tmp48_ = FALSE;
4530
4367
                                }
4531
 
                                _tmp51_ = _tmp48_;
4532
 
                                if (_tmp51_) {
 
4368
                                if (_tmp48_) {
4533
4369
                                        result = TRUE;
4534
4370
                                        _chess_piece_unref0 (p);
4535
4371
                                        return result;
4536
4372
                                }
4537
 
                                _tmp53_ = black_bishop_on_white_square;
 
4373
                                _tmp55_ = black_bishop_count;
 
4374
                                if (_tmp55_ > 0) {
 
4375
                                        _tmp54_ = TRUE;
 
4376
                                } else {
 
4377
                                        gint _tmp56_ = 0;
 
4378
                                        _tmp56_ = black_knight_count;
 
4379
                                        _tmp54_ = _tmp56_ > 0;
 
4380
                                }
 
4381
                                if (_tmp54_) {
 
4382
                                        gint _tmp57_ = 0;
 
4383
                                        _tmp57_ = white_knight_count;
 
4384
                                        _tmp53_ = _tmp57_ > 0;
 
4385
                                } else {
 
4386
                                        _tmp53_ = FALSE;
 
4387
                                }
4538
4388
                                if (_tmp53_) {
4539
 
                                        gboolean _tmp54_;
4540
 
                                        _tmp54_ = black_bishop_on_black_square;
4541
 
                                        _tmp52_ = _tmp54_;
4542
 
                                } else {
4543
 
                                        _tmp52_ = FALSE;
4544
 
                                }
4545
 
                                _tmp55_ = _tmp52_;
4546
 
                                if (_tmp55_) {
4547
 
                                        result = TRUE;
4548
 
                                        _chess_piece_unref0 (p);
4549
 
                                        return result;
4550
 
                                }
4551
 
                                _tmp58_ = white_bishop_count;
4552
 
                                if (_tmp58_ > 0) {
4553
 
                                        _tmp57_ = TRUE;
4554
 
                                } else {
4555
 
                                        gint _tmp59_;
4556
 
                                        _tmp59_ = white_knight_count;
4557
 
                                        _tmp57_ = _tmp59_ > 0;
4558
 
                                }
4559
 
                                _tmp60_ = _tmp57_;
4560
 
                                if (_tmp60_) {
4561
 
                                        gint _tmp61_;
4562
 
                                        _tmp61_ = black_knight_count;
4563
 
                                        _tmp56_ = _tmp61_ > 0;
4564
 
                                } else {
4565
 
                                        _tmp56_ = FALSE;
4566
 
                                }
4567
 
                                _tmp62_ = _tmp56_;
4568
 
                                if (_tmp62_) {
4569
 
                                        result = TRUE;
4570
 
                                        _chess_piece_unref0 (p);
4571
 
                                        return result;
4572
 
                                }
4573
 
                                _tmp65_ = black_bishop_count;
4574
 
                                if (_tmp65_ > 0) {
4575
 
                                        _tmp64_ = TRUE;
4576
 
                                } else {
4577
 
                                        gint _tmp66_;
4578
 
                                        _tmp66_ = black_knight_count;
4579
 
                                        _tmp64_ = _tmp66_ > 0;
4580
 
                                }
4581
 
                                _tmp67_ = _tmp64_;
4582
 
                                if (_tmp67_) {
4583
 
                                        gint _tmp68_;
4584
 
                                        _tmp68_ = white_knight_count;
4585
 
                                        _tmp63_ = _tmp68_ > 0;
4586
 
                                } else {
4587
 
                                        _tmp63_ = FALSE;
4588
 
                                }
4589
 
                                _tmp69_ = _tmp63_;
4590
 
                                if (_tmp69_) {
4591
 
                                        result = TRUE;
4592
 
                                        _chess_piece_unref0 (p);
4593
 
                                        return result;
4594
 
                                }
4595
 
                                _tmp71_ = white_bishop_count;
4596
 
                                if (_tmp71_ > 0) {
4597
 
                                        gint _tmp72_;
4598
 
                                        _tmp72_ = black_bishop_count;
4599
 
                                        _tmp70_ = _tmp72_ > 0;
4600
 
                                } else {
4601
 
                                        _tmp70_ = FALSE;
4602
 
                                }
4603
 
                                _tmp73_ = _tmp70_;
4604
 
                                if (_tmp73_) {
4605
 
                                        gboolean _tmp74_ = FALSE;
4606
 
                                        gboolean _tmp75_;
4607
 
                                        gboolean _tmp77_;
4608
 
                                        _tmp75_ = white_bishop_on_white_square;
4609
 
                                        if (_tmp75_) {
4610
 
                                                gboolean _tmp76_;
4611
 
                                                _tmp76_ = black_bishop_on_black_square;
4612
 
                                                _tmp74_ = _tmp76_;
 
4389
                                        result = TRUE;
 
4390
                                        _chess_piece_unref0 (p);
 
4391
                                        return result;
 
4392
                                }
 
4393
                                _tmp59_ = white_bishop_count;
 
4394
                                if (_tmp59_ > 0) {
 
4395
                                        gint _tmp60_ = 0;
 
4396
                                        _tmp60_ = black_bishop_count;
 
4397
                                        _tmp58_ = _tmp60_ > 0;
 
4398
                                } else {
 
4399
                                        _tmp58_ = FALSE;
 
4400
                                }
 
4401
                                if (_tmp58_) {
 
4402
                                        gboolean _tmp61_ = FALSE;
 
4403
                                        gboolean _tmp62_ = FALSE;
 
4404
                                        _tmp62_ = white_bishop_on_white_square;
 
4405
                                        if (_tmp62_) {
 
4406
                                                gboolean _tmp63_ = FALSE;
 
4407
                                                _tmp63_ = black_bishop_on_black_square;
 
4408
                                                _tmp61_ = _tmp63_;
4613
4409
                                        } else {
4614
 
                                                _tmp74_ = FALSE;
 
4410
                                                _tmp61_ = FALSE;
4615
4411
                                        }
4616
 
                                        _tmp77_ = _tmp74_;
4617
 
                                        if (_tmp77_) {
 
4412
                                        if (_tmp61_) {
4618
4413
                                                result = TRUE;
4619
4414
                                                _chess_piece_unref0 (p);
4620
4415
                                                return result;
4621
4416
                                        } else {
4622
 
                                                gboolean _tmp78_ = FALSE;
4623
 
                                                gboolean _tmp79_;
4624
 
                                                gboolean _tmp81_;
4625
 
                                                _tmp79_ = white_bishop_on_black_square;
4626
 
                                                if (_tmp79_) {
4627
 
                                                        gboolean _tmp80_;
4628
 
                                                        _tmp80_ = black_bishop_on_white_square;
4629
 
                                                        _tmp78_ = _tmp80_;
 
4417
                                                gboolean _tmp64_ = FALSE;
 
4418
                                                gboolean _tmp65_ = FALSE;
 
4419
                                                _tmp65_ = white_bishop_on_black_square;
 
4420
                                                if (_tmp65_) {
 
4421
                                                        gboolean _tmp66_ = FALSE;
 
4422
                                                        _tmp66_ = black_bishop_on_white_square;
 
4423
                                                        _tmp64_ = _tmp66_;
4630
4424
                                                } else {
4631
 
                                                        _tmp78_ = FALSE;
 
4425
                                                        _tmp64_ = FALSE;
4632
4426
                                                }
4633
 
                                                _tmp81_ = _tmp78_;
4634
 
                                                if (_tmp81_) {
 
4427
                                                if (_tmp64_) {
4635
4428
                                                        result = TRUE;
4636
4429
                                                        _chess_piece_unref0 (p);
4637
4430
                                                        return result;
4650
4443
static gboolean chess_state_decode_piece_type (ChessState* self, gunichar c, PieceType* type) {
4651
4444
        PieceType _vala_type = 0;
4652
4445
        gboolean result = FALSE;
4653
 
        gunichar _tmp0_;
 
4446
        gunichar _tmp0_ = 0U;
4654
4447
        g_return_val_if_fail (self != NULL, FALSE);
4655
4448
        _vala_type = PIECE_TYPE_PAWN;
4656
4449
        _tmp0_ = c;
4731
4524
        gint _vala_f1 = 0;
4732
4525
        PieceType _vala_promotion_type = 0;
4733
4526
        gboolean result = FALSE;
4734
 
        gint i;
4735
 
        const gchar* _tmp0_;
 
4527
        gint i = 0;
 
4528
        const gchar* _tmp0_ = NULL;
4736
4529
        gboolean _tmp1_ = FALSE;
4737
 
        const gchar* _tmp163_;
4738
 
        gint _tmp164_;
4739
 
        gchar _tmp165_ = '\0';
4740
 
        const gchar* _tmp171_;
4741
 
        gint _tmp172_;
4742
 
        gchar _tmp173_ = '\0';
 
4530
        const gchar* _tmp150_ = NULL;
 
4531
        gint _tmp151_ = 0;
 
4532
        gchar _tmp152_ = '\0';
 
4533
        const gchar* _tmp158_ = NULL;
 
4534
        gint _tmp159_ = 0;
 
4535
        gchar _tmp160_ = '\0';
4743
4536
        g_return_val_if_fail (self != NULL, FALSE);
4744
4537
        g_return_val_if_fail (player != NULL, FALSE);
4745
4538
        g_return_val_if_fail (move != NULL, FALSE);
4748
4541
        _tmp0_ = move;
4749
4542
        _tmp1_ = g_str_has_prefix (_tmp0_, "O-O-O");
4750
4543
        if (_tmp1_) {
4751
 
                ChessPlayer* _tmp2_;
4752
 
                Color _tmp3_;
4753
 
                gint _tmp6_;
4754
 
                gint _tmp7_;
4755
 
                gint _tmp8_;
 
4544
                ChessPlayer* _tmp2_ = NULL;
 
4545
                Color _tmp3_ = 0;
 
4546
                gint _tmp6_ = 0;
 
4547
                gint _tmp7_ = 0;
 
4548
                gint _tmp8_ = 0;
4756
4549
                _tmp2_ = player;
4757
4550
                _tmp3_ = _tmp2_->color;
4758
4551
                if (_tmp3_ == COLOR_WHITE) {
4759
 
                        gint _tmp4_;
 
4552
                        gint _tmp4_ = 0;
4760
4553
                        _vala_r1 = 0;
4761
4554
                        _tmp4_ = _vala_r1;
4762
4555
                        _vala_r0 = _tmp4_;
4763
4556
                } else {
4764
 
                        gint _tmp5_;
 
4557
                        gint _tmp5_ = 0;
4765
4558
                        _vala_r1 = 7;
4766
4559
                        _tmp5_ = _vala_r1;
4767
4560
                        _vala_r0 = _tmp5_;
4773
4566
                _tmp8_ = _tmp7_;
4774
4567
                i = _tmp6_ + ((gint) _tmp8_);
4775
4568
        } else {
4776
 
                const gchar* _tmp9_;
 
4569
                const gchar* _tmp9_ = NULL;
4777
4570
                gboolean _tmp10_ = FALSE;
4778
4571
                _tmp9_ = move;
4779
4572
                _tmp10_ = g_str_has_prefix (_tmp9_, "O-O");
4780
4573
                if (_tmp10_) {
4781
 
                        ChessPlayer* _tmp11_;
4782
 
                        Color _tmp12_;
4783
 
                        gint _tmp15_;
4784
 
                        gint _tmp16_;
4785
 
                        gint _tmp17_;
 
4574
                        ChessPlayer* _tmp11_ = NULL;
 
4575
                        Color _tmp12_ = 0;
 
4576
                        gint _tmp15_ = 0;
 
4577
                        gint _tmp16_ = 0;
 
4578
                        gint _tmp17_ = 0;
4786
4579
                        _tmp11_ = player;
4787
4580
                        _tmp12_ = _tmp11_->color;
4788
4581
                        if (_tmp12_ == COLOR_WHITE) {
4789
 
                                gint _tmp13_;
 
4582
                                gint _tmp13_ = 0;
4790
4583
                                _vala_r1 = 0;
4791
4584
                                _tmp13_ = _vala_r1;
4792
4585
                                _vala_r0 = _tmp13_;
4793
4586
                        } else {
4794
 
                                gint _tmp14_;
 
4587
                                gint _tmp14_ = 0;
4795
4588
                                _vala_r1 = 7;
4796
4589
                                _tmp14_ = _vala_r1;
4797
4590
                                _vala_r0 = _tmp14_;
4803
4596
                        _tmp17_ = _tmp16_;
4804
4597
                        i = _tmp15_ + ((gint) _tmp17_);
4805
4598
                } else {
4806
 
                        PieceType type;
4807
 
                        const gchar* _tmp18_;
4808
 
                        gint _tmp19_;
 
4599
                        PieceType type = 0;
 
4600
                        const gchar* _tmp18_ = NULL;
 
4601
                        gint _tmp19_ = 0;
4809
4602
                        gchar _tmp20_ = '\0';
4810
4603
                        PieceType _tmp21_ = 0;
4811
4604
                        gboolean _tmp22_ = FALSE;
4812
 
                        gint _tmp24_;
4813
 
                        gint _tmp25_;
4814
 
                        gint _tmp26_;
 
4605
                        gint _tmp24_ = 0;
 
4606
                        gint _tmp25_ = 0;
 
4607
                        gint _tmp26_ = 0;
4815
4608
                        gboolean _tmp27_ = FALSE;
4816
 
                        const gchar* _tmp28_;
4817
 
                        gint _tmp29_;
 
4609
                        const gchar* _tmp28_ = NULL;
 
4610
                        gint _tmp29_ = 0;
4818
4611
                        gchar _tmp30_ = '\0';
4819
 
                        gboolean _tmp34_;
4820
 
                        gboolean _tmp39_ = FALSE;
4821
 
                        const gchar* _tmp40_;
4822
 
                        gint _tmp41_;
4823
 
                        gchar _tmp42_ = '\0';
4824
 
                        gboolean _tmp46_;
4825
 
                        gboolean _tmp51_ = FALSE;
4826
 
                        const gchar* _tmp52_;
4827
 
                        gint _tmp53_;
4828
 
                        gchar _tmp54_ = '\0';
4829
 
                        gboolean _tmp58_;
4830
 
                        gboolean _tmp60_ = FALSE;
4831
 
                        const gchar* _tmp61_;
4832
 
                        gint _tmp62_;
4833
 
                        gchar _tmp63_ = '\0';
4834
 
                        gboolean _tmp67_;
4835
 
                        gboolean _tmp73_ = FALSE;
4836
 
                        const gchar* _tmp74_;
4837
 
                        gint _tmp75_;
4838
 
                        gchar _tmp76_ = '\0';
4839
 
                        gboolean _tmp80_;
4840
 
                        const gchar* _tmp86_;
4841
 
                        gint _tmp87_;
4842
 
                        gchar _tmp88_ = '\0';
4843
 
                        gboolean _tmp106_ = FALSE;
4844
 
                        gint _tmp107_;
4845
 
                        gboolean _tmp109_;
4846
 
                        gboolean _tmp111_ = FALSE;
4847
 
                        gint _tmp112_;
4848
 
                        gboolean _tmp114_;
 
4612
                        gboolean _tmp38_ = FALSE;
 
4613
                        const gchar* _tmp39_ = NULL;
 
4614
                        gint _tmp40_ = 0;
 
4615
                        gchar _tmp41_ = '\0';
 
4616
                        gboolean _tmp49_ = FALSE;
 
4617
                        const gchar* _tmp50_ = NULL;
 
4618
                        gint _tmp51_ = 0;
 
4619
                        gchar _tmp52_ = '\0';
 
4620
                        gboolean _tmp57_ = FALSE;
 
4621
                        const gchar* _tmp58_ = NULL;
 
4622
                        gint _tmp59_ = 0;
 
4623
                        gchar _tmp60_ = '\0';
 
4624
                        gboolean _tmp69_ = FALSE;
 
4625
                        const gchar* _tmp70_ = NULL;
 
4626
                        gint _tmp71_ = 0;
 
4627
                        gchar _tmp72_ = '\0';
 
4628
                        const gchar* _tmp81_ = NULL;
 
4629
                        gint _tmp82_ = 0;
 
4630
                        gchar _tmp83_ = '\0';
 
4631
                        gboolean _tmp101_ = FALSE;
 
4632
                        gint _tmp102_ = 0;
 
4633
                        gboolean _tmp105_ = FALSE;
 
4634
                        gint _tmp106_ = 0;
4849
4635
                        type = PIECE_TYPE_PAWN;
4850
4636
                        _tmp18_ = move;
4851
4637
                        _tmp19_ = i;
4853
4639
                        _tmp22_ = chess_state_decode_piece_type (self, (gunichar) _tmp20_, &_tmp21_);
4854
4640
                        type = _tmp21_;
4855
4641
                        if (_tmp22_) {
4856
 
                                gint _tmp23_;
 
4642
                                gint _tmp23_ = 0;
4857
4643
                                _tmp23_ = i;
4858
4644
                                i = _tmp23_ + 1;
4859
4645
                        }
4868
4654
                        _tmp29_ = i;
4869
4655
                        _tmp30_ = string_get (_tmp28_, (glong) _tmp29_);
4870
4656
                        if (_tmp30_ >= 'a') {
4871
 
                                const gchar* _tmp31_;
4872
 
                                gint _tmp32_;
 
4657
                                const gchar* _tmp31_ = NULL;
 
4658
                                gint _tmp32_ = 0;
4873
4659
                                gchar _tmp33_ = '\0';
4874
4660
                                _tmp31_ = move;
4875
4661
                                _tmp32_ = i;
4878
4664
                        } else {
4879
4665
                                _tmp27_ = FALSE;
4880
4666
                        }
4881
 
                        _tmp34_ = _tmp27_;
4882
 
                        if (_tmp34_) {
4883
 
                                const gchar* _tmp35_;
4884
 
                                gint _tmp36_;
4885
 
                                gchar _tmp37_ = '\0';
4886
 
                                gint _tmp38_;
4887
 
                                _tmp35_ = move;
4888
 
                                _tmp36_ = i;
4889
 
                                _tmp37_ = string_get (_tmp35_, (glong) _tmp36_);
4890
 
                                _vala_f1 = (gint) (_tmp37_ - 'a');
4891
 
                                _tmp38_ = i;
4892
 
                                i = _tmp38_ + 1;
 
4667
                        if (_tmp27_) {
 
4668
                                const gchar* _tmp34_ = NULL;
 
4669
                                gint _tmp35_ = 0;
 
4670
                                gchar _tmp36_ = '\0';
 
4671
                                gint _tmp37_ = 0;
 
4672
                                _tmp34_ = move;
 
4673
                                _tmp35_ = i;
 
4674
                                _tmp36_ = string_get (_tmp34_, (glong) _tmp35_);
 
4675
                                _vala_f1 = (gint) (_tmp36_ - 'a');
 
4676
                                _tmp37_ = i;
 
4677
                                i = _tmp37_ + 1;
4893
4678
                        }
4894
 
                        _tmp40_ = move;
4895
 
                        _tmp41_ = i;
4896
 
                        _tmp42_ = string_get (_tmp40_, (glong) _tmp41_);
4897
 
                        if (_tmp42_ >= '1') {
4898
 
                                const gchar* _tmp43_;
4899
 
                                gint _tmp44_;
4900
 
                                gchar _tmp45_ = '\0';
4901
 
                                _tmp43_ = move;
4902
 
                                _tmp44_ = i;
4903
 
                                _tmp45_ = string_get (_tmp43_, (glong) _tmp44_);
4904
 
                                _tmp39_ = _tmp45_ <= '8';
 
4679
                        _tmp39_ = move;
 
4680
                        _tmp40_ = i;
 
4681
                        _tmp41_ = string_get (_tmp39_, (glong) _tmp40_);
 
4682
                        if (_tmp41_ >= '1') {
 
4683
                                const gchar* _tmp42_ = NULL;
 
4684
                                gint _tmp43_ = 0;
 
4685
                                gchar _tmp44_ = '\0';
 
4686
                                _tmp42_ = move;
 
4687
                                _tmp43_ = i;
 
4688
                                _tmp44_ = string_get (_tmp42_, (glong) _tmp43_);
 
4689
                                _tmp38_ = _tmp44_ <= '8';
4905
4690
                        } else {
4906
 
                                _tmp39_ = FALSE;
 
4691
                                _tmp38_ = FALSE;
4907
4692
                        }
4908
 
                        _tmp46_ = _tmp39_;
4909
 
                        if (_tmp46_) {
4910
 
                                const gchar* _tmp47_;
4911
 
                                gint _tmp48_;
4912
 
                                gchar _tmp49_ = '\0';
4913
 
                                gint _tmp50_;
4914
 
                                _tmp47_ = move;
 
4693
                        if (_tmp38_) {
 
4694
                                const gchar* _tmp45_ = NULL;
 
4695
                                gint _tmp46_ = 0;
 
4696
                                gchar _tmp47_ = '\0';
 
4697
                                gint _tmp48_ = 0;
 
4698
                                _tmp45_ = move;
 
4699
                                _tmp46_ = i;
 
4700
                                _tmp47_ = string_get (_tmp45_, (glong) _tmp46_);
 
4701
                                _vala_r1 = (gint) (_tmp47_ - '1');
4915
4702
                                _tmp48_ = i;
4916
 
                                _tmp49_ = string_get (_tmp47_, (glong) _tmp48_);
4917
 
                                _vala_r1 = (gint) (_tmp49_ - '1');
4918
 
                                _tmp50_ = i;
4919
 
                                i = _tmp50_ + 1;
 
4703
                                i = _tmp48_ + 1;
4920
4704
                        }
4921
 
                        _tmp52_ = move;
4922
 
                        _tmp53_ = i;
4923
 
                        _tmp54_ = string_get (_tmp52_, (glong) _tmp53_);
4924
 
                        if (_tmp54_ == 'x') {
4925
 
                                _tmp51_ = TRUE;
 
4705
                        _tmp50_ = move;
 
4706
                        _tmp51_ = i;
 
4707
                        _tmp52_ = string_get (_tmp50_, (glong) _tmp51_);
 
4708
                        if (_tmp52_ == 'x') {
 
4709
                                _tmp49_ = TRUE;
4926
4710
                        } else {
4927
 
                                const gchar* _tmp55_;
4928
 
                                gint _tmp56_;
4929
 
                                gchar _tmp57_ = '\0';
4930
 
                                _tmp55_ = move;
 
4711
                                const gchar* _tmp53_ = NULL;
 
4712
                                gint _tmp54_ = 0;
 
4713
                                gchar _tmp55_ = '\0';
 
4714
                                _tmp53_ = move;
 
4715
                                _tmp54_ = i;
 
4716
                                _tmp55_ = string_get (_tmp53_, (glong) _tmp54_);
 
4717
                                _tmp49_ = _tmp55_ == '-';
 
4718
                        }
 
4719
                        if (_tmp49_) {
 
4720
                                gint _tmp56_ = 0;
4931
4721
                                _tmp56_ = i;
4932
 
                                _tmp57_ = string_get (_tmp55_, (glong) _tmp56_);
4933
 
                                _tmp51_ = _tmp57_ == '-';
4934
 
                        }
4935
 
                        _tmp58_ = _tmp51_;
4936
 
                        if (_tmp58_) {
4937
 
                                gint _tmp59_;
4938
 
                                _tmp59_ = i;
4939
 
                                i = _tmp59_ + 1;
4940
 
                        }
4941
 
                        _tmp61_ = move;
4942
 
                        _tmp62_ = i;
4943
 
                        _tmp63_ = string_get (_tmp61_, (glong) _tmp62_);
4944
 
                        if (_tmp63_ >= 'a') {
4945
 
                                const gchar* _tmp64_;
4946
 
                                gint _tmp65_;
4947
 
                                gchar _tmp66_ = '\0';
4948
 
                                _tmp64_ = move;
4949
 
                                _tmp65_ = i;
4950
 
                                _tmp66_ = string_get (_tmp64_, (glong) _tmp65_);
4951
 
                                _tmp60_ = _tmp66_ <= 'h';
4952
 
                        } else {
4953
 
                                _tmp60_ = FALSE;
4954
 
                        }
4955
 
                        _tmp67_ = _tmp60_;
4956
 
                        if (_tmp67_) {
4957
 
                                gint _tmp68_;
4958
 
                                const gchar* _tmp69_;
4959
 
                                gint _tmp70_;
4960
 
                                gchar _tmp71_ = '\0';
4961
 
                                gint _tmp72_;
4962
 
                                _tmp68_ = _vala_f1;
4963
 
                                _vala_f0 = _tmp68_;
4964
 
                                _tmp69_ = move;
4965
 
                                _tmp70_ = i;
4966
 
                                _tmp71_ = string_get (_tmp69_, (glong) _tmp70_);
4967
 
                                _vala_f1 = (gint) (_tmp71_ - 'a');
4968
 
                                _tmp72_ = i;
4969
 
                                i = _tmp72_ + 1;
4970
 
                        }
4971
 
                        _tmp74_ = move;
4972
 
                        _tmp75_ = i;
4973
 
                        _tmp76_ = string_get (_tmp74_, (glong) _tmp75_);
4974
 
                        if (_tmp76_ >= '1') {
4975
 
                                const gchar* _tmp77_;
4976
 
                                gint _tmp78_;
 
4722
                                i = _tmp56_ + 1;
 
4723
                        }
 
4724
                        _tmp58_ = move;
 
4725
                        _tmp59_ = i;
 
4726
                        _tmp60_ = string_get (_tmp58_, (glong) _tmp59_);
 
4727
                        if (_tmp60_ >= 'a') {
 
4728
                                const gchar* _tmp61_ = NULL;
 
4729
                                gint _tmp62_ = 0;
 
4730
                                gchar _tmp63_ = '\0';
 
4731
                                _tmp61_ = move;
 
4732
                                _tmp62_ = i;
 
4733
                                _tmp63_ = string_get (_tmp61_, (glong) _tmp62_);
 
4734
                                _tmp57_ = _tmp63_ <= 'h';
 
4735
                        } else {
 
4736
                                _tmp57_ = FALSE;
 
4737
                        }
 
4738
                        if (_tmp57_) {
 
4739
                                gint _tmp64_ = 0;
 
4740
                                const gchar* _tmp65_ = NULL;
 
4741
                                gint _tmp66_ = 0;
 
4742
                                gchar _tmp67_ = '\0';
 
4743
                                gint _tmp68_ = 0;
 
4744
                                _tmp64_ = _vala_f1;
 
4745
                                _vala_f0 = _tmp64_;
 
4746
                                _tmp65_ = move;
 
4747
                                _tmp66_ = i;
 
4748
                                _tmp67_ = string_get (_tmp65_, (glong) _tmp66_);
 
4749
                                _vala_f1 = (gint) (_tmp67_ - 'a');
 
4750
                                _tmp68_ = i;
 
4751
                                i = _tmp68_ + 1;
 
4752
                        }
 
4753
                        _tmp70_ = move;
 
4754
                        _tmp71_ = i;
 
4755
                        _tmp72_ = string_get (_tmp70_, (glong) _tmp71_);
 
4756
                        if (_tmp72_ >= '1') {
 
4757
                                const gchar* _tmp73_ = NULL;
 
4758
                                gint _tmp74_ = 0;
 
4759
                                gchar _tmp75_ = '\0';
 
4760
                                _tmp73_ = move;
 
4761
                                _tmp74_ = i;
 
4762
                                _tmp75_ = string_get (_tmp73_, (glong) _tmp74_);
 
4763
                                _tmp69_ = _tmp75_ <= '8';
 
4764
                        } else {
 
4765
                                _tmp69_ = FALSE;
 
4766
                        }
 
4767
                        if (_tmp69_) {
 
4768
                                gint _tmp76_ = 0;
 
4769
                                const gchar* _tmp77_ = NULL;
 
4770
                                gint _tmp78_ = 0;
4977
4771
                                gchar _tmp79_ = '\0';
 
4772
                                gint _tmp80_ = 0;
 
4773
                                _tmp76_ = _vala_r1;
 
4774
                                _vala_r0 = _tmp76_;
4978
4775
                                _tmp77_ = move;
4979
4776
                                _tmp78_ = i;
4980
4777
                                _tmp79_ = string_get (_tmp77_, (glong) _tmp78_);
4981
 
                                _tmp73_ = _tmp79_ <= '8';
 
4778
                                _vala_r1 = (gint) (_tmp79_ - '1');
 
4779
                                _tmp80_ = i;
 
4780
                                i = _tmp80_ + 1;
 
4781
                        }
 
4782
                        _tmp81_ = move;
 
4783
                        _tmp82_ = i;
 
4784
                        _tmp83_ = string_get (_tmp81_, (glong) _tmp82_);
 
4785
                        if (_tmp83_ == '=') {
 
4786
                                gint _tmp84_ = 0;
 
4787
                                const gchar* _tmp85_ = NULL;
 
4788
                                gint _tmp86_ = 0;
 
4789
                                gchar _tmp87_ = '\0';
 
4790
                                PieceType _tmp88_ = 0;
 
4791
                                gboolean _tmp89_ = FALSE;
 
4792
                                _tmp84_ = i;
 
4793
                                i = _tmp84_ + 1;
 
4794
                                _tmp85_ = move;
 
4795
                                _tmp86_ = i;
 
4796
                                _tmp87_ = string_get (_tmp85_, (glong) _tmp86_);
 
4797
                                _tmp89_ = chess_state_decode_piece_type (self, (gunichar) _tmp87_, &_tmp88_);
 
4798
                                _vala_promotion_type = _tmp88_;
 
4799
                                if (_tmp89_) {
 
4800
                                        gint _tmp90_ = 0;
 
4801
                                        _tmp90_ = i;
 
4802
                                        i = _tmp90_ + 1;
 
4803
                                }
4982
4804
                        } else {
4983
 
                                _tmp73_ = FALSE;
4984
 
                        }
4985
 
                        _tmp80_ = _tmp73_;
4986
 
                        if (_tmp80_) {
4987
 
                                gint _tmp81_;
4988
 
                                const gchar* _tmp82_;
4989
 
                                gint _tmp83_;
4990
 
                                gchar _tmp84_ = '\0';
4991
 
                                gint _tmp85_;
4992
 
                                _tmp81_ = _vala_r1;
4993
 
                                _vala_r0 = _tmp81_;
4994
 
                                _tmp82_ = move;
4995
 
                                _tmp83_ = i;
4996
 
                                _tmp84_ = string_get (_tmp82_, (glong) _tmp83_);
4997
 
                                _vala_r1 = (gint) (_tmp84_ - '1');
4998
 
                                _tmp85_ = i;
4999
 
                                i = _tmp85_ + 1;
5000
 
                        }
5001
 
                        _tmp86_ = move;
5002
 
                        _tmp87_ = i;
5003
 
                        _tmp88_ = string_get (_tmp86_, (glong) _tmp87_);
5004
 
                        if (_tmp88_ == '=') {
5005
 
                                gint _tmp89_;
5006
 
                                const gchar* _tmp90_;
5007
 
                                gint _tmp91_;
5008
 
                                gchar _tmp92_ = '\0';
5009
 
                                PieceType _tmp93_ = 0;
5010
 
                                gboolean _tmp94_ = FALSE;
5011
 
                                _tmp89_ = i;
5012
 
                                i = _tmp89_ + 1;
5013
 
                                _tmp90_ = move;
5014
 
                                _tmp91_ = i;
5015
 
                                _tmp92_ = string_get (_tmp90_, (glong) _tmp91_);
5016
 
                                _tmp94_ = chess_state_decode_piece_type (self, (gunichar) _tmp92_, &_tmp93_);
5017
 
                                _vala_promotion_type = _tmp93_;
5018
 
                                if (_tmp94_) {
5019
 
                                        gint _tmp95_;
 
4805
                                const gchar* _tmp91_ = NULL;
 
4806
                                gint _tmp92_ = 0;
 
4807
                                gchar _tmp93_ = '\0';
 
4808
                                _tmp91_ = move;
 
4809
                                _tmp92_ = i;
 
4810
                                _tmp93_ = string_get (_tmp91_, (glong) _tmp92_);
 
4811
                                if (_tmp93_ != '\0') {
 
4812
                                        const gchar* _tmp94_ = NULL;
 
4813
                                        gint _tmp95_ = 0;
 
4814
                                        gchar _tmp96_ = '\0';
 
4815
                                        _tmp94_ = move;
5020
4816
                                        _tmp95_ = i;
5021
 
                                        i = _tmp95_ + 1;
5022
 
                                }
5023
 
                        } else {
5024
 
                                const gchar* _tmp96_;
5025
 
                                gint _tmp97_;
5026
 
                                gchar _tmp98_ = '\0';
5027
 
                                _tmp96_ = move;
5028
 
                                _tmp97_ = i;
5029
 
                                _tmp98_ = string_get (_tmp96_, (glong) _tmp97_);
5030
 
                                if (_tmp98_ != '\0') {
5031
 
                                        const gchar* _tmp99_;
5032
 
                                        gint _tmp100_;
5033
 
                                        gchar _tmp101_ = '\0';
5034
 
                                        _tmp99_ = move;
5035
 
                                        _tmp100_ = i;
5036
 
                                        _tmp101_ = string_get (_tmp99_, (glong) _tmp100_);
5037
 
                                        switch (_tmp101_) {
 
4817
                                        _tmp96_ = string_get (_tmp94_, (glong) _tmp95_);
 
4818
                                        switch (_tmp96_) {
5038
4819
                                                case 'q':
5039
4820
                                                case 'Q':
5040
4821
                                                {
5041
 
                                                        gint _tmp102_;
 
4822
                                                        gint _tmp97_ = 0;
5042
4823
                                                        _vala_promotion_type = PIECE_TYPE_QUEEN;
5043
 
                                                        _tmp102_ = i;
5044
 
                                                        i = _tmp102_ + 1;
 
4824
                                                        _tmp97_ = i;
 
4825
                                                        i = _tmp97_ + 1;
5045
4826
                                                        break;
5046
4827
                                                }
5047
4828
                                                case 'n':
5048
4829
                                                case 'N':
5049
4830
                                                {
5050
 
                                                        gint _tmp103_;
 
4831
                                                        gint _tmp98_ = 0;
5051
4832
                                                        _vala_promotion_type = PIECE_TYPE_KNIGHT;
5052
 
                                                        _tmp103_ = i;
5053
 
                                                        i = _tmp103_ + 1;
 
4833
                                                        _tmp98_ = i;
 
4834
                                                        i = _tmp98_ + 1;
5054
4835
                                                        break;
5055
4836
                                                }
5056
4837
                                                case 'r':
5057
4838
                                                case 'R':
5058
4839
                                                {
5059
 
                                                        gint _tmp104_;
 
4840
                                                        gint _tmp99_ = 0;
5060
4841
                                                        _vala_promotion_type = PIECE_TYPE_ROOK;
5061
 
                                                        _tmp104_ = i;
5062
 
                                                        i = _tmp104_ + 1;
 
4842
                                                        _tmp99_ = i;
 
4843
                                                        i = _tmp99_ + 1;
5063
4844
                                                        break;
5064
4845
                                                }
5065
4846
                                                case 'b':
5066
4847
                                                case 'B':
5067
4848
                                                {
5068
 
                                                        gint _tmp105_;
 
4849
                                                        gint _tmp100_ = 0;
5069
4850
                                                        _vala_promotion_type = PIECE_TYPE_BISHOP;
5070
 
                                                        _tmp105_ = i;
5071
 
                                                        i = _tmp105_ + 1;
 
4851
                                                        _tmp100_ = i;
 
4852
                                                        i = _tmp100_ + 1;
5072
4853
                                                        break;
5073
4854
                                                }
5074
4855
                                                default:
5076
4857
                                        }
5077
4858
                                }
5078
4859
                        }
5079
 
                        _tmp107_ = _vala_r1;
5080
 
                        if (_tmp107_ < 0) {
5081
 
                                _tmp106_ = TRUE;
 
4860
                        _tmp102_ = _vala_r1;
 
4861
                        if (_tmp102_ < 0) {
 
4862
                                _tmp101_ = TRUE;
5082
4863
                        } else {
5083
 
                                gint _tmp108_;
5084
 
                                _tmp108_ = _vala_f1;
5085
 
                                _tmp106_ = _tmp108_ < 0;
 
4864
                                gint _tmp103_ = 0;
 
4865
                                _tmp103_ = _vala_f1;
 
4866
                                _tmp101_ = _tmp103_ < 0;
5086
4867
                        }
5087
 
                        _tmp109_ = _tmp106_;
5088
 
                        if (_tmp109_) {
5089
 
                                const gchar* _tmp110_;
5090
 
                                _tmp110_ = move;
5091
 
                                g_debug ("chess-game.vala:1138: Move %s missing destination", _tmp110_);
 
4868
                        if (_tmp101_) {
 
4869
                                const gchar* _tmp104_ = NULL;
 
4870
                                _tmp104_ = move;
 
4871
                                g_debug ("chess-game.vala:1179: Move %s missing destination", _tmp104_);
5092
4872
                                result = FALSE;
5093
4873
                                if (r0) {
5094
4874
                                        *r0 = _vala_r0;
5107
4887
                                }
5108
4888
                                return result;
5109
4889
                        }
5110
 
                        _tmp112_ = _vala_r0;
5111
 
                        if (_tmp112_ < 0) {
5112
 
                                _tmp111_ = TRUE;
 
4890
                        _tmp106_ = _vala_r0;
 
4891
                        if (_tmp106_ < 0) {
 
4892
                                _tmp105_ = TRUE;
5113
4893
                        } else {
5114
 
                                gint _tmp113_;
5115
 
                                _tmp113_ = _vala_f0;
5116
 
                                _tmp111_ = _tmp113_ < 0;
 
4894
                                gint _tmp107_ = 0;
 
4895
                                _tmp107_ = _vala_f0;
 
4896
                                _tmp105_ = _tmp107_ < 0;
5117
4897
                        }
5118
 
                        _tmp114_ = _tmp111_;
5119
 
                        if (_tmp114_) {
5120
 
                                gint match_rank;
5121
 
                                gint match_file;
5122
 
                                gint _tmp159_;
5123
 
                                gint _tmp161_;
5124
 
                                gint _tmp162_;
 
4898
                        if (_tmp105_) {
 
4899
                                gint match_rank = 0;
 
4900
                                gint match_file = 0;
 
4901
                                gint _tmp146_ = 0;
 
4902
                                gint _tmp148_ = 0;
 
4903
                                gint _tmp149_ = 0;
5125
4904
                                match_rank = -1;
5126
4905
                                match_file = -1;
5127
4906
                                {
5128
 
                                        gint file;
 
4907
                                        gint file = 0;
5129
4908
                                        file = 0;
5130
4909
                                        {
5131
 
                                                gboolean _tmp115_;
5132
 
                                                _tmp115_ = TRUE;
 
4910
                                                gboolean _tmp108_ = FALSE;
 
4911
                                                _tmp108_ = TRUE;
5133
4912
                                                while (TRUE) {
5134
 
                                                        gboolean _tmp116_;
5135
 
                                                        gint _tmp118_;
5136
 
                                                        gboolean _tmp119_ = FALSE;
5137
 
                                                        gint _tmp120_;
5138
 
                                                        gboolean _tmp123_;
5139
 
                                                        _tmp116_ = _tmp115_;
5140
 
                                                        if (!_tmp116_) {
5141
 
                                                                gint _tmp117_;
5142
 
                                                                _tmp117_ = file;
5143
 
                                                                file = _tmp117_ + 1;
 
4913
                                                        gint _tmp110_ = 0;
 
4914
                                                        gboolean _tmp111_ = FALSE;
 
4915
                                                        gint _tmp112_ = 0;
 
4916
                                                        if (!_tmp108_) {
 
4917
                                                                gint _tmp109_ = 0;
 
4918
                                                                _tmp109_ = file;
 
4919
                                                                file = _tmp109_ + 1;
5144
4920
                                                        }
5145
 
                                                        _tmp115_ = FALSE;
5146
 
                                                        _tmp118_ = file;
5147
 
                                                        if (!(_tmp118_ < 8)) {
 
4921
                                                        _tmp108_ = FALSE;
 
4922
                                                        _tmp110_ = file;
 
4923
                                                        if (!(_tmp110_ < 8)) {
5148
4924
                                                                break;
5149
4925
                                                        }
5150
 
                                                        _tmp120_ = _vala_f0;
5151
 
                                                        if (_tmp120_ >= 0) {
5152
 
                                                                gint _tmp121_;
5153
 
                                                                gint _tmp122_;
5154
 
                                                                _tmp121_ = file;
5155
 
                                                                _tmp122_ = _vala_f0;
5156
 
                                                                _tmp119_ = _tmp121_ != _tmp122_;
 
4926
                                                        _tmp112_ = _vala_f0;
 
4927
                                                        if (_tmp112_ >= 0) {
 
4928
                                                                gint _tmp113_ = 0;
 
4929
                                                                gint _tmp114_ = 0;
 
4930
                                                                _tmp113_ = file;
 
4931
                                                                _tmp114_ = _vala_f0;
 
4932
                                                                _tmp111_ = _tmp113_ != _tmp114_;
5157
4933
                                                        } else {
5158
 
                                                                _tmp119_ = FALSE;
 
4934
                                                                _tmp111_ = FALSE;
5159
4935
                                                        }
5160
 
                                                        _tmp123_ = _tmp119_;
5161
 
                                                        if (_tmp123_) {
 
4936
                                                        if (_tmp111_) {
5162
4937
                                                                continue;
5163
4938
                                                        }
5164
4939
                                                        {
5165
 
                                                                gint rank;
 
4940
                                                                gint rank = 0;
5166
4941
                                                                rank = 0;
5167
4942
                                                                {
5168
 
                                                                        gboolean _tmp124_;
5169
 
                                                                        _tmp124_ = TRUE;
 
4943
                                                                        gboolean _tmp115_ = FALSE;
 
4944
                                                                        _tmp115_ = TRUE;
5170
4945
                                                                        while (TRUE) {
5171
 
                                                                                gboolean _tmp125_;
5172
 
                                                                                gint _tmp127_;
 
4946
                                                                                gint _tmp117_ = 0;
 
4947
                                                                                gboolean _tmp118_ = FALSE;
 
4948
                                                                                gint _tmp119_ = 0;
 
4949
                                                                                ChessPiece* piece = NULL;
 
4950
                                                                                gint _tmp122_ = 0;
 
4951
                                                                                gint _tmp123_ = 0;
 
4952
                                                                                gint _tmp124_ = 0;
 
4953
                                                                                ChessPiece* _tmp125_ = NULL;
 
4954
                                                                                ChessPiece* _tmp126_ = NULL;
 
4955
                                                                                gboolean _tmp127_ = FALSE;
5173
4956
                                                                                gboolean _tmp128_ = FALSE;
5174
 
                                                                                gint _tmp129_;
5175
 
                                                                                gboolean _tmp132_;
5176
 
                                                                                gint _tmp133_;
5177
 
                                                                                gint _tmp134_;
5178
 
                                                                                gint _tmp135_ = 0;
5179
 
                                                                                ChessPiece* _tmp136_;
5180
 
                                                                                ChessPiece* _tmp137_;
5181
 
                                                                                ChessPiece* piece;
5182
 
                                                                                gboolean _tmp138_ = FALSE;
5183
 
                                                                                gboolean _tmp139_ = FALSE;
5184
 
                                                                                ChessPiece* _tmp140_;
5185
 
                                                                                gboolean _tmp144_;
5186
 
                                                                                gboolean _tmp148_;
5187
 
                                                                                ChessPlayer* _tmp149_;
5188
 
                                                                                gint _tmp150_;
5189
 
                                                                                gint _tmp151_;
5190
 
                                                                                gint _tmp152_;
5191
 
                                                                                gint _tmp153_;
5192
 
                                                                                gboolean _tmp154_ = FALSE;
5193
 
                                                                                gint _tmp155_;
5194
 
                                                                                gint _tmp157_;
5195
 
                                                                                gint _tmp158_;
5196
 
                                                                                _tmp125_ = _tmp124_;
5197
 
                                                                                if (!_tmp125_) {
5198
 
                                                                                        gint _tmp126_;
5199
 
                                                                                        _tmp126_ = rank;
5200
 
                                                                                        rank = _tmp126_ + 1;
 
4957
                                                                                ChessPiece* _tmp129_ = NULL;
 
4958
                                                                                ChessPlayer* _tmp136_ = NULL;
 
4959
                                                                                gint _tmp137_ = 0;
 
4960
                                                                                gint _tmp138_ = 0;
 
4961
                                                                                gint _tmp139_ = 0;
 
4962
                                                                                gint _tmp140_ = 0;
 
4963
                                                                                gboolean _tmp141_ = FALSE;
 
4964
                                                                                gint _tmp142_ = 0;
 
4965
                                                                                gint _tmp144_ = 0;
 
4966
                                                                                gint _tmp145_ = 0;
 
4967
                                                                                if (!_tmp115_) {
 
4968
                                                                                        gint _tmp116_ = 0;
 
4969
                                                                                        _tmp116_ = rank;
 
4970
                                                                                        rank = _tmp116_ + 1;
5201
4971
                                                                                }
5202
 
                                                                                _tmp124_ = FALSE;
5203
 
                                                                                _tmp127_ = rank;
5204
 
                                                                                if (!(_tmp127_ < 8)) {
 
4972
                                                                                _tmp115_ = FALSE;
 
4973
                                                                                _tmp117_ = rank;
 
4974
                                                                                if (!(_tmp117_ < 8)) {
5205
4975
                                                                                        break;
5206
4976
                                                                                }
5207
 
                                                                                _tmp129_ = _vala_r0;
5208
 
                                                                                if (_tmp129_ >= 0) {
5209
 
                                                                                        gint _tmp130_;
5210
 
                                                                                        gint _tmp131_;
5211
 
                                                                                        _tmp130_ = rank;
5212
 
                                                                                        _tmp131_ = _vala_r0;
5213
 
                                                                                        _tmp128_ = _tmp130_ != _tmp131_;
5214
 
                                                                                } else {
5215
 
                                                                                        _tmp128_ = FALSE;
5216
 
                                                                                }
5217
 
                                                                                _tmp132_ = _tmp128_;
5218
 
                                                                                if (_tmp132_) {
5219
 
                                                                                        continue;
5220
 
                                                                                }
5221
 
                                                                                _tmp133_ = rank;
5222
 
                                                                                _tmp134_ = file;
5223
 
                                                                                _tmp135_ = chess_state_get_index (self, _tmp133_, _tmp134_);
5224
 
                                                                                _tmp136_ = self->board[_tmp135_];
5225
 
                                                                                _tmp137_ = _chess_piece_ref0 (_tmp136_);
5226
 
                                                                                piece = _tmp137_;
5227
 
                                                                                _tmp140_ = piece;
5228
 
                                                                                if (_tmp140_ == NULL) {
5229
 
                                                                                        _tmp139_ = TRUE;
5230
 
                                                                                } else {
5231
 
                                                                                        ChessPiece* _tmp141_;
5232
 
                                                                                        PieceType _tmp142_;
5233
 
                                                                                        PieceType _tmp143_;
5234
 
                                                                                        _tmp141_ = piece;
5235
 
                                                                                        _tmp142_ = _tmp141_->type;
5236
 
                                                                                        _tmp143_ = type;
5237
 
                                                                                        _tmp139_ = _tmp142_ != _tmp143_;
5238
 
                                                                                }
5239
 
                                                                                _tmp144_ = _tmp139_;
5240
 
                                                                                if (_tmp144_) {
5241
 
                                                                                        _tmp138_ = TRUE;
5242
 
                                                                                } else {
5243
 
                                                                                        ChessPiece* _tmp145_;
5244
 
                                                                                        ChessPlayer* _tmp146_;
5245
 
                                                                                        ChessPlayer* _tmp147_;
5246
 
                                                                                        _tmp145_ = piece;
5247
 
                                                                                        _tmp146_ = _tmp145_->player;
5248
 
                                                                                        _tmp147_ = player;
5249
 
                                                                                        _tmp138_ = _tmp146_ != _tmp147_;
5250
 
                                                                                }
5251
 
                                                                                _tmp148_ = _tmp138_;
5252
 
                                                                                if (_tmp148_) {
5253
 
                                                                                        _chess_piece_unref0 (piece);
5254
 
                                                                                        continue;
5255
 
                                                                                }
5256
 
                                                                                _tmp149_ = player;
5257
 
                                                                                _tmp150_ = rank;
5258
 
                                                                                _tmp151_ = file;
5259
 
                                                                                _tmp152_ = _vala_r1;
5260
 
                                                                                _tmp153_ = _vala_f1;
5261
 
                                                                                _tmp154_ = chess_state_move_with_coords (self, _tmp149_, _tmp150_, _tmp151_, _tmp152_, _tmp153_, PIECE_TYPE_QUEEN, FALSE, TRUE);
5262
 
                                                                                if (!_tmp154_) {
5263
 
                                                                                        _chess_piece_unref0 (piece);
5264
 
                                                                                        continue;
5265
 
                                                                                }
5266
 
                                                                                _tmp155_ = match_rank;
5267
 
                                                                                if (_tmp155_ >= 0) {
5268
 
                                                                                        const gchar* _tmp156_;
5269
 
                                                                                        _tmp156_ = move;
5270
 
                                                                                        g_debug ("chess-game.vala:1169: Move %s is ambiguous", _tmp156_);
 
4977
                                                                                _tmp119_ = _vala_r0;
 
4978
                                                                                if (_tmp119_ >= 0) {
 
4979
                                                                                        gint _tmp120_ = 0;
 
4980
                                                                                        gint _tmp121_ = 0;
 
4981
                                                                                        _tmp120_ = rank;
 
4982
                                                                                        _tmp121_ = _vala_r0;
 
4983
                                                                                        _tmp118_ = _tmp120_ != _tmp121_;
 
4984
                                                                                } else {
 
4985
                                                                                        _tmp118_ = FALSE;
 
4986
                                                                                }
 
4987
                                                                                if (_tmp118_) {
 
4988
                                                                                        continue;
 
4989
                                                                                }
 
4990
                                                                                _tmp122_ = rank;
 
4991
                                                                                _tmp123_ = file;
 
4992
                                                                                _tmp124_ = chess_state_get_index (self, _tmp122_, _tmp123_);
 
4993
                                                                                _tmp125_ = self->board[_tmp124_];
 
4994
                                                                                _tmp126_ = _chess_piece_ref0 (_tmp125_);
 
4995
                                                                                piece = _tmp126_;
 
4996
                                                                                _tmp129_ = piece;
 
4997
                                                                                if (_tmp129_ == NULL) {
 
4998
                                                                                        _tmp128_ = TRUE;
 
4999
                                                                                } else {
 
5000
                                                                                        ChessPiece* _tmp130_ = NULL;
 
5001
                                                                                        PieceType _tmp131_ = 0;
 
5002
                                                                                        PieceType _tmp132_ = 0;
 
5003
                                                                                        _tmp130_ = piece;
 
5004
                                                                                        _tmp131_ = _tmp130_->type;
 
5005
                                                                                        _tmp132_ = type;
 
5006
                                                                                        _tmp128_ = _tmp131_ != _tmp132_;
 
5007
                                                                                }
 
5008
                                                                                if (_tmp128_) {
 
5009
                                                                                        _tmp127_ = TRUE;
 
5010
                                                                                } else {
 
5011
                                                                                        ChessPiece* _tmp133_ = NULL;
 
5012
                                                                                        ChessPlayer* _tmp134_ = NULL;
 
5013
                                                                                        ChessPlayer* _tmp135_ = NULL;
 
5014
                                                                                        _tmp133_ = piece;
 
5015
                                                                                        _tmp134_ = _tmp133_->player;
 
5016
                                                                                        _tmp135_ = player;
 
5017
                                                                                        _tmp127_ = _tmp134_ != _tmp135_;
 
5018
                                                                                }
 
5019
                                                                                if (_tmp127_) {
 
5020
                                                                                        _chess_piece_unref0 (piece);
 
5021
                                                                                        continue;
 
5022
                                                                                }
 
5023
                                                                                _tmp136_ = player;
 
5024
                                                                                _tmp137_ = rank;
 
5025
                                                                                _tmp138_ = file;
 
5026
                                                                                _tmp139_ = _vala_r1;
 
5027
                                                                                _tmp140_ = _vala_f1;
 
5028
                                                                                _tmp141_ = chess_state_move_with_coords (self, _tmp136_, _tmp137_, _tmp138_, _tmp139_, _tmp140_, PIECE_TYPE_QUEEN, FALSE, TRUE);
 
5029
                                                                                if (!_tmp141_) {
 
5030
                                                                                        _chess_piece_unref0 (piece);
 
5031
                                                                                        continue;
 
5032
                                                                                }
 
5033
                                                                                _tmp142_ = match_rank;
 
5034
                                                                                if (_tmp142_ >= 0) {
 
5035
                                                                                        const gchar* _tmp143_ = NULL;
 
5036
                                                                                        _tmp143_ = move;
 
5037
                                                                                        g_debug ("chess-game.vala:1210: Move %s is ambiguous", _tmp143_);
5271
5038
                                                                                        result = FALSE;
5272
5039
                                                                                        _chess_piece_unref0 (piece);
5273
5040
                                                                                        if (r0) {
5287
5054
                                                                                        }
5288
5055
                                                                                        return result;
5289
5056
                                                                                }
5290
 
                                                                                _tmp157_ = rank;
5291
 
                                                                                match_rank = _tmp157_;
5292
 
                                                                                _tmp158_ = file;
5293
 
                                                                                match_file = _tmp158_;
 
5057
                                                                                _tmp144_ = rank;
 
5058
                                                                                match_rank = _tmp144_;
 
5059
                                                                                _tmp145_ = file;
 
5060
                                                                                match_file = _tmp145_;
5294
5061
                                                                                _chess_piece_unref0 (piece);
5295
5062
                                                                        }
5296
5063
                                                                }
5298
5065
                                                }
5299
5066
                                        }
5300
5067
                                }
5301
 
                                _tmp159_ = match_rank;
5302
 
                                if (_tmp159_ < 0) {
5303
 
                                        const gchar* _tmp160_;
5304
 
                                        _tmp160_ = move;
5305
 
                                        g_debug ("chess-game.vala:1180: Move %s has no matches", _tmp160_);
 
5068
                                _tmp146_ = match_rank;
 
5069
                                if (_tmp146_ < 0) {
 
5070
                                        const gchar* _tmp147_ = NULL;
 
5071
                                        _tmp147_ = move;
 
5072
                                        g_debug ("chess-game.vala:1221: Move %s has no matches", _tmp147_);
5306
5073
                                        result = FALSE;
5307
5074
                                        if (r0) {
5308
5075
                                                *r0 = _vala_r0;
5321
5088
                                        }
5322
5089
                                        return result;
5323
5090
                                }
5324
 
                                _tmp161_ = match_rank;
5325
 
                                _vala_r0 = _tmp161_;
5326
 
                                _tmp162_ = match_file;
5327
 
                                _vala_f0 = _tmp162_;
 
5091
                                _tmp148_ = match_rank;
 
5092
                                _vala_r0 = _tmp148_;
 
5093
                                _tmp149_ = match_file;
 
5094
                                _vala_f0 = _tmp149_;
5328
5095
                        }
5329
5096
                }
5330
5097
        }
5331
 
        _tmp163_ = move;
5332
 
        _tmp164_ = i;
5333
 
        _tmp165_ = string_get (_tmp163_, (glong) _tmp164_);
5334
 
        if (_tmp165_ == '+') {
5335
 
                gint _tmp166_;
5336
 
                _tmp166_ = i;
5337
 
                i = _tmp166_ + 1;
 
5098
        _tmp150_ = move;
 
5099
        _tmp151_ = i;
 
5100
        _tmp152_ = string_get (_tmp150_, (glong) _tmp151_);
 
5101
        if (_tmp152_ == '+') {
 
5102
                gint _tmp153_ = 0;
 
5103
                _tmp153_ = i;
 
5104
                i = _tmp153_ + 1;
5338
5105
        } else {
5339
 
                const gchar* _tmp167_;
5340
 
                gint _tmp168_;
5341
 
                gchar _tmp169_ = '\0';
5342
 
                _tmp167_ = move;
5343
 
                _tmp168_ = i;
5344
 
                _tmp169_ = string_get (_tmp167_, (glong) _tmp168_);
5345
 
                if (_tmp169_ == '#') {
5346
 
                        gint _tmp170_;
5347
 
                        _tmp170_ = i;
5348
 
                        i = _tmp170_ + 1;
 
5106
                const gchar* _tmp154_ = NULL;
 
5107
                gint _tmp155_ = 0;
 
5108
                gchar _tmp156_ = '\0';
 
5109
                _tmp154_ = move;
 
5110
                _tmp155_ = i;
 
5111
                _tmp156_ = string_get (_tmp154_, (glong) _tmp155_);
 
5112
                if (_tmp156_ == '#') {
 
5113
                        gint _tmp157_ = 0;
 
5114
                        _tmp157_ = i;
 
5115
                        i = _tmp157_ + 1;
5349
5116
                }
5350
5117
        }
5351
 
        _tmp171_ = move;
5352
 
        _tmp172_ = i;
5353
 
        _tmp173_ = string_get (_tmp171_, (glong) _tmp172_);
5354
 
        if (_tmp173_ != '\0') {
5355
 
                const gchar* _tmp174_;
5356
 
                _tmp174_ = move;
5357
 
                g_debug ("chess-game.vala:1196: Move %s has unexpected characters", _tmp174_);
 
5118
        _tmp158_ = move;
 
5119
        _tmp159_ = i;
 
5120
        _tmp160_ = string_get (_tmp158_, (glong) _tmp159_);
 
5121
        if (_tmp160_ != '\0') {
 
5122
                const gchar* _tmp161_ = NULL;
 
5123
                _tmp161_ = move;
 
5124
                g_debug ("chess-game.vala:1237: Move %s has unexpected characters", _tmp161_);
5358
5125
                result = FALSE;
5359
5126
                if (r0) {
5360
5127
                        *r0 = _vala_r0;
5396
5163
ChessPlayer* chess_state_get_opponent (ChessState* self) {
5397
5164
        ChessPlayer* result;
5398
5165
        ChessPlayer* _tmp0_ = NULL;
5399
 
        ChessPlayer* _tmp1_;
5400
 
        Color _tmp2_;
5401
 
        ChessPlayer* _tmp5_;
 
5166
        ChessPlayer* _tmp1_ = NULL;
 
5167
        Color _tmp2_ = 0;
5402
5168
        g_return_val_if_fail (self != NULL, NULL);
5403
5169
        _tmp1_ = self->current_player;
5404
5170
        _tmp2_ = _tmp1_->color;
5405
5171
        if (_tmp2_ == COLOR_WHITE) {
5406
 
                ChessPlayer* _tmp3_;
 
5172
                ChessPlayer* _tmp3_ = NULL;
5407
5173
                _tmp3_ = self->players[COLOR_BLACK];
5408
5174
                _tmp0_ = _tmp3_;
5409
5175
        } else {
5410
 
                ChessPlayer* _tmp4_;
 
5176
                ChessPlayer* _tmp4_ = NULL;
5411
5177
                _tmp4_ = self->players[COLOR_WHITE];
5412
5178
                _tmp0_ = _tmp4_;
5413
5179
        }
5414
 
        _tmp5_ = _tmp0_;
5415
 
        result = _tmp5_;
 
5180
        result = _tmp0_;
5416
5181
        return result;
5417
5182
}
5418
5183
 
5588
5353
GType chess_result_get_type (void) {
5589
5354
        static volatile gsize chess_result_type_id__volatile = 0;
5590
5355
        if (g_once_init_enter (&chess_result_type_id__volatile)) {
5591
 
                static const GEnumValue values[] = {{CHESS_RESULT_IN_PROGRESS, "CHESS_RESULT_IN_PROGRESS", "in-progress"}, {CHESS_RESULT_WHITE_WON, "CHESS_RESULT_WHITE_WON", "white-won"}, {CHESS_RESULT_BLACK_WON, "CHESS_RESULT_BLACK_WON", "black-won"}, {CHESS_RESULT_DRAW, "CHESS_RESULT_DRAW", "draw"}, {0, NULL, NULL}};
 
5356
                static const GEnumValue values[] = {{CHESS_RESULT_IN_PROGRESS, "CHESS_RESULT_IN_PROGRESS", "in-progress"}, {CHESS_RESULT_WHITE_WON, "CHESS_RESULT_WHITE_WON", "white-won"}, {CHESS_RESULT_BLACK_WON, "CHESS_RESULT_BLACK_WON", "black-won"}, {CHESS_RESULT_DRAW, "CHESS_RESULT_DRAW", "draw"}, {CHESS_RESULT_BUG, "CHESS_RESULT_BUG", "bug"}, {0, NULL, NULL}};
5592
5357
                GType chess_result_type_id;
5593
5358
                chess_result_type_id = g_enum_register_static ("ChessResult", values);
5594
5359
                g_once_init_leave (&chess_result_type_id__volatile, chess_result_type_id);
5600
5365
GType chess_rule_get_type (void) {
5601
5366
        static volatile gsize chess_rule_type_id__volatile = 0;
5602
5367
        if (g_once_init_enter (&chess_rule_type_id__volatile)) {
5603
 
                static const GEnumValue values[] = {{CHESS_RULE_CHECKMATE, "CHESS_RULE_CHECKMATE", "checkmate"}, {CHESS_RULE_STALEMATE, "CHESS_RULE_STALEMATE", "stalemate"}, {CHESS_RULE_FIFTY_MOVES, "CHESS_RULE_FIFTY_MOVES", "fifty-moves"}, {CHESS_RULE_TIMEOUT, "CHESS_RULE_TIMEOUT", "timeout"}, {CHESS_RULE_THREE_FOLD_REPETITION, "CHESS_RULE_THREE_FOLD_REPETITION", "three-fold-repetition"}, {CHESS_RULE_INSUFFICIENT_MATERIAL, "CHESS_RULE_INSUFFICIENT_MATERIAL", "insufficient-material"}, {CHESS_RULE_RESIGN, "CHESS_RULE_RESIGN", "resign"}, {CHESS_RULE_ABANDONMENT, "CHESS_RULE_ABANDONMENT", "abandonment"}, {CHESS_RULE_DEATH, "CHESS_RULE_DEATH", "death"}, {0, NULL, NULL}};
 
5368
                static const GEnumValue values[] = {{CHESS_RULE_CHECKMATE, "CHESS_RULE_CHECKMATE", "checkmate"}, {CHESS_RULE_STALEMATE, "CHESS_RULE_STALEMATE", "stalemate"}, {CHESS_RULE_FIFTY_MOVES, "CHESS_RULE_FIFTY_MOVES", "fifty-moves"}, {CHESS_RULE_TIMEOUT, "CHESS_RULE_TIMEOUT", "timeout"}, {CHESS_RULE_THREE_FOLD_REPETITION, "CHESS_RULE_THREE_FOLD_REPETITION", "three-fold-repetition"}, {CHESS_RULE_INSUFFICIENT_MATERIAL, "CHESS_RULE_INSUFFICIENT_MATERIAL", "insufficient-material"}, {CHESS_RULE_RESIGN, "CHESS_RULE_RESIGN", "resign"}, {CHESS_RULE_ABANDONMENT, "CHESS_RULE_ABANDONMENT", "abandonment"}, {CHESS_RULE_DEATH, "CHESS_RULE_DEATH", "death"}, {CHESS_RULE_BUG, "CHESS_RULE_BUG", "bug"}, {0, NULL, NULL}};
5604
5369
                GType chess_rule_type_id;
5605
5370
                chess_rule_type_id = g_enum_register_static ("ChessRule", values);
5606
5371
                g_once_init_leave (&chess_rule_type_id__volatile, chess_rule_type_id);
5622
5387
 
5623
5388
static gboolean _chess_game_move_cb_chess_player_do_move (ChessPlayer* _sender, const gchar* move, gboolean apply, gpointer self) {
5624
5389
        gboolean result;
5625
 
        result = chess_game_move_cb (self, _sender, move, apply);
 
5390
        result = chess_game_move_cb ((ChessGame*) self, _sender, move, apply);
5626
5391
        return result;
5627
5392
}
5628
5393
 
5629
5394
 
5630
5395
static void _chess_game_undo_cb_chess_player_do_undo (ChessPlayer* _sender, gpointer self) {
5631
 
        chess_game_undo_cb (self, _sender);
 
5396
        chess_game_undo_cb ((ChessGame*) self, _sender);
5632
5397
}
5633
5398
 
5634
5399
 
5635
5400
static gboolean _chess_game_resign_cb_chess_player_do_resign (ChessPlayer* _sender, gpointer self) {
5636
5401
        gboolean result;
5637
 
        result = chess_game_resign_cb (self, _sender);
 
5402
        result = chess_game_resign_cb ((ChessGame*) self, _sender);
5638
5403
        return result;
5639
5404
}
5640
5405
 
5641
5406
 
5642
5407
static gboolean _chess_game_claim_draw_cb_chess_player_do_claim_draw (ChessPlayer* _sender, gpointer self) {
5643
5408
        gboolean result;
5644
 
        result = chess_game_claim_draw_cb (self, _sender);
 
5409
        result = chess_game_claim_draw_cb ((ChessGame*) self, _sender);
5645
5410
        return result;
5646
5411
}
5647
5412
 
5648
5413
 
5649
5414
ChessGame* chess_game_construct (GType object_type, const gchar* fen, gchar** moves, int moves_length1) {
5650
 
        ChessGame* self = NULL;
5651
 
        const gchar* _tmp0_;
5652
 
        ChessState* _tmp1_;
5653
 
        gchar** _tmp2_;
5654
 
        gint _tmp2__length1;
5655
 
        ChessPlayer* _tmp17_;
5656
 
        ChessPlayer* _tmp18_;
5657
 
        ChessPlayer* _tmp19_;
5658
 
        ChessPlayer* _tmp20_;
5659
 
        ChessPlayer* _tmp21_;
5660
 
        ChessPlayer* _tmp22_;
5661
 
        ChessPlayer* _tmp23_;
5662
 
        ChessPlayer* _tmp24_;
5663
 
        ChessPlayer* _tmp25_;
5664
 
        ChessPlayer* _tmp26_;
5665
 
        ChessPlayer* _tmp27_;
5666
 
        ChessPlayer* _tmp28_;
5667
 
        ChessPlayer* _tmp29_;
5668
 
        ChessPlayer* _tmp30_;
5669
 
        ChessPlayer* _tmp31_;
5670
 
        ChessPlayer* _tmp32_;
 
5415
        ChessGame * self = NULL;
 
5416
        const gchar* _tmp0_ = NULL;
 
5417
        ChessState* _tmp1_ = NULL;
 
5418
        gchar** _tmp2_ = NULL;
 
5419
        gint _tmp2__length1 = 0;
 
5420
        ChessPlayer* _tmp16_ = NULL;
 
5421
        ChessPlayer* _tmp17_ = NULL;
 
5422
        ChessPlayer* _tmp18_ = NULL;
 
5423
        ChessPlayer* _tmp19_ = NULL;
 
5424
        ChessPlayer* _tmp20_ = NULL;
 
5425
        ChessPlayer* _tmp21_ = NULL;
 
5426
        ChessPlayer* _tmp22_ = NULL;
 
5427
        ChessPlayer* _tmp23_ = NULL;
 
5428
        ChessPlayer* _tmp24_ = NULL;
 
5429
        ChessPlayer* _tmp25_ = NULL;
 
5430
        ChessPlayer* _tmp26_ = NULL;
 
5431
        ChessPlayer* _tmp27_ = NULL;
 
5432
        ChessPlayer* _tmp28_ = NULL;
 
5433
        ChessPlayer* _tmp29_ = NULL;
 
5434
        ChessPlayer* _tmp30_ = NULL;
 
5435
        ChessPlayer* _tmp31_ = NULL;
5671
5436
        g_return_val_if_fail (fen != NULL, NULL);
5672
 
        self = (ChessGame*) g_type_create_instance (object_type);
 
5437
        self = (ChessGame*) g_object_new (object_type, NULL);
5673
5438
        self->is_started = FALSE;
5674
5439
        _tmp0_ = fen;
5675
5440
        _tmp1_ = chess_state_new (_tmp0_);
5679
5444
        _tmp2__length1 = moves_length1;
5680
5445
        if (_tmp2_ != NULL) {
5681
5446
                {
5682
 
                        gint i;
 
5447
                        gint i = 0;
5683
5448
                        i = 0;
5684
5449
                        {
5685
 
                                gboolean _tmp3_;
 
5450
                                gboolean _tmp3_ = FALSE;
5686
5451
                                _tmp3_ = TRUE;
5687
5452
                                while (TRUE) {
5688
 
                                        gboolean _tmp4_;
5689
 
                                        gint _tmp6_;
5690
 
                                        gchar** _tmp7_;
5691
 
                                        gint _tmp7__length1;
5692
 
                                        ChessPlayer* _tmp8_;
5693
 
                                        ChessPlayer* _tmp9_;
5694
 
                                        gchar** _tmp10_;
5695
 
                                        gint _tmp10__length1;
5696
 
                                        gint _tmp11_;
5697
 
                                        const gchar* _tmp12_;
5698
 
                                        gboolean _tmp13_ = FALSE;
5699
 
                                        _tmp4_ = _tmp3_;
5700
 
                                        if (!_tmp4_) {
5701
 
                                                gint _tmp5_;
5702
 
                                                _tmp5_ = i;
5703
 
                                                i = _tmp5_ + 1;
 
5453
                                        gint _tmp5_ = 0;
 
5454
                                        gchar** _tmp6_ = NULL;
 
5455
                                        gint _tmp6__length1 = 0;
 
5456
                                        ChessPlayer* _tmp7_ = NULL;
 
5457
                                        ChessPlayer* _tmp8_ = NULL;
 
5458
                                        gchar** _tmp9_ = NULL;
 
5459
                                        gint _tmp9__length1 = 0;
 
5460
                                        gint _tmp10_ = 0;
 
5461
                                        const gchar* _tmp11_ = NULL;
 
5462
                                        gboolean _tmp12_ = FALSE;
 
5463
                                        if (!_tmp3_) {
 
5464
                                                gint _tmp4_ = 0;
 
5465
                                                _tmp4_ = i;
 
5466
                                                i = _tmp4_ + 1;
5704
5467
                                        }
5705
5468
                                        _tmp3_ = FALSE;
5706
 
                                        _tmp6_ = i;
5707
 
                                        _tmp7_ = moves;
5708
 
                                        _tmp7__length1 = moves_length1;
5709
 
                                        if (!(_tmp6_ < _tmp7__length1)) {
 
5469
                                        _tmp5_ = i;
 
5470
                                        _tmp6_ = moves;
 
5471
                                        _tmp6__length1 = moves_length1;
 
5472
                                        if (!(_tmp5_ < _tmp6__length1)) {
5710
5473
                                                break;
5711
5474
                                        }
5712
 
                                        _tmp8_ = chess_game_get_current_player (self);
5713
 
                                        _tmp9_ = _tmp8_;
5714
 
                                        _tmp10_ = moves;
5715
 
                                        _tmp10__length1 = moves_length1;
5716
 
                                        _tmp11_ = i;
5717
 
                                        _tmp12_ = _tmp10_[_tmp11_];
5718
 
                                        _tmp13_ = chess_game_do_move (self, _tmp9_, _tmp12_, TRUE);
5719
 
                                        if (!_tmp13_) {
5720
 
                                                gchar** _tmp14_;
5721
 
                                                gint _tmp14__length1;
5722
 
                                                gint _tmp15_;
5723
 
                                                const gchar* _tmp16_;
5724
 
                                                _tmp14_ = moves;
5725
 
                                                _tmp14__length1 = moves_length1;
5726
 
                                                _tmp15_ = i;
5727
 
                                                _tmp16_ = _tmp14_[_tmp15_];
5728
 
                                                g_warning ("chess-game.vala:1286: Invalid move %s", _tmp16_);
 
5475
                                        _tmp7_ = chess_game_get_current_player (self);
 
5476
                                        _tmp8_ = _tmp7_;
 
5477
                                        _tmp9_ = moves;
 
5478
                                        _tmp9__length1 = moves_length1;
 
5479
                                        _tmp10_ = i;
 
5480
                                        _tmp11_ = _tmp9_[_tmp10_];
 
5481
                                        _tmp12_ = chess_game_do_move (self, _tmp8_, _tmp11_, TRUE);
 
5482
                                        if (!_tmp12_) {
 
5483
                                                gchar** _tmp13_ = NULL;
 
5484
                                                gint _tmp13__length1 = 0;
 
5485
                                                gint _tmp14_ = 0;
 
5486
                                                const gchar* _tmp15_ = NULL;
 
5487
                                                _tmp13_ = moves;
 
5488
                                                _tmp13__length1 = moves_length1;
 
5489
                                                _tmp14_ = i;
 
5490
                                                _tmp15_ = _tmp13_[_tmp14_];
 
5491
                                                g_warning ("chess-game.vala:1332: Invalid move %s", _tmp15_);
5729
5492
                                        }
5730
5493
                                }
5731
5494
                        }
5732
5495
                }
5733
5496
        }
5734
 
        _tmp17_ = chess_game_get_white (self);
5735
 
        _tmp18_ = _tmp17_;
5736
 
        g_signal_connect (_tmp18_, "do-move", (GCallback) _chess_game_move_cb_chess_player_do_move, self);
5737
 
        _tmp19_ = chess_game_get_white (self);
5738
 
        _tmp20_ = _tmp19_;
5739
 
        g_signal_connect (_tmp20_, "do-undo", (GCallback) _chess_game_undo_cb_chess_player_do_undo, self);
5740
 
        _tmp21_ = chess_game_get_white (self);
5741
 
        _tmp22_ = _tmp21_;
5742
 
        g_signal_connect (_tmp22_, "do-resign", (GCallback) _chess_game_resign_cb_chess_player_do_resign, self);
5743
 
        _tmp23_ = chess_game_get_white (self);
5744
 
        _tmp24_ = _tmp23_;
5745
 
        g_signal_connect (_tmp24_, "do-claim-draw", (GCallback) _chess_game_claim_draw_cb_chess_player_do_claim_draw, self);
5746
 
        _tmp25_ = chess_game_get_black (self);
5747
 
        _tmp26_ = _tmp25_;
5748
 
        g_signal_connect (_tmp26_, "do-move", (GCallback) _chess_game_move_cb_chess_player_do_move, self);
5749
 
        _tmp27_ = chess_game_get_black (self);
5750
 
        _tmp28_ = _tmp27_;
5751
 
        g_signal_connect (_tmp28_, "do-undo", (GCallback) _chess_game_undo_cb_chess_player_do_undo, self);
5752
 
        _tmp29_ = chess_game_get_black (self);
5753
 
        _tmp30_ = _tmp29_;
5754
 
        g_signal_connect (_tmp30_, "do-resign", (GCallback) _chess_game_resign_cb_chess_player_do_resign, self);
5755
 
        _tmp31_ = chess_game_get_black (self);
5756
 
        _tmp32_ = _tmp31_;
5757
 
        g_signal_connect (_tmp32_, "do-claim-draw", (GCallback) _chess_game_claim_draw_cb_chess_player_do_claim_draw, self);
 
5497
        _tmp16_ = chess_game_get_white (self);
 
5498
        _tmp17_ = _tmp16_;
 
5499
        g_signal_connect_object (_tmp17_, "do-move", (GCallback) _chess_game_move_cb_chess_player_do_move, self, 0);
 
5500
        _tmp18_ = chess_game_get_white (self);
 
5501
        _tmp19_ = _tmp18_;
 
5502
        g_signal_connect_object (_tmp19_, "do-undo", (GCallback) _chess_game_undo_cb_chess_player_do_undo, self, 0);
 
5503
        _tmp20_ = chess_game_get_white (self);
 
5504
        _tmp21_ = _tmp20_;
 
5505
        g_signal_connect_object (_tmp21_, "do-resign", (GCallback) _chess_game_resign_cb_chess_player_do_resign, self, 0);
 
5506
        _tmp22_ = chess_game_get_white (self);
 
5507
        _tmp23_ = _tmp22_;
 
5508
        g_signal_connect_object (_tmp23_, "do-claim-draw", (GCallback) _chess_game_claim_draw_cb_chess_player_do_claim_draw, self, 0);
 
5509
        _tmp24_ = chess_game_get_black (self);
 
5510
        _tmp25_ = _tmp24_;
 
5511
        g_signal_connect_object (_tmp25_, "do-move", (GCallback) _chess_game_move_cb_chess_player_do_move, self, 0);
 
5512
        _tmp26_ = chess_game_get_black (self);
 
5513
        _tmp27_ = _tmp26_;
 
5514
        g_signal_connect_object (_tmp27_, "do-undo", (GCallback) _chess_game_undo_cb_chess_player_do_undo, self, 0);
 
5515
        _tmp28_ = chess_game_get_black (self);
 
5516
        _tmp29_ = _tmp28_;
 
5517
        g_signal_connect_object (_tmp29_, "do-resign", (GCallback) _chess_game_resign_cb_chess_player_do_resign, self, 0);
 
5518
        _tmp30_ = chess_game_get_black (self);
 
5519
        _tmp31_ = _tmp30_;
 
5520
        g_signal_connect_object (_tmp31_, "do-claim-draw", (GCallback) _chess_game_claim_draw_cb_chess_player_do_claim_draw, self, 0);
5758
5521
        return self;
5759
5522
}
5760
5523
 
5766
5529
 
5767
5530
static gboolean chess_game_move_cb (ChessGame* self, ChessPlayer* player, const gchar* move, gboolean apply) {
5768
5531
        gboolean result = FALSE;
5769
 
        gboolean _tmp0_;
5770
 
        ChessPlayer* _tmp1_;
5771
 
        const gchar* _tmp2_;
5772
 
        gboolean _tmp3_;
 
5532
        gboolean _tmp0_ = FALSE;
 
5533
        ChessPlayer* _tmp1_ = NULL;
 
5534
        const gchar* _tmp2_ = NULL;
 
5535
        gboolean _tmp3_ = FALSE;
5773
5536
        gboolean _tmp4_ = FALSE;
5774
5537
        g_return_val_if_fail (self != NULL, FALSE);
5775
5538
        g_return_val_if_fail (player != NULL, FALSE);
5795
5558
 
5796
5559
static gboolean chess_game_do_move (ChessGame* self, ChessPlayer* player, const gchar* move, gboolean apply) {
5797
5560
        gboolean result = FALSE;
5798
 
        ChessPlayer* _tmp0_;
5799
 
        ChessPlayer* _tmp1_;
5800
 
        ChessPlayer* _tmp2_;
5801
 
        ChessState* _tmp3_;
5802
 
        ChessState* _tmp4_;
 
5561
        ChessPlayer* _tmp0_ = NULL;
 
5562
        ChessPlayer* _tmp1_ = NULL;
 
5563
        ChessPlayer* _tmp2_ = NULL;
 
5564
        ChessState* state = NULL;
 
5565
        ChessState* _tmp3_ = NULL;
 
5566
        ChessState* _tmp4_ = NULL;
5803
5567
        ChessState* _tmp5_ = NULL;
5804
 
        ChessState* state;
5805
 
        ChessState* _tmp6_;
5806
 
        gint _tmp7_;
5807
 
        ChessState* _tmp8_;
5808
 
        const gchar* _tmp9_;
5809
 
        gboolean _tmp10_;
 
5568
        ChessState* _tmp6_ = NULL;
 
5569
        gint _tmp7_ = 0;
 
5570
        ChessState* _tmp8_ = NULL;
 
5571
        const gchar* _tmp9_ = NULL;
 
5572
        gboolean _tmp10_ = FALSE;
5810
5573
        gboolean _tmp11_ = FALSE;
5811
 
        gboolean _tmp12_;
5812
 
        ChessState* _tmp13_;
5813
 
        ChessState* _tmp14_;
5814
 
        ChessState* _tmp15_;
5815
 
        ChessMove* _tmp16_;
5816
 
        ChessPiece* _tmp17_;
5817
 
        ChessState* _tmp21_;
5818
 
        ChessMove* _tmp22_;
5819
 
        ChessPiece* _tmp23_;
5820
 
        ChessState* _tmp24_;
5821
 
        ChessMove* _tmp25_;
5822
 
        ChessPiece* _tmp26_;
5823
 
        ChessState* _tmp30_;
5824
 
        ChessMove* _tmp31_;
 
5574
        gboolean _tmp12_ = FALSE;
 
5575
        ChessState* _tmp13_ = NULL;
 
5576
        ChessState* _tmp14_ = NULL;
 
5577
        ChessState* _tmp15_ = NULL;
 
5578
        ChessMove* _tmp16_ = NULL;
 
5579
        ChessPiece* _tmp17_ = NULL;
 
5580
        ChessState* _tmp21_ = NULL;
 
5581
        ChessMove* _tmp22_ = NULL;
 
5582
        ChessPiece* _tmp23_ = NULL;
 
5583
        ChessState* _tmp24_ = NULL;
 
5584
        ChessMove* _tmp25_ = NULL;
 
5585
        ChessPiece* _tmp26_ = NULL;
 
5586
        ChessState* _tmp30_ = NULL;
 
5587
        ChessMove* _tmp31_ = NULL;
5825
5588
        g_return_val_if_fail (self != NULL, FALSE);
5826
5589
        g_return_val_if_fail (player != NULL, FALSE);
5827
5590
        _tmp0_ = player;
5860
5623
        _tmp16_ = _tmp15_->last_move;
5861
5624
        _tmp17_ = _tmp16_->victim;
5862
5625
        if (_tmp17_ != NULL) {
5863
 
                ChessState* _tmp18_;
5864
 
                ChessMove* _tmp19_;
5865
 
                ChessPiece* _tmp20_;
 
5626
                ChessState* _tmp18_ = NULL;
 
5627
                ChessMove* _tmp19_ = NULL;
 
5628
                ChessPiece* _tmp20_ = NULL;
5866
5629
                _tmp18_ = state;
5867
5630
                _tmp19_ = _tmp18_->last_move;
5868
5631
                _tmp20_ = _tmp19_->victim;
5876
5639
        _tmp25_ = _tmp24_->last_move;
5877
5640
        _tmp26_ = _tmp25_->moved_rook;
5878
5641
        if (_tmp26_ != NULL) {
5879
 
                ChessState* _tmp27_;
5880
 
                ChessMove* _tmp28_;
5881
 
                ChessPiece* _tmp29_;
 
5642
                ChessState* _tmp27_ = NULL;
 
5643
                ChessMove* _tmp28_ = NULL;
 
5644
                ChessPiece* _tmp29_ = NULL;
5882
5645
                _tmp27_ = state;
5883
5646
                _tmp28_ = _tmp27_->last_move;
5884
5647
                _tmp29_ = _tmp28_->moved_rook;
5895
5658
 
5896
5659
 
5897
5660
void chess_game_add_hold (ChessGame* self) {
5898
 
        gint _tmp0_;
 
5661
        gint _tmp0_ = 0;
5899
5662
        g_return_if_fail (self != NULL);
5900
5663
        _tmp0_ = self->priv->hold_count;
5901
5664
        self->priv->hold_count = _tmp0_ + 1;
5903
5666
 
5904
5667
 
5905
5668
void chess_game_remove_hold (ChessGame* self) {
5906
 
        gint _tmp0_;
5907
 
        gint _tmp1_;
5908
 
        gint _tmp2_;
 
5669
        gint _tmp0_ = 0;
 
5670
        gint _tmp1_ = 0;
 
5671
        gint _tmp2_ = 0;
5909
5672
        g_return_if_fail (self != NULL);
5910
5673
        _tmp0_ = self->priv->hold_count;
5911
5674
        g_return_if_fail (_tmp0_ > 0);
5919
5682
 
5920
5683
 
5921
5684
static void chess_game_complete_move (ChessGame* self) {
5922
 
        gint _tmp0_;
 
5685
        gint _tmp0_ = 0;
 
5686
        gboolean _tmp1_ = FALSE;
5923
5687
        ChessRule rule = 0;
5924
 
        ChessState* _tmp1_;
5925
 
        ChessState* _tmp2_;
5926
 
        ChessRule _tmp3_ = 0;
5927
 
        ChessResult _tmp4_ = 0;
5928
 
        ChessResult _result_;
5929
 
        ChessResult _tmp5_;
 
5688
        ChessResult _result_ = 0;
 
5689
        ChessState* _tmp2_ = NULL;
 
5690
        ChessState* _tmp3_ = NULL;
 
5691
        ChessRule _tmp4_ = 0;
 
5692
        ChessResult _tmp5_ = 0;
 
5693
        ChessResult _tmp6_ = 0;
5930
5694
        g_return_if_fail (self != NULL);
5931
5695
        _tmp0_ = self->priv->hold_count;
5932
5696
        if (_tmp0_ > 0) {
5933
5697
                return;
5934
5698
        }
5935
 
        _tmp1_ = chess_game_get_current_state (self);
5936
 
        _tmp2_ = _tmp1_;
5937
 
        _tmp4_ = chess_state_get_result (_tmp2_, &_tmp3_);
5938
 
        rule = _tmp3_;
5939
 
        _result_ = _tmp4_;
5940
 
        _tmp5_ = _result_;
5941
 
        if (_tmp5_ != CHESS_RESULT_IN_PROGRESS) {
5942
 
                ChessResult _tmp6_;
5943
 
                ChessRule _tmp7_;
5944
 
                _tmp6_ = _result_;
5945
 
                _tmp7_ = rule;
5946
 
                chess_game_stop (self, _tmp6_, _tmp7_);
 
5699
        _tmp1_ = self->is_started;
 
5700
        if (!_tmp1_) {
 
5701
                return;
 
5702
        }
 
5703
        _tmp2_ = chess_game_get_current_state (self);
 
5704
        _tmp3_ = _tmp2_;
 
5705
        _tmp5_ = chess_state_get_result (_tmp3_, &_tmp4_);
 
5706
        rule = _tmp4_;
 
5707
        _result_ = _tmp5_;
 
5708
        _tmp6_ = _result_;
 
5709
        if (_tmp6_ != CHESS_RESULT_IN_PROGRESS) {
 
5710
                ChessResult _tmp7_ = 0;
 
5711
                ChessRule _tmp8_ = 0;
 
5712
                _tmp7_ = _result_;
 
5713
                _tmp8_ = rule;
 
5714
                chess_game_stop (self, _tmp7_, _tmp8_);
5947
5715
        } else {
5948
 
                ChessClock* _tmp8_;
5949
 
                ChessPlayer* _tmp13_;
5950
 
                ChessPlayer* _tmp14_;
5951
 
                ChessPlayer* _tmp15_;
5952
 
                ChessPlayer* _tmp16_;
5953
 
                _tmp8_ = self->priv->_clock;
5954
 
                if (_tmp8_ != NULL) {
5955
 
                        ChessClock* _tmp9_;
5956
 
                        ChessPlayer* _tmp10_;
5957
 
                        ChessPlayer* _tmp11_;
5958
 
                        Color _tmp12_;
5959
 
                        _tmp9_ = self->priv->_clock;
5960
 
                        _tmp10_ = chess_game_get_current_player (self);
5961
 
                        _tmp11_ = _tmp10_;
5962
 
                        _tmp12_ = _tmp11_->color;
5963
 
                        chess_clock_set_active_color (_tmp9_, _tmp12_);
 
5716
                ChessClock* _tmp9_ = NULL;
 
5717
                ChessPlayer* _tmp14_ = NULL;
 
5718
                ChessPlayer* _tmp15_ = NULL;
 
5719
                ChessPlayer* _tmp16_ = NULL;
 
5720
                ChessPlayer* _tmp17_ = NULL;
 
5721
                _tmp9_ = self->priv->_clock;
 
5722
                if (_tmp9_ != NULL) {
 
5723
                        ChessClock* _tmp10_ = NULL;
 
5724
                        ChessPlayer* _tmp11_ = NULL;
 
5725
                        ChessPlayer* _tmp12_ = NULL;
 
5726
                        Color _tmp13_ = 0;
 
5727
                        _tmp10_ = self->priv->_clock;
 
5728
                        _tmp11_ = chess_game_get_current_player (self);
 
5729
                        _tmp12_ = _tmp11_;
 
5730
                        _tmp13_ = _tmp12_->color;
 
5731
                        chess_clock_set_active_color (_tmp10_, _tmp13_);
5964
5732
                }
5965
 
                _tmp13_ = chess_game_get_current_player (self);
5966
 
                _tmp14_ = _tmp13_;
5967
 
                g_signal_emit_by_name (_tmp14_, "start-turn");
5968
 
                _tmp15_ = chess_game_get_current_player (self);
5969
 
                _tmp16_ = _tmp15_;
5970
 
                g_signal_emit_by_name (self, "turn-started", _tmp16_);
 
5733
                _tmp14_ = chess_game_get_current_player (self);
 
5734
                _tmp15_ = _tmp14_;
 
5735
                g_signal_emit_by_name (_tmp15_, "start-turn");
 
5736
                _tmp16_ = chess_game_get_current_player (self);
 
5737
                _tmp17_ = _tmp16_;
 
5738
                g_signal_emit_by_name (self, "turn-started", _tmp17_);
5971
5739
        }
5972
5740
}
5973
5741
 
5974
5742
 
5975
5743
static void chess_game_undo_cb (ChessGame* self, ChessPlayer* player) {
5976
 
        ChessPlayer* _tmp0_;
5977
 
        ChessPlayer* _tmp1_;
5978
 
        ChessPlayer* _tmp2_;
5979
 
        GList* _tmp5_;
5980
 
        GList* _tmp6_;
5981
 
        GList* _tmp7_;
 
5744
        ChessPlayer* _tmp0_ = NULL;
 
5745
        ChessPlayer* _tmp1_ = NULL;
 
5746
        ChessPlayer* _tmp2_ = NULL;
 
5747
        GList* _tmp5_ = NULL;
 
5748
        GList* _tmp6_ = NULL;
 
5749
        GList* _tmp7_ = NULL;
5982
5750
        g_return_if_fail (self != NULL);
5983
5751
        g_return_if_fail (player != NULL);
5984
5752
        _tmp0_ = player;
5985
5753
        _tmp1_ = chess_game_get_current_player (self);
5986
5754
        _tmp2_ = _tmp1_;
5987
5755
        if (_tmp0_ == _tmp2_) {
5988
 
                ChessPlayer* _tmp3_;
5989
 
                ChessPlayer* _tmp4_;
 
5756
                ChessPlayer* _tmp3_ = NULL;
 
5757
                ChessPlayer* _tmp4_ = NULL;
5990
5758
                _tmp3_ = chess_game_get_opponent (self);
5991
5759
                _tmp4_ = _tmp3_;
5992
5760
                chess_game_undo_cb (self, _tmp4_);
6004
5772
 
6005
5773
static gboolean chess_game_resign_cb (ChessGame* self, ChessPlayer* player) {
6006
5774
        gboolean result = FALSE;
6007
 
        gboolean _tmp0_;
6008
 
        ChessPlayer* _tmp1_;
6009
 
        Color _tmp2_;
 
5775
        gboolean _tmp0_ = FALSE;
 
5776
        ChessPlayer* _tmp1_ = NULL;
 
5777
        Color _tmp2_ = 0;
6010
5778
        g_return_val_if_fail (self != NULL, FALSE);
6011
5779
        g_return_val_if_fail (player != NULL, FALSE);
6012
5780
        _tmp0_ = self->is_started;
6028
5796
 
6029
5797
static gboolean chess_game_claim_draw_cb (ChessGame* self, ChessPlayer* player) {
6030
5798
        gboolean result = FALSE;
6031
 
        gboolean _tmp0_;
6032
 
        ChessState* _tmp1_;
6033
 
        ChessState* _tmp2_;
6034
 
        gint _tmp3_;
 
5799
        gboolean _tmp0_ = FALSE;
 
5800
        ChessState* _tmp1_ = NULL;
 
5801
        ChessState* _tmp2_ = NULL;
 
5802
        gint _tmp3_ = 0;
6035
5803
        g_return_val_if_fail (self != NULL, FALSE);
6036
5804
        g_return_val_if_fail (player != NULL, FALSE);
6037
5805
        _tmp0_ = self->is_started;
6060
5828
 
6061
5829
 
6062
5830
static void _chess_game_clock_expired_cb_chess_clock_expired (ChessClock* _sender, gpointer self) {
6063
 
        chess_game_clock_expired_cb (self, _sender);
 
5831
        chess_game_clock_expired_cb ((ChessGame*) self, _sender);
6064
5832
}
6065
5833
 
6066
5834
 
6067
5835
void chess_game_start (ChessGame* self) {
6068
 
        ChessResult _tmp0_;
6069
 
        gboolean _tmp1_;
6070
 
        ChessClock* _tmp2_;
6071
 
        ChessPlayer* _tmp8_;
6072
 
        ChessPlayer* _tmp9_;
6073
 
        ChessPlayer* _tmp10_;
6074
 
        ChessPlayer* _tmp11_;
 
5836
        ChessResult _tmp0_ = 0;
 
5837
        gboolean _tmp1_ = FALSE;
 
5838
        ChessClock* _tmp2_ = NULL;
 
5839
        ChessPlayer* _tmp8_ = NULL;
 
5840
        ChessPlayer* _tmp9_ = NULL;
 
5841
        ChessPlayer* _tmp10_ = NULL;
 
5842
        ChessPlayer* _tmp11_ = NULL;
6075
5843
        g_return_if_fail (self != NULL);
6076
5844
        _tmp0_ = self->result;
6077
5845
        if (_tmp0_ != CHESS_RESULT_IN_PROGRESS) {
6084
5852
        self->is_started = TRUE;
6085
5853
        _tmp2_ = self->priv->_clock;
6086
5854
        if (_tmp2_ != NULL) {
6087
 
                ChessClock* _tmp3_;
6088
 
                ChessClock* _tmp4_;
6089
 
                ChessPlayer* _tmp5_;
6090
 
                ChessPlayer* _tmp6_;
6091
 
                Color _tmp7_;
 
5855
                ChessClock* _tmp3_ = NULL;
 
5856
                ChessClock* _tmp4_ = NULL;
 
5857
                ChessPlayer* _tmp5_ = NULL;
 
5858
                ChessPlayer* _tmp6_ = NULL;
 
5859
                Color _tmp7_ = 0;
6092
5860
                _tmp3_ = self->priv->_clock;
6093
 
                g_signal_connect (_tmp3_, "expired", (GCallback) _chess_game_clock_expired_cb_chess_clock_expired, self);
 
5861
                g_signal_connect_object (_tmp3_, "expired", (GCallback) _chess_game_clock_expired_cb_chess_clock_expired, self, 0);
6094
5862
                _tmp4_ = self->priv->_clock;
6095
5863
                _tmp5_ = chess_game_get_current_player (self);
6096
5864
                _tmp6_ = _tmp5_;
6097
5865
                _tmp7_ = _tmp6_->color;
6098
5866
                chess_clock_set_active_color (_tmp4_, _tmp7_);
6099
5867
        }
6100
 
        g_signal_emit_by_name (self, "started");
6101
5868
        _tmp8_ = chess_game_get_current_player (self);
6102
5869
        _tmp9_ = _tmp8_;
6103
5870
        g_signal_emit_by_name (_tmp9_, "start-turn");
6108
5875
 
6109
5876
 
6110
5877
static void chess_game_clock_expired_cb (ChessGame* self, ChessClock* clock) {
6111
 
        ChessPlayer* _tmp0_;
6112
 
        ChessPlayer* _tmp1_;
6113
 
        Color _tmp2_;
 
5878
        ChessPlayer* _tmp0_ = NULL;
 
5879
        ChessPlayer* _tmp1_ = NULL;
 
5880
        Color _tmp2_ = 0;
6114
5881
        g_return_if_fail (self != NULL);
6115
5882
        g_return_if_fail (clock != NULL);
6116
5883
        _tmp0_ = chess_game_get_current_player (self);
6124
5891
}
6125
5892
 
6126
5893
 
6127
 
void chess_game_abandon (ChessGame* self) {
6128
 
        gboolean _tmp0_;
6129
 
        g_return_if_fail (self != NULL);
6130
 
        _tmp0_ = self->is_started;
6131
 
        if (!_tmp0_) {
6132
 
                return;
6133
 
        }
6134
 
        chess_game_stop (self, CHESS_RESULT_DRAW, CHESS_RULE_ABANDONMENT);
6135
 
}
6136
 
 
6137
 
 
6138
5894
ChessPiece* chess_game_get_piece (ChessGame* self, gint rank, gint file, gint move_number) {
6139
5895
        ChessPiece* result = NULL;
6140
 
        gint _tmp0_;
6141
 
        GList* _tmp4_;
6142
 
        GList* _tmp5_;
 
5896
        gint _tmp0_ = 0;
 
5897
        ChessState* state = NULL;
 
5898
        GList* _tmp4_ = NULL;
 
5899
        GList* _tmp5_ = NULL;
6143
5900
        guint _tmp6_ = 0U;
6144
 
        gint _tmp7_;
 
5901
        gint _tmp7_ = 0;
6145
5902
        gconstpointer _tmp8_ = NULL;
6146
 
        ChessState* _tmp9_;
6147
 
        ChessState* state;
6148
 
        gint _tmp10_;
6149
 
        gint _tmp11_;
 
5903
        ChessState* _tmp9_ = NULL;
 
5904
        gint _tmp10_ = 0;
 
5905
        gint _tmp11_ = 0;
6150
5906
        gint _tmp12_ = 0;
6151
 
        ChessPiece* _tmp13_;
6152
 
        ChessPiece* _tmp14_;
 
5907
        ChessPiece* _tmp13_ = NULL;
 
5908
        ChessPiece* _tmp14_ = NULL;
6153
5909
        g_return_val_if_fail (self != NULL, NULL);
6154
5910
        _tmp0_ = move_number;
6155
5911
        if (_tmp0_ < 0) {
6156
 
                gint _tmp1_;
6157
 
                GList* _tmp2_;
 
5912
                gint _tmp1_ = 0;
 
5913
                GList* _tmp2_ = NULL;
6158
5914
                guint _tmp3_ = 0U;
6159
5915
                _tmp1_ = move_number;
6160
5916
                _tmp2_ = self->move_stack;
6179
5935
}
6180
5936
 
6181
5937
 
6182
 
static void chess_game_stop (ChessGame* self, ChessResult _result_, ChessRule rule) {
6183
 
        ChessResult _tmp0_;
6184
 
        ChessRule _tmp1_;
6185
 
        ChessClock* _tmp2_;
6186
 
        g_return_if_fail (self != NULL);
6187
 
        _tmp0_ = _result_;
6188
 
        self->result = _tmp0_;
6189
 
        _tmp1_ = rule;
6190
 
        self->rule = _tmp1_;
 
5938
void chess_game_pause (ChessGame* self) {
 
5939
        gboolean _tmp0_ = FALSE;
 
5940
        gboolean _tmp1_ = FALSE;
 
5941
        ChessClock* _tmp2_ = NULL;
 
5942
        ChessClock* _tmp3_ = NULL;
 
5943
        g_return_if_fail (self != NULL);
 
5944
        _tmp2_ = chess_game_get_clock (self);
 
5945
        _tmp3_ = _tmp2_;
 
5946
        if (_tmp3_ != NULL) {
 
5947
                ChessResult _tmp4_ = 0;
 
5948
                _tmp4_ = self->result;
 
5949
                _tmp1_ = _tmp4_ == CHESS_RESULT_IN_PROGRESS;
 
5950
        } else {
 
5951
                _tmp1_ = FALSE;
 
5952
        }
 
5953
        if (_tmp1_) {
 
5954
                gboolean _tmp5_ = FALSE;
 
5955
                _tmp5_ = self->priv->_is_paused;
 
5956
                _tmp0_ = !_tmp5_;
 
5957
        } else {
 
5958
                _tmp0_ = FALSE;
 
5959
        }
 
5960
        if (_tmp0_) {
 
5961
                ChessClock* _tmp6_ = NULL;
 
5962
                ChessClock* _tmp7_ = NULL;
 
5963
                _tmp6_ = chess_game_get_clock (self);
 
5964
                _tmp7_ = _tmp6_;
 
5965
                chess_clock_pause (_tmp7_);
 
5966
                chess_game_set_is_paused (self, TRUE);
 
5967
                g_signal_emit_by_name (self, "paused");
 
5968
        }
 
5969
}
 
5970
 
 
5971
 
 
5972
void chess_game_unpause (ChessGame* self) {
 
5973
        gboolean _tmp0_ = FALSE;
 
5974
        gboolean _tmp1_ = FALSE;
 
5975
        ChessClock* _tmp2_ = NULL;
 
5976
        ChessClock* _tmp3_ = NULL;
 
5977
        g_return_if_fail (self != NULL);
 
5978
        _tmp2_ = chess_game_get_clock (self);
 
5979
        _tmp3_ = _tmp2_;
 
5980
        if (_tmp3_ != NULL) {
 
5981
                ChessResult _tmp4_ = 0;
 
5982
                _tmp4_ = self->result;
 
5983
                _tmp1_ = _tmp4_ == CHESS_RESULT_IN_PROGRESS;
 
5984
        } else {
 
5985
                _tmp1_ = FALSE;
 
5986
        }
 
5987
        if (_tmp1_) {
 
5988
                gboolean _tmp5_ = FALSE;
 
5989
                _tmp5_ = self->priv->_is_paused;
 
5990
                _tmp0_ = _tmp5_;
 
5991
        } else {
 
5992
                _tmp0_ = FALSE;
 
5993
        }
 
5994
        if (_tmp0_) {
 
5995
                ChessClock* _tmp6_ = NULL;
 
5996
                ChessClock* _tmp7_ = NULL;
 
5997
                _tmp6_ = chess_game_get_clock (self);
 
5998
                _tmp7_ = _tmp6_;
 
5999
                chess_clock_unpause (_tmp7_);
 
6000
                chess_game_set_is_paused (self, FALSE);
 
6001
                g_signal_emit_by_name (self, "unpaused");
 
6002
        }
 
6003
}
 
6004
 
 
6005
 
 
6006
void chess_game_stop (ChessGame* self, ChessResult _result_, ChessRule rule) {
 
6007
        gboolean _tmp0_ = FALSE;
 
6008
        ChessResult _tmp1_ = 0;
 
6009
        ChessRule _tmp2_ = 0;
 
6010
        ChessClock* _tmp3_ = NULL;
 
6011
        g_return_if_fail (self != NULL);
 
6012
        _tmp0_ = self->is_started;
 
6013
        if (!_tmp0_) {
 
6014
                return;
 
6015
        }
 
6016
        _tmp1_ = _result_;
 
6017
        self->result = _tmp1_;
 
6018
        _tmp2_ = rule;
 
6019
        self->rule = _tmp2_;
6191
6020
        self->is_started = FALSE;
6192
 
        _tmp2_ = self->priv->_clock;
6193
 
        if (_tmp2_ != NULL) {
6194
 
                ChessClock* _tmp3_;
6195
 
                _tmp3_ = self->priv->_clock;
6196
 
                chess_clock_stop (_tmp3_);
 
6021
        _tmp3_ = self->priv->_clock;
 
6022
        if (_tmp3_ != NULL) {
 
6023
                ChessClock* _tmp4_ = NULL;
 
6024
                _tmp4_ = self->priv->_clock;
 
6025
                chess_clock_stop (_tmp4_);
6197
6026
        }
6198
6027
        g_signal_emit_by_name (self, "ended");
6199
6028
}
6201
6030
 
6202
6031
static gboolean chess_game_is_three_fold_repeat (ChessGame* self) {
6203
6032
        gboolean result = FALSE;
6204
 
        gint count;
6205
 
        GList* _tmp0_;
6206
 
        GList* _tmp1_;
 
6033
        GList* _tmp0_ = NULL;
6207
6034
        g_return_val_if_fail (self != NULL, FALSE);
6208
 
        count = 1;
6209
6035
        _tmp0_ = self->move_stack;
6210
 
        _tmp1_ = _tmp0_->next;
6211
6036
        {
6212
6037
                GList* state_collection = NULL;
6213
6038
                GList* state_it = NULL;
6214
 
                state_collection = _tmp1_;
 
6039
                state_collection = _tmp0_;
6215
6040
                for (state_it = state_collection; state_it != NULL; state_it = state_it->next) {
6216
 
                        ChessState* _tmp2_;
 
6041
                        ChessState* _tmp1_ = NULL;
6217
6042
                        ChessState* state = NULL;
6218
 
                        _tmp2_ = _chess_state_ref0 ((ChessState*) state_it->data);
6219
 
                        state = _tmp2_;
6220
 
                        {
6221
 
                                ChessState* _tmp3_;
6222
 
                                ChessState* _tmp4_;
6223
 
                                ChessState* _tmp5_;
6224
 
                                gboolean _tmp6_ = FALSE;
6225
 
                                _tmp3_ = chess_game_get_current_state (self);
6226
 
                                _tmp4_ = _tmp3_;
6227
 
                                _tmp5_ = state;
6228
 
                                _tmp6_ = chess_state_equals (_tmp4_, _tmp5_);
6229
 
                                if (_tmp6_) {
6230
 
                                        gint _tmp7_;
6231
 
                                        gint _tmp8_;
6232
 
                                        _tmp7_ = count;
6233
 
                                        count = _tmp7_ + 1;
 
6043
                        _tmp1_ = _chess_state_ref0 ((ChessState*) state_it->data);
 
6044
                        state = _tmp1_;
 
6045
                        {
 
6046
                                ChessState* _tmp2_ = NULL;
 
6047
                                gint _tmp3_ = 0;
 
6048
                                _tmp2_ = state;
 
6049
                                _tmp3_ = chess_game_state_repeated_times (self, _tmp2_);
 
6050
                                if (_tmp3_ >= 3) {
 
6051
                                        result = TRUE;
 
6052
                                        _chess_state_unref0 (state);
 
6053
                                        return result;
 
6054
                                }
 
6055
                                _chess_state_unref0 (state);
 
6056
                        }
 
6057
                }
 
6058
        }
 
6059
        result = FALSE;
 
6060
        return result;
 
6061
}
 
6062
 
 
6063
 
 
6064
gint chess_game_state_repeated_times (ChessGame* self, ChessState* s1) {
 
6065
        gint result = 0;
 
6066
        gint count = 0;
 
6067
        GList* _tmp0_ = NULL;
 
6068
        g_return_val_if_fail (self != NULL, 0);
 
6069
        g_return_val_if_fail (s1 != NULL, 0);
 
6070
        count = 1;
 
6071
        _tmp0_ = self->move_stack;
 
6072
        {
 
6073
                GList* s2_collection = NULL;
 
6074
                GList* s2_it = NULL;
 
6075
                s2_collection = _tmp0_;
 
6076
                for (s2_it = s2_collection; s2_it != NULL; s2_it = s2_it->next) {
 
6077
                        ChessState* _tmp1_ = NULL;
 
6078
                        ChessState* s2 = NULL;
 
6079
                        _tmp1_ = _chess_state_ref0 ((ChessState*) s2_it->data);
 
6080
                        s2 = _tmp1_;
 
6081
                        {
 
6082
                                gboolean _tmp2_ = FALSE;
 
6083
                                ChessState* _tmp3_ = NULL;
 
6084
                                ChessState* _tmp4_ = NULL;
 
6085
                                _tmp3_ = s1;
 
6086
                                _tmp4_ = s2;
 
6087
                                if (_tmp3_ != _tmp4_) {
 
6088
                                        ChessState* _tmp5_ = NULL;
 
6089
                                        ChessState* _tmp6_ = NULL;
 
6090
                                        gboolean _tmp7_ = FALSE;
 
6091
                                        _tmp5_ = s1;
 
6092
                                        _tmp6_ = s2;
 
6093
                                        _tmp7_ = chess_state_equals (_tmp5_, _tmp6_);
 
6094
                                        _tmp2_ = _tmp7_;
 
6095
                                } else {
 
6096
                                        _tmp2_ = FALSE;
 
6097
                                }
 
6098
                                if (_tmp2_) {
 
6099
                                        gint _tmp8_ = 0;
6234
6100
                                        _tmp8_ = count;
6235
 
                                        if (_tmp8_ >= 3) {
6236
 
                                                result = TRUE;
6237
 
                                                _chess_state_unref0 (state);
6238
 
                                                return result;
6239
 
                                        }
 
6101
                                        count = _tmp8_ + 1;
6240
6102
                                }
6241
 
                                _chess_state_unref0 (state);
 
6103
                                _chess_state_unref0 (s2);
6242
6104
                        }
6243
6105
                }
6244
6106
        }
6245
 
        result = FALSE;
6246
 
        return result;
 
6107
        result = count;
 
6108
        return result;
 
6109
}
 
6110
 
 
6111
 
 
6112
gboolean chess_game_get_is_paused (ChessGame* self) {
 
6113
        gboolean result;
 
6114
        gboolean _tmp0_ = FALSE;
 
6115
        g_return_val_if_fail (self != NULL, FALSE);
 
6116
        _tmp0_ = self->priv->_is_paused;
 
6117
        result = _tmp0_;
 
6118
        return result;
 
6119
}
 
6120
 
 
6121
 
 
6122
static void chess_game_set_is_paused (ChessGame* self, gboolean value) {
 
6123
        gboolean _tmp0_ = FALSE;
 
6124
        g_return_if_fail (self != NULL);
 
6125
        _tmp0_ = value;
 
6126
        self->priv->_is_paused = _tmp0_;
 
6127
        g_object_notify ((GObject *) self, "is-paused");
6247
6128
}
6248
6129
 
6249
6130
 
6250
6131
ChessState* chess_game_get_current_state (ChessGame* self) {
6251
6132
        ChessState* result;
6252
 
        GList* _tmp0_;
6253
 
        gconstpointer _tmp1_;
 
6133
        GList* _tmp0_ = NULL;
 
6134
        gconstpointer _tmp1_ = NULL;
6254
6135
        g_return_val_if_fail (self != NULL, NULL);
6255
6136
        _tmp0_ = self->move_stack;
6256
6137
        _tmp1_ = _tmp0_->data;
6261
6142
 
6262
6143
ChessPlayer* chess_game_get_white (ChessGame* self) {
6263
6144
        ChessPlayer* result;
6264
 
        ChessState* _tmp0_;
6265
 
        ChessState* _tmp1_;
6266
 
        ChessPlayer* _tmp2_;
 
6145
        ChessState* _tmp0_ = NULL;
 
6146
        ChessState* _tmp1_ = NULL;
 
6147
        ChessPlayer* _tmp2_ = NULL;
6267
6148
        g_return_val_if_fail (self != NULL, NULL);
6268
6149
        _tmp0_ = chess_game_get_current_state (self);
6269
6150
        _tmp1_ = _tmp0_;
6275
6156
 
6276
6157
ChessPlayer* chess_game_get_black (ChessGame* self) {
6277
6158
        ChessPlayer* result;
6278
 
        ChessState* _tmp0_;
6279
 
        ChessState* _tmp1_;
6280
 
        ChessPlayer* _tmp2_;
 
6159
        ChessState* _tmp0_ = NULL;
 
6160
        ChessState* _tmp1_ = NULL;
 
6161
        ChessPlayer* _tmp2_ = NULL;
6281
6162
        g_return_val_if_fail (self != NULL, NULL);
6282
6163
        _tmp0_ = chess_game_get_current_state (self);
6283
6164
        _tmp1_ = _tmp0_;
6289
6170
 
6290
6171
ChessPlayer* chess_game_get_current_player (ChessGame* self) {
6291
6172
        ChessPlayer* result;
6292
 
        ChessState* _tmp0_;
6293
 
        ChessState* _tmp1_;
6294
 
        ChessPlayer* _tmp2_;
 
6173
        ChessState* _tmp0_ = NULL;
 
6174
        ChessState* _tmp1_ = NULL;
 
6175
        ChessPlayer* _tmp2_ = NULL;
6295
6176
        g_return_val_if_fail (self != NULL, NULL);
6296
6177
        _tmp0_ = chess_game_get_current_state (self);
6297
6178
        _tmp1_ = _tmp0_;
6303
6184
 
6304
6185
ChessPlayer* chess_game_get_opponent (ChessGame* self) {
6305
6186
        ChessPlayer* result;
6306
 
        ChessState* _tmp0_;
6307
 
        ChessState* _tmp1_;
6308
 
        ChessPlayer* _tmp2_;
6309
 
        ChessPlayer* _tmp3_;
 
6187
        ChessState* _tmp0_ = NULL;
 
6188
        ChessState* _tmp1_ = NULL;
 
6189
        ChessPlayer* _tmp2_ = NULL;
 
6190
        ChessPlayer* _tmp3_ = NULL;
6310
6191
        g_return_val_if_fail (self != NULL, NULL);
6311
6192
        _tmp0_ = chess_game_get_current_state (self);
6312
6193
        _tmp1_ = _tmp0_;
6319
6200
 
6320
6201
ChessClock* chess_game_get_clock (ChessGame* self) {
6321
6202
        ChessClock* result;
6322
 
        ChessClock* _tmp0_;
 
6203
        ChessClock* _tmp0_ = NULL;
6323
6204
        g_return_val_if_fail (self != NULL, NULL);
6324
6205
        _tmp0_ = self->priv->_clock;
6325
6206
        result = _tmp0_;
6328
6209
 
6329
6210
 
6330
6211
void chess_game_set_clock (ChessGame* self, ChessClock* value) {
6331
 
        gboolean _tmp0_;
6332
 
        ChessClock* _tmp1_;
6333
 
        ChessClock* _tmp2_;
 
6212
        gboolean _tmp0_ = FALSE;
 
6213
        ChessClock* _tmp1_ = NULL;
 
6214
        ChessClock* _tmp2_ = NULL;
6334
6215
        g_return_if_fail (self != NULL);
6335
6216
        _tmp0_ = self->is_started;
6336
6217
        if (_tmp0_) {
6340
6221
        _tmp2_ = _g_object_ref0 (_tmp1_);
6341
6222
        _g_object_unref0 (self->priv->_clock);
6342
6223
        self->priv->_clock = _tmp2_;
 
6224
        g_object_notify ((GObject *) self, "clock");
6343
6225
}
6344
6226
 
6345
6227
 
6346
6228
guint chess_game_get_n_moves (ChessGame* self) {
6347
6229
        guint result;
6348
 
        GList* _tmp0_;
 
6230
        GList* _tmp0_ = NULL;
6349
6231
        guint _tmp1_ = 0U;
6350
6232
        g_return_val_if_fail (self != NULL, 0U);
6351
6233
        _tmp0_ = self->move_stack;
6375
6257
}
6376
6258
 
6377
6259
 
6378
 
static void value_chess_game_init (GValue* value) {
6379
 
        value->data[0].v_pointer = NULL;
6380
 
}
6381
 
 
6382
 
 
6383
 
static void value_chess_game_free_value (GValue* value) {
6384
 
        if (value->data[0].v_pointer) {
6385
 
                chess_game_unref (value->data[0].v_pointer);
6386
 
        }
6387
 
}
6388
 
 
6389
 
 
6390
 
static void value_chess_game_copy_value (const GValue* src_value, GValue* dest_value) {
6391
 
        if (src_value->data[0].v_pointer) {
6392
 
                dest_value->data[0].v_pointer = chess_game_ref (src_value->data[0].v_pointer);
6393
 
        } else {
6394
 
                dest_value->data[0].v_pointer = NULL;
6395
 
        }
6396
 
}
6397
 
 
6398
 
 
6399
 
static gpointer value_chess_game_peek_pointer (const GValue* value) {
6400
 
        return value->data[0].v_pointer;
6401
 
}
6402
 
 
6403
 
 
6404
 
static gchar* value_chess_game_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
6405
 
        if (collect_values[0].v_pointer) {
6406
 
                ChessGame* object;
6407
 
                object = collect_values[0].v_pointer;
6408
 
                if (object->parent_instance.g_class == NULL) {
6409
 
                        return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
6410
 
                } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
6411
 
                        return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
6412
 
                }
6413
 
                value->data[0].v_pointer = chess_game_ref (object);
6414
 
        } else {
6415
 
                value->data[0].v_pointer = NULL;
6416
 
        }
6417
 
        return NULL;
6418
 
}
6419
 
 
6420
 
 
6421
 
static gchar* value_chess_game_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
6422
 
        ChessGame** object_p;
6423
 
        object_p = collect_values[0].v_pointer;
6424
 
        if (!object_p) {
6425
 
                return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
6426
 
        }
6427
 
        if (!value->data[0].v_pointer) {
6428
 
                *object_p = NULL;
6429
 
        } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
6430
 
                *object_p = value->data[0].v_pointer;
6431
 
        } else {
6432
 
                *object_p = chess_game_ref (value->data[0].v_pointer);
6433
 
        }
6434
 
        return NULL;
6435
 
}
6436
 
 
6437
 
 
6438
 
GParamSpec* param_spec_chess_game (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
6439
 
        ParamSpecChessGame* spec;
6440
 
        g_return_val_if_fail (g_type_is_a (object_type, TYPE_CHESS_GAME), NULL);
6441
 
        spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
6442
 
        G_PARAM_SPEC (spec)->value_type = object_type;
6443
 
        return G_PARAM_SPEC (spec);
6444
 
}
6445
 
 
6446
 
 
6447
 
gpointer value_get_chess_game (const GValue* value) {
6448
 
        g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_CHESS_GAME), NULL);
6449
 
        return value->data[0].v_pointer;
6450
 
}
6451
 
 
6452
 
 
6453
 
void value_set_chess_game (GValue* value, gpointer v_object) {
6454
 
        ChessGame* old;
6455
 
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_CHESS_GAME));
6456
 
        old = value->data[0].v_pointer;
6457
 
        if (v_object) {
6458
 
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_CHESS_GAME));
6459
 
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
6460
 
                value->data[0].v_pointer = v_object;
6461
 
                chess_game_ref (value->data[0].v_pointer);
6462
 
        } else {
6463
 
                value->data[0].v_pointer = NULL;
6464
 
        }
6465
 
        if (old) {
6466
 
                chess_game_unref (old);
6467
 
        }
6468
 
}
6469
 
 
6470
 
 
6471
 
void value_take_chess_game (GValue* value, gpointer v_object) {
6472
 
        ChessGame* old;
6473
 
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_CHESS_GAME));
6474
 
        old = value->data[0].v_pointer;
6475
 
        if (v_object) {
6476
 
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_CHESS_GAME));
6477
 
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
6478
 
                value->data[0].v_pointer = v_object;
6479
 
        } else {
6480
 
                value->data[0].v_pointer = NULL;
6481
 
        }
6482
 
        if (old) {
6483
 
                chess_game_unref (old);
6484
 
        }
6485
 
}
6486
 
 
6487
 
 
6488
6260
static void chess_game_class_init (ChessGameClass * klass) {
6489
6261
        chess_game_parent_class = g_type_class_peek_parent (klass);
6490
 
        CHESS_GAME_CLASS (klass)->finalize = chess_game_finalize;
6491
6262
        g_type_class_add_private (klass, sizeof (ChessGamePrivate));
6492
 
        g_signal_new ("started", TYPE_CHESS_GAME, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
 
6263
        G_OBJECT_CLASS (klass)->get_property = _vala_chess_game_get_property;
 
6264
        G_OBJECT_CLASS (klass)->set_property = _vala_chess_game_set_property;
 
6265
        G_OBJECT_CLASS (klass)->finalize = chess_game_finalize;
 
6266
        g_object_class_install_property (G_OBJECT_CLASS (klass), CHESS_GAME_IS_PAUSED, g_param_spec_boolean ("is-paused", "is-paused", "is-paused", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
6267
        g_object_class_install_property (G_OBJECT_CLASS (klass), CHESS_GAME_CURRENT_STATE, param_spec_chess_state ("current-state", "current-state", "current-state", TYPE_CHESS_STATE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
6268
        g_object_class_install_property (G_OBJECT_CLASS (klass), CHESS_GAME_WHITE, g_param_spec_object ("white", "white", "white", TYPE_CHESS_PLAYER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
6269
        g_object_class_install_property (G_OBJECT_CLASS (klass), CHESS_GAME_BLACK, g_param_spec_object ("black", "black", "black", TYPE_CHESS_PLAYER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
6270
        g_object_class_install_property (G_OBJECT_CLASS (klass), CHESS_GAME_CURRENT_PLAYER, g_param_spec_object ("current-player", "current-player", "current-player", TYPE_CHESS_PLAYER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
6271
        g_object_class_install_property (G_OBJECT_CLASS (klass), CHESS_GAME_OPPONENT, g_param_spec_object ("opponent", "opponent", "opponent", TYPE_CHESS_PLAYER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 
6272
        g_object_class_install_property (G_OBJECT_CLASS (klass), CHESS_GAME_CLOCK, g_param_spec_object ("clock", "clock", "clock", TYPE_CHESS_CLOCK, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
 
6273
        g_object_class_install_property (G_OBJECT_CLASS (klass), CHESS_GAME_N_MOVES, g_param_spec_uint ("n-moves", "n-moves", "n-moves", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
6493
6274
        g_signal_new ("turn_started", TYPE_CHESS_GAME, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, TYPE_CHESS_PLAYER);
6494
6275
        g_signal_new ("moved", TYPE_CHESS_GAME, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__CHESS_MOVE, G_TYPE_NONE, 1, TYPE_CHESS_MOVE);
 
6276
        g_signal_new ("paused", TYPE_CHESS_GAME, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
 
6277
        g_signal_new ("unpaused", TYPE_CHESS_GAME, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
6495
6278
        g_signal_new ("undo", TYPE_CHESS_GAME, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
6496
6279
        g_signal_new ("ended", TYPE_CHESS_GAME, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
6497
6280
}
6500
6283
static void chess_game_instance_init (ChessGame * self) {
6501
6284
        self->priv = CHESS_GAME_GET_PRIVATE (self);
6502
6285
        self->priv->hold_count = 0;
6503
 
        self->ref_count = 1;
 
6286
        self->priv->_is_paused = FALSE;
6504
6287
}
6505
6288
 
6506
6289
 
6507
 
static void chess_game_finalize (ChessGame* obj) {
 
6290
static void chess_game_finalize (GObject* obj) {
6508
6291
        ChessGame * self;
6509
 
        ChessClock* _tmp0_;
 
6292
        ChessClock* _tmp0_ = NULL;
6510
6293
        self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_CHESS_GAME, ChessGame);
6511
6294
        _tmp0_ = self->priv->_clock;
6512
6295
        if (_tmp0_ != NULL) {
6513
 
                ChessClock* _tmp1_;
 
6296
                ChessClock* _tmp1_ = NULL;
6514
6297
                _tmp1_ = self->priv->_clock;
6515
6298
                chess_clock_stop (_tmp1_);
6516
6299
        }
6517
6300
        __g_list_free__chess_state_unref0_0 (self->move_stack);
6518
6301
        _g_object_unref0 (self->priv->_clock);
 
6302
        G_OBJECT_CLASS (chess_game_parent_class)->finalize (obj);
6519
6303
}
6520
6304
 
6521
6305
 
6522
6306
GType chess_game_get_type (void) {
6523
6307
        static volatile gsize chess_game_type_id__volatile = 0;
6524
6308
        if (g_once_init_enter (&chess_game_type_id__volatile)) {
6525
 
                static const GTypeValueTable g_define_type_value_table = { value_chess_game_init, value_chess_game_free_value, value_chess_game_copy_value, value_chess_game_peek_pointer, "p", value_chess_game_collect_value, "p", value_chess_game_lcopy_value };
6526
 
                static const GTypeInfo g_define_type_info = { sizeof (ChessGameClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) chess_game_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ChessGame), 0, (GInstanceInitFunc) chess_game_instance_init, &g_define_type_value_table };
6527
 
                static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
 
6309
                static const GTypeInfo g_define_type_info = { sizeof (ChessGameClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) chess_game_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ChessGame), 0, (GInstanceInitFunc) chess_game_instance_init, NULL };
6528
6310
                GType chess_game_type_id;
6529
 
                chess_game_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ChessGame", &g_define_type_info, &g_define_type_fundamental_info, 0);
 
6311
                chess_game_type_id = g_type_register_static (G_TYPE_OBJECT, "ChessGame", &g_define_type_info, 0);
6530
6312
                g_once_init_leave (&chess_game_type_id__volatile, chess_game_type_id);
6531
6313
        }
6532
6314
        return chess_game_type_id__volatile;
6533
6315
}
6534
6316
 
6535
6317
 
6536
 
gpointer chess_game_ref (gpointer instance) {
6537
 
        ChessGame* self;
6538
 
        self = instance;
6539
 
        g_atomic_int_inc (&self->ref_count);
6540
 
        return instance;
 
6318
static void _vala_chess_game_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
 
6319
        ChessGame * self;
 
6320
        self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_CHESS_GAME, ChessGame);
 
6321
        switch (property_id) {
 
6322
                case CHESS_GAME_IS_PAUSED:
 
6323
                g_value_set_boolean (value, chess_game_get_is_paused (self));
 
6324
                break;
 
6325
                case CHESS_GAME_CURRENT_STATE:
 
6326
                value_set_chess_state (value, chess_game_get_current_state (self));
 
6327
                break;
 
6328
                case CHESS_GAME_WHITE:
 
6329
                g_value_set_object (value, chess_game_get_white (self));
 
6330
                break;
 
6331
                case CHESS_GAME_BLACK:
 
6332
                g_value_set_object (value, chess_game_get_black (self));
 
6333
                break;
 
6334
                case CHESS_GAME_CURRENT_PLAYER:
 
6335
                g_value_set_object (value, chess_game_get_current_player (self));
 
6336
                break;
 
6337
                case CHESS_GAME_OPPONENT:
 
6338
                g_value_set_object (value, chess_game_get_opponent (self));
 
6339
                break;
 
6340
                case CHESS_GAME_CLOCK:
 
6341
                g_value_set_object (value, chess_game_get_clock (self));
 
6342
                break;
 
6343
                case CHESS_GAME_N_MOVES:
 
6344
                g_value_set_uint (value, chess_game_get_n_moves (self));
 
6345
                break;
 
6346
                default:
 
6347
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
6348
                break;
 
6349
        }
6541
6350
}
6542
6351
 
6543
6352
 
6544
 
void chess_game_unref (gpointer instance) {
6545
 
        ChessGame* self;
6546
 
        self = instance;
6547
 
        if (g_atomic_int_dec_and_test (&self->ref_count)) {
6548
 
                CHESS_GAME_GET_CLASS (self)->finalize (self);
6549
 
                g_type_free_instance ((GTypeInstance *) self);
 
6353
static void _vala_chess_game_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
 
6354
        ChessGame * self;
 
6355
        self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_CHESS_GAME, ChessGame);
 
6356
        switch (property_id) {
 
6357
                case CHESS_GAME_IS_PAUSED:
 
6358
                chess_game_set_is_paused (self, g_value_get_boolean (value));
 
6359
                break;
 
6360
                case CHESS_GAME_CLOCK:
 
6361
                chess_game_set_clock (self, g_value_get_object (value));
 
6362
                break;
 
6363
                default:
 
6364
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
6365
                break;
6550
6366
        }
6551
6367
}
6552
6368