/* board.c generated by valac 0.56.19, the Vala compiler
 * generated from board.vala, do not modify */

/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * Copyright © 2014 Parin Porecha
 * Copyright © 2014 Michael Catanzaro
 *
 * This file is part of GNOME Sudoku.
 *
 * GNOME Sudoku is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * GNOME Sudoku is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GNOME Sudoku. If not, see <http://www.gnu.org/licenses/>.
 */

#include "libsudoku.h"
#include <glib-object.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <json-glib/json-glib.h>
#include <qqwing/qqwing-wrapper.h>
#include <glib/gi18n-lib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define SUDOKU_BOARD_TYPE_CELL (sudoku_board_cell_get_type ())
typedef struct _SudokuBoardCell SudokuBoardCell;

#define SUDOKU_BOARD_TYPE_DIGIT_OCCURENCES (sudoku_board_digit_occurences_get_type ())
typedef struct _SudokuBoardDigitOccurences SudokuBoardDigitOccurences;
enum  {
	SUDOKU_BOARD_0_PROPERTY,
	SUDOKU_BOARD_PREVIOUS_PLAYED_TIME_PROPERTY,
	SUDOKU_BOARD_DIFFICULTY_CATEGORY_PROPERTY,
	SUDOKU_BOARD_BLOCK_ROWS_PROPERTY,
	SUDOKU_BOARD_BLOCK_COLS_PROPERTY,
	SUDOKU_BOARD_ROWS_PROPERTY,
	SUDOKU_BOARD_COLS_PROPERTY,
	SUDOKU_BOARD_MAX_VAL_PROPERTY,
	SUDOKU_BOARD_FILLED_PROPERTY,
	SUDOKU_BOARD_FIXED_PROPERTY,
	SUDOKU_BOARD_COMPLETE_PROPERTY,
	SUDOKU_BOARD_BROKEN_COORDS_PROPERTY,
	SUDOKU_BOARD_COORDS_FOR_COL_PROPERTY,
	SUDOKU_BOARD_COORDS_FOR_ROW_PROPERTY,
	SUDOKU_BOARD_COORDS_FOR_BLOCK_PROPERTY,
	SUDOKU_BOARD_NUM_PROPERTIES
};
static GParamSpec* sudoku_board_properties[SUDOKU_BOARD_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
#define _coord_free0(var) ((var == NULL) ? NULL : (var = (coord_free (var), NULL)))
enum  {
	SUDOKU_BOARD_COMPLETED_SIGNAL,
	SUDOKU_BOARD_EARMARK_CHANGED_SIGNAL,
	SUDOKU_BOARD_VALUE_CHANGED_SIGNAL,
	SUDOKU_BOARD_NUM_SIGNALS
};
static guint sudoku_board_signals[SUDOKU_BOARD_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _SudokuBoardCell {
	gint value;
	gint solution;
	gboolean* earmarks;
	gint earmarks_length1;
	gint _earmarks_size_;
	gboolean fixed;
};

struct _SudokuBoardDigitOccurences {
	gint* occurrences_in_row;
	gint occurrences_in_row_length1;
	gint _occurrences_in_row_size_;
	gint* occurrences_in_col;
	gint occurrences_in_col_length1;
	gint _occurrences_in_col_size_;
	gint* occurrences_in_block;
	gint occurrences_in_block_length1;
	gint occurrences_in_block_length2;
};

struct _SudokuBoardPrivate {
	SudokuBoardCell* cells;
	gint cells_length1;
	gint cells_length2;
	SudokuBoardDigitOccurences* digits;
	gint digits_length1;
	gint _digits_size_;
	gboolean has_solution;
	gint n_earmarks;
	gdouble _previous_played_time;
	DifficultyCategory _difficulty_category;
	gint _block_rows;
	gint _block_cols;
	gint _rows;
	gint _cols;
	gint _filled;
	gint _fixed;
	GeeSet* _broken_coords;
	GeeList* _coords_for_col;
	GeeList* _coords_for_row;
	GeeMap* _coords_for_block;
};

static gint SudokuBoard_private_offset;
static gpointer sudoku_board_parent_class = NULL;

static GType sudoku_board_cell_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static SudokuBoardCell* sudoku_board_cell_dup (const SudokuBoardCell* self);
static void sudoku_board_cell_free (SudokuBoardCell* self);
static void sudoku_board_cell_copy (const SudokuBoardCell* self,
                             SudokuBoardCell* dest);
static void sudoku_board_cell_destroy (SudokuBoardCell* self);
static GType sudoku_board_digit_occurences_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static SudokuBoardDigitOccurences* sudoku_board_digit_occurences_dup (const SudokuBoardDigitOccurences* self);
static void sudoku_board_digit_occurences_free (SudokuBoardDigitOccurences* self);
static void sudoku_board_digit_occurences_copy (const SudokuBoardDigitOccurences* self,
                                         SudokuBoardDigitOccurences* dest);
static void sudoku_board_digit_occurences_destroy (SudokuBoardDigitOccurences* self);
static void _vala_SudokuBoardCell_array_free (SudokuBoardCell * array,
                                       gssize array_length);
static void _vala_SudokuBoardDigitOccurences_array_free (SudokuBoardDigitOccurences * array,
                                                  gssize array_length);
static void sudoku_board_set_broken_coords (SudokuBoard* self,
                                     GeeSet* value);
static void sudoku_board_set_coords_for_col (SudokuBoard* self,
                                      GeeList* value);
static void sudoku_board_set_coords_for_row (SudokuBoard* self,
                                      GeeList* value);
static void sudoku_board_set_coords_for_block (SudokuBoard* self,
                                        GeeMap* value);
static void sudoku_board_ctor_err (gboolean check,
                            GError** error);
static gint* sudoku_board_from_printable_ascii (SudokuBoard* self,
                                         gint val,
                                         gint* result_length1);
static JsonNode* _vala_JsonNode_copy (JsonNode* self);
static void _vala_JsonNode_free (JsonNode* self);
static SudokuBoardCell* _vala_array_dup2 (SudokuBoardCell* self,
                                   gssize length);
static SudokuBoardDigitOccurences* _vala_array_dup3 (SudokuBoardDigitOccurences* self,
                                              gssize length);
static void sudoku_board_set_filled (SudokuBoard* self,
                              gint value);
static void sudoku_board_set_fixed (SudokuBoard* self,
                             gint value);
static gboolean* _vala_array_dup4 (gboolean* self,
                            gssize length);
static gint* sudoku_board_get_fixed_cells (SudokuBoard* self,
                                    gint* result_length1);
static gint* _vala_array_dup5 (gint* self,
                        gssize length);
static void sudoku_board_update_old_breakages (SudokuBoard* self,
                                        gint row,
                                        gint col,
                                        gint val);
static void sudoku_board_add_to_occurrences (SudokuBoard* self,
                                      gint row,
                                      gint col,
                                      gint val,
                                      gint add);
static void sudoku_board_mark_breakages (SudokuBoard* self,
                                  gint row,
                                  gint col,
                                  gint val);
static void sudoku_board_remove_breakages_for (SudokuBoard* self,
                                        GeeSet* coords,
                                        gint val);
static void sudoku_board_mark_breakages_for (SudokuBoard* self,
                                      GeeList* coords,
                                      gint val);
static void _vala_array_add1 (gint* * array,
                       gint* length,
                       gint* size,
                       gint value);
static gint sudoku_board_to_printable_ascii (SudokuBoard* self,
                                      gint val1,
                                      gint val2);
static void sudoku_board_set_block_rows (SudokuBoard* self,
                                  gint value);
static void sudoku_board_set_block_cols (SudokuBoard* self,
                                  gint value);
static void sudoku_board_set_rows (SudokuBoard* self,
                            gint value);
static void sudoku_board_set_cols (SudokuBoard* self,
                            gint value);
static void g_cclosure_user_marshal_VOID__INT_INT_INT_BOOLEAN (GClosure * closure,
                                                        GValue * return_value,
                                                        guint n_param_values,
                                                        const GValue * param_values,
                                                        gpointer invocation_hint,
                                                        gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__INT_INT_INT_INT (GClosure * closure,
                                                    GValue * return_value,
                                                    guint n_param_values,
                                                    const GValue * param_values,
                                                    gpointer invocation_hint,
                                                    gpointer marshal_data);
static gboolean* _vala_array_dup6 (gboolean* self,
                            gssize length);
static gint* _vala_array_dup7 (gint* self,
                        gssize length);
static gint* _vala_array_dup8 (gint* self,
                        gssize length);
static gint* _vala_array_dup9 (gint* self,
                        gssize length);
static void sudoku_board_finalize (GObject * obj);
static GType sudoku_board_get_type_once (void);
static void _vala_sudoku_board_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec);
static void _vala_sudoku_board_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
sudoku_board_get_instance_private (SudokuBoard* self)
{
	return G_STRUCT_MEMBER_P (self, SudokuBoard_private_offset);
}

static void
_vala_SudokuBoardCell_array_free (SudokuBoardCell * array,
                                  gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			sudoku_board_cell_destroy (&array[i]);
		}
	}
	g_free (array);
}

static void
_vala_SudokuBoardDigitOccurences_array_free (SudokuBoardDigitOccurences * array,
                                             gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			sudoku_board_digit_occurences_destroy (&array[i]);
		}
	}
	g_free (array);
}

gboolean
sudoku_board_is_empty (SudokuBoard* self)
{
	gboolean _tmp0_ = FALSE;
	gint _tmp1_;
	gint _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = self->priv->_filled;
	_tmp2_ = self->priv->_fixed;
	if (_tmp1_ == _tmp2_) {
		_tmp0_ = self->priv->n_earmarks == 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

gboolean
sudoku_board_is_fully_filled (SudokuBoard* self)
{
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_filled;
	_tmp1_ = self->priv->_cols;
	_tmp2_ = self->priv->_rows;
	result = _tmp0_ == (_tmp1_ * _tmp2_);
	return result;
}

SudokuBoard*
sudoku_board_construct (GType object_type)
{
	SudokuBoard * self = NULL;
	gint _tmp0_;
	gint _tmp1_;
	SudokuBoardCell* _tmp2_;
	gint _tmp13_;
	gint _tmp14_;
	SudokuBoardDigitOccurences* _tmp15_;
	GeeHashSet* _tmp30_;
	GeeHashSet* _tmp31_;
	GeeArrayList* _tmp32_;
	GeeArrayList* _tmp33_;
	GeeList* _tmp54_;
	GeeList* _tmp55_;
	GeeList* _tmp56_;
	GeeList* _tmp57_;
	GeeArrayList* _tmp58_;
	GeeArrayList* _tmp59_;
	GeeList* _tmp80_;
	GeeList* _tmp81_;
	GeeList* _tmp82_;
	GeeList* _tmp83_;
	GeeHashMap* _tmp84_;
	GeeHashMap* _tmp85_;
	GeeMap* _tmp124_;
	GeeMap* _tmp125_;
	GeeMap* _tmp126_;
	GeeMap* _tmp127_;
	gint _tmp128_;
	gint _tmp129_;
	GeeSet** _tmp130_;
	self = (SudokuBoard*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->_rows;
	_tmp1_ = self->priv->_cols;
	_tmp2_ = g_new0 (SudokuBoardCell, _tmp0_ * _tmp1_);
	self->priv->cells = (_vala_SudokuBoardCell_array_free (self->priv->cells, self->priv->cells_length1 * self->priv->cells_length2), NULL);
	self->priv->cells = _tmp2_;
	self->priv->cells_length1 = _tmp0_;
	self->priv->cells_length2 = _tmp1_;
	{
		gint row = 0;
		row = 0;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				gint _tmp5_;
				if (!_tmp3_) {
					gint _tmp4_;
					_tmp4_ = row;
					row = _tmp4_ + 1;
				}
				_tmp3_ = FALSE;
				_tmp5_ = self->priv->_rows;
				if (!(row < _tmp5_)) {
					break;
				}
				{
					gint col = 0;
					col = 0;
					{
						gboolean _tmp6_ = FALSE;
						_tmp6_ = TRUE;
						while (TRUE) {
							gint _tmp8_;
							SudokuBoardCell* _tmp9_;
							gint _tmp9__length1;
							gint _tmp9__length2;
							gint _tmp10_;
							gint _tmp11_;
							gboolean* _tmp12_;
							if (!_tmp6_) {
								gint _tmp7_;
								_tmp7_ = col;
								col = _tmp7_ + 1;
							}
							_tmp6_ = FALSE;
							_tmp8_ = self->priv->_cols;
							if (!(col < _tmp8_)) {
								break;
							}
							_tmp9_ = self->priv->cells;
							_tmp9__length1 = self->priv->cells_length1;
							_tmp9__length2 = self->priv->cells_length2;
							_tmp10_ = sudoku_board_get_max_val (self);
							_tmp11_ = _tmp10_;
							_tmp12_ = g_new0 (gboolean, _tmp11_);
							_tmp9_[(row * _tmp9__length2) + col].earmarks = (g_free (_tmp9_[(row * _tmp9__length2) + col].earmarks), NULL);
							_tmp9_[(row * _tmp9__length2) + col].earmarks = _tmp12_;
							_tmp9_[(row * _tmp9__length2) + col].earmarks_length1 = _tmp11_;
							_tmp9_[(row * _tmp9__length2) + col]._earmarks_size_ = _tmp9_[(row * _tmp9__length2) + col].earmarks_length1;
						}
					}
				}
			}
		}
	}
	_tmp13_ = sudoku_board_get_max_val (self);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_new0 (SudokuBoardDigitOccurences, _tmp14_);
	self->priv->digits = (_vala_SudokuBoardDigitOccurences_array_free (self->priv->digits, self->priv->digits_length1), NULL);
	self->priv->digits = _tmp15_;
	self->priv->digits_length1 = _tmp14_;
	self->priv->_digits_size_ = self->priv->digits_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp16_ = FALSE;
			_tmp16_ = TRUE;
			while (TRUE) {
				gint _tmp18_;
				gint _tmp19_;
				SudokuBoardDigitOccurences* _tmp20_;
				gint _tmp20__length1;
				gint _tmp21_;
				gint* _tmp22_;
				SudokuBoardDigitOccurences* _tmp23_;
				gint _tmp23__length1;
				gint _tmp24_;
				gint* _tmp25_;
				SudokuBoardDigitOccurences* _tmp26_;
				gint _tmp26__length1;
				gint _tmp27_;
				gint _tmp28_;
				gint* _tmp29_;
				if (!_tmp16_) {
					gint _tmp17_;
					_tmp17_ = i;
					i = _tmp17_ + 1;
				}
				_tmp16_ = FALSE;
				_tmp18_ = sudoku_board_get_max_val (self);
				_tmp19_ = _tmp18_;
				if (!(i < _tmp19_)) {
					break;
				}
				_tmp20_ = self->priv->digits;
				_tmp20__length1 = self->priv->digits_length1;
				_tmp21_ = self->priv->_rows;
				_tmp22_ = g_new0 (gint, _tmp21_);
				_tmp20_[i].occurrences_in_row = (g_free (_tmp20_[i].occurrences_in_row), NULL);
				_tmp20_[i].occurrences_in_row = _tmp22_;
				_tmp20_[i].occurrences_in_row_length1 = _tmp21_;
				_tmp20_[i]._occurrences_in_row_size_ = _tmp20_[i].occurrences_in_row_length1;
				_tmp23_ = self->priv->digits;
				_tmp23__length1 = self->priv->digits_length1;
				_tmp24_ = self->priv->_cols;
				_tmp25_ = g_new0 (gint, _tmp24_);
				_tmp23_[i].occurrences_in_col = (g_free (_tmp23_[i].occurrences_in_col), NULL);
				_tmp23_[i].occurrences_in_col = _tmp25_;
				_tmp23_[i].occurrences_in_col_length1 = _tmp24_;
				_tmp23_[i]._occurrences_in_col_size_ = _tmp23_[i].occurrences_in_col_length1;
				_tmp26_ = self->priv->digits;
				_tmp26__length1 = self->priv->digits_length1;
				_tmp27_ = self->priv->_block_rows;
				_tmp28_ = self->priv->_block_cols;
				_tmp29_ = g_new0 (gint, _tmp27_ * _tmp28_);
				_tmp26_[i].occurrences_in_block = (g_free (_tmp26_[i].occurrences_in_block), NULL);
				_tmp26_[i].occurrences_in_block = _tmp29_;
				_tmp26_[i].occurrences_in_block_length1 = _tmp27_;
				_tmp26_[i].occurrences_in_block_length2 = _tmp28_;
			}
		}
	}
	_tmp30_ = gee_hash_set_new (TYPE_COORD, (GBoxedCopyFunc) coord_dup, (GDestroyNotify) coord_free, (GeeHashDataFunc) coord_hash, NULL, NULL, (GeeEqualDataFunc) coord_equal, NULL, NULL);
	_tmp31_ = _tmp30_;
	sudoku_board_set_broken_coords (self, (GeeSet*) _tmp31_);
	_g_object_unref0 (_tmp31_);
	_tmp32_ = gee_array_list_new (GEE_TYPE_ARRAY_LIST, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_tmp33_ = _tmp32_;
	sudoku_board_set_coords_for_col (self, (GeeList*) _tmp33_);
	_g_object_unref0 (_tmp33_);
	{
		gint col = 0;
		col = 0;
		{
			gboolean _tmp34_ = FALSE;
			_tmp34_ = TRUE;
			while (TRUE) {
				gint _tmp36_;
				GeeList* _tmp37_;
				GeeArrayList* _tmp38_;
				GeeArrayList* _tmp39_;
				GeeList* _tmp47_;
				GeeList* _tmp48_;
				gpointer _tmp49_;
				GeeList* _tmp50_;
				GeeList* _tmp51_;
				GeeList* _tmp52_;
				GeeList* _tmp53_;
				if (!_tmp34_) {
					gint _tmp35_;
					_tmp35_ = col;
					col = _tmp35_ + 1;
				}
				_tmp34_ = FALSE;
				_tmp36_ = self->priv->_cols;
				if (!(col < _tmp36_)) {
					break;
				}
				_tmp37_ = self->priv->_coords_for_col;
				_tmp38_ = gee_array_list_new (TYPE_COORD, (GBoxedCopyFunc) coord_dup, (GDestroyNotify) coord_free, (GeeEqualDataFunc) coord_equal, NULL, NULL);
				_tmp39_ = _tmp38_;
				gee_collection_add ((GeeCollection*) _tmp37_, (GeeList*) _tmp39_);
				_g_object_unref0 (_tmp39_);
				{
					gint row = 0;
					row = 0;
					{
						gboolean _tmp40_ = FALSE;
						_tmp40_ = TRUE;
						while (TRUE) {
							gint _tmp42_;
							GeeList* _tmp43_;
							gpointer _tmp44_;
							GeeList* _tmp45_;
							Coord _tmp46_ = {0};
							if (!_tmp40_) {
								gint _tmp41_;
								_tmp41_ = row;
								row = _tmp41_ + 1;
							}
							_tmp40_ = FALSE;
							_tmp42_ = self->priv->_rows;
							if (!(row < _tmp42_)) {
								break;
							}
							_tmp43_ = self->priv->_coords_for_col;
							_tmp44_ = gee_list_get (_tmp43_, col);
							_tmp45_ = (GeeList*) _tmp44_;
							coord_init (&_tmp46_, row, col);
							gee_collection_add ((GeeCollection*) _tmp45_, &_tmp46_);
							_g_object_unref0 (_tmp45_);
						}
					}
				}
				_tmp47_ = self->priv->_coords_for_col;
				_tmp48_ = self->priv->_coords_for_col;
				_tmp49_ = gee_list_get (_tmp48_, col);
				_tmp50_ = (GeeList*) _tmp49_;
				_tmp51_ = gee_list_get_read_only_view (_tmp50_);
				_tmp52_ = _tmp51_;
				_tmp53_ = _tmp52_;
				gee_list_set (_tmp47_, col, _tmp53_);
				_g_object_unref0 (_tmp53_);
				_g_object_unref0 (_tmp50_);
			}
		}
	}
	_tmp54_ = self->priv->_coords_for_col;
	_tmp55_ = gee_list_get_read_only_view (_tmp54_);
	_tmp56_ = _tmp55_;
	_tmp57_ = _tmp56_;
	sudoku_board_set_coords_for_col (self, _tmp57_);
	_g_object_unref0 (_tmp57_);
	_tmp58_ = gee_array_list_new (GEE_TYPE_ARRAY_LIST, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_tmp59_ = _tmp58_;
	sudoku_board_set_coords_for_row (self, (GeeList*) _tmp59_);
	_g_object_unref0 (_tmp59_);
	{
		gint row = 0;
		row = 0;
		{
			gboolean _tmp60_ = FALSE;
			_tmp60_ = TRUE;
			while (TRUE) {
				gint _tmp62_;
				GeeList* _tmp63_;
				GeeArrayList* _tmp64_;
				GeeArrayList* _tmp65_;
				GeeList* _tmp73_;
				GeeList* _tmp74_;
				gpointer _tmp75_;
				GeeList* _tmp76_;
				GeeList* _tmp77_;
				GeeList* _tmp78_;
				GeeList* _tmp79_;
				if (!_tmp60_) {
					gint _tmp61_;
					_tmp61_ = row;
					row = _tmp61_ + 1;
				}
				_tmp60_ = FALSE;
				_tmp62_ = self->priv->_rows;
				if (!(row < _tmp62_)) {
					break;
				}
				_tmp63_ = self->priv->_coords_for_row;
				_tmp64_ = gee_array_list_new (TYPE_COORD, (GBoxedCopyFunc) coord_dup, (GDestroyNotify) coord_free, (GeeEqualDataFunc) coord_equal, NULL, NULL);
				_tmp65_ = _tmp64_;
				gee_collection_add ((GeeCollection*) _tmp63_, (GeeList*) _tmp65_);
				_g_object_unref0 (_tmp65_);
				{
					gint col = 0;
					col = 0;
					{
						gboolean _tmp66_ = FALSE;
						_tmp66_ = TRUE;
						while (TRUE) {
							gint _tmp68_;
							GeeList* _tmp69_;
							gpointer _tmp70_;
							GeeList* _tmp71_;
							Coord _tmp72_ = {0};
							if (!_tmp66_) {
								gint _tmp67_;
								_tmp67_ = col;
								col = _tmp67_ + 1;
							}
							_tmp66_ = FALSE;
							_tmp68_ = self->priv->_cols;
							if (!(col < _tmp68_)) {
								break;
							}
							_tmp69_ = self->priv->_coords_for_row;
							_tmp70_ = gee_list_get (_tmp69_, row);
							_tmp71_ = (GeeList*) _tmp70_;
							coord_init (&_tmp72_, row, col);
							gee_collection_add ((GeeCollection*) _tmp71_, &_tmp72_);
							_g_object_unref0 (_tmp71_);
						}
					}
				}
				_tmp73_ = self->priv->_coords_for_row;
				_tmp74_ = self->priv->_coords_for_row;
				_tmp75_ = gee_list_get (_tmp74_, row);
				_tmp76_ = (GeeList*) _tmp75_;
				_tmp77_ = gee_list_get_read_only_view (_tmp76_);
				_tmp78_ = _tmp77_;
				_tmp79_ = _tmp78_;
				gee_list_set (_tmp73_, row, _tmp79_);
				_g_object_unref0 (_tmp79_);
				_g_object_unref0 (_tmp76_);
			}
		}
	}
	_tmp80_ = self->priv->_coords_for_row;
	_tmp81_ = gee_list_get_read_only_view (_tmp80_);
	_tmp82_ = _tmp81_;
	_tmp83_ = _tmp82_;
	sudoku_board_set_coords_for_row (self, _tmp83_);
	_g_object_unref0 (_tmp83_);
	_tmp84_ = gee_hash_map_new (TYPE_COORD, (GBoxedCopyFunc) coord_dup, (GDestroyNotify) coord_free, GEE_TYPE_LIST, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GeeHashDataFunc) coord_hash, NULL, NULL, (GeeEqualDataFunc) coord_equal, NULL, NULL, NULL, NULL, NULL);
	_tmp85_ = _tmp84_;
	sudoku_board_set_coords_for_block (self, (GeeMap*) _tmp85_);
	_g_object_unref0 (_tmp85_);
	{
		gint col = 0;
		col = 0;
		{
			gboolean _tmp86_ = FALSE;
			_tmp86_ = TRUE;
			while (TRUE) {
				gint _tmp88_;
				if (!_tmp86_) {
					gint _tmp87_;
					_tmp87_ = col;
					col = _tmp87_ + 1;
				}
				_tmp86_ = FALSE;
				_tmp88_ = self->priv->_block_cols;
				if (!(col < _tmp88_)) {
					break;
				}
				{
					gint row = 0;
					row = 0;
					{
						gboolean _tmp89_ = FALSE;
						_tmp89_ = TRUE;
						while (TRUE) {
							gint _tmp91_;
							GeeMap* _tmp92_;
							Coord _tmp93_ = {0};
							GeeArrayList* _tmp94_;
							GeeArrayList* _tmp95_;
							if (!_tmp89_) {
								gint _tmp90_;
								_tmp90_ = row;
								row = _tmp90_ + 1;
							}
							_tmp89_ = FALSE;
							_tmp91_ = self->priv->_block_rows;
							if (!(row < _tmp91_)) {
								break;
							}
							_tmp92_ = self->priv->_coords_for_block;
							coord_init (&_tmp93_, row, col);
							_tmp94_ = gee_array_list_new (TYPE_COORD, (GBoxedCopyFunc) coord_dup, (GDestroyNotify) coord_free, (GeeEqualDataFunc) coord_equal, NULL, NULL);
							_tmp95_ = _tmp94_;
							gee_map_set (_tmp92_, &_tmp93_, (GeeList*) _tmp95_);
							_g_object_unref0 (_tmp95_);
						}
					}
				}
			}
		}
	}
	{
		gint col = 0;
		col = 0;
		{
			gboolean _tmp96_ = FALSE;
			_tmp96_ = TRUE;
			while (TRUE) {
				gint _tmp98_;
				if (!_tmp96_) {
					gint _tmp97_;
					_tmp97_ = col;
					col = _tmp97_ + 1;
				}
				_tmp96_ = FALSE;
				_tmp98_ = self->priv->_cols;
				if (!(col < _tmp98_)) {
					break;
				}
				{
					gint row = 0;
					row = 0;
					{
						gboolean _tmp99_ = FALSE;
						_tmp99_ = TRUE;
						while (TRUE) {
							gint _tmp101_;
							GeeMap* _tmp102_;
							gint _tmp103_;
							gint _tmp104_;
							Coord _tmp105_ = {0};
							gpointer _tmp106_;
							GeeList* _tmp107_;
							Coord _tmp108_ = {0};
							if (!_tmp99_) {
								gint _tmp100_;
								_tmp100_ = row;
								row = _tmp100_ + 1;
							}
							_tmp99_ = FALSE;
							_tmp101_ = self->priv->_rows;
							if (!(row < _tmp101_)) {
								break;
							}
							_tmp102_ = self->priv->_coords_for_block;
							_tmp103_ = self->priv->_block_rows;
							_tmp104_ = self->priv->_block_cols;
							coord_init (&_tmp105_, row / _tmp103_, col / _tmp104_);
							_tmp106_ = gee_map_get (_tmp102_, &_tmp105_);
							_tmp107_ = (GeeList*) _tmp106_;
							coord_init (&_tmp108_, row, col);
							gee_collection_add ((GeeCollection*) _tmp107_, &_tmp108_);
							_g_object_unref0 (_tmp107_);
						}
					}
				}
			}
		}
	}
	{
		gint col = 0;
		col = 0;
		{
			gboolean _tmp109_ = FALSE;
			_tmp109_ = TRUE;
			while (TRUE) {
				gint _tmp111_;
				if (!_tmp109_) {
					gint _tmp110_;
					_tmp110_ = col;
					col = _tmp110_ + 1;
				}
				_tmp109_ = FALSE;
				_tmp111_ = self->priv->_block_cols;
				if (!(col < _tmp111_)) {
					break;
				}
				{
					gint row = 0;
					row = 0;
					{
						gboolean _tmp112_ = FALSE;
						_tmp112_ = TRUE;
						while (TRUE) {
							gint _tmp114_;
							GeeMap* _tmp115_;
							Coord _tmp116_ = {0};
							GeeMap* _tmp117_;
							Coord _tmp118_ = {0};
							gpointer _tmp119_;
							GeeList* _tmp120_;
							GeeList* _tmp121_;
							GeeList* _tmp122_;
							GeeList* _tmp123_;
							if (!_tmp112_) {
								gint _tmp113_;
								_tmp113_ = row;
								row = _tmp113_ + 1;
							}
							_tmp112_ = FALSE;
							_tmp114_ = self->priv->_block_rows;
							if (!(row < _tmp114_)) {
								break;
							}
							_tmp115_ = self->priv->_coords_for_block;
							coord_init (&_tmp116_, row, col);
							_tmp117_ = self->priv->_coords_for_block;
							coord_init (&_tmp118_, row, col);
							_tmp119_ = gee_map_get (_tmp117_, &_tmp118_);
							_tmp120_ = (GeeList*) _tmp119_;
							_tmp121_ = gee_list_get_read_only_view (_tmp120_);
							_tmp122_ = _tmp121_;
							_tmp123_ = _tmp122_;
							gee_map_set (_tmp115_, &_tmp116_, _tmp123_);
							_g_object_unref0 (_tmp123_);
							_g_object_unref0 (_tmp120_);
						}
					}
				}
			}
		}
	}
	_tmp124_ = self->priv->_coords_for_block;
	_tmp125_ = gee_map_get_read_only_view (_tmp124_);
	_tmp126_ = _tmp125_;
	_tmp127_ = _tmp126_;
	sudoku_board_set_coords_for_block (self, _tmp127_);
	_g_object_unref0 (_tmp127_);
	_tmp128_ = self->priv->_rows;
	_tmp129_ = self->priv->_cols;
	_tmp130_ = g_new0 (GeeSet*, (_tmp128_ * _tmp129_) + 1);
	self->aligned_coords_for_cell = (_vala_array_free (self->aligned_coords_for_cell, self->aligned_coords_for_cell_length1 * self->aligned_coords_for_cell_length2, (GDestroyNotify) g_object_unref), NULL);
	self->aligned_coords_for_cell = _tmp130_;
	self->aligned_coords_for_cell_length1 = _tmp128_;
	self->aligned_coords_for_cell_length2 = _tmp129_;
	{
		gint row = 0;
		row = 0;
		{
			gboolean _tmp131_ = FALSE;
			_tmp131_ = TRUE;
			while (TRUE) {
				gint _tmp133_;
				if (!_tmp131_) {
					gint _tmp132_;
					_tmp132_ = row;
					row = _tmp132_ + 1;
				}
				_tmp131_ = FALSE;
				_tmp133_ = self->priv->_rows;
				if (!(row < _tmp133_)) {
					break;
				}
				{
					gint col = 0;
					col = 0;
					{
						gboolean _tmp134_ = FALSE;
						_tmp134_ = TRUE;
						while (TRUE) {
							gint _tmp136_;
							GeeSet** _tmp137_;
							gint _tmp137__length1;
							gint _tmp137__length2;
							GeeHashSet* _tmp138_;
							gint row_block = 0;
							gint row_col = 0;
							if (!_tmp134_) {
								gint _tmp135_;
								_tmp135_ = col;
								col = _tmp135_ + 1;
							}
							_tmp134_ = FALSE;
							_tmp136_ = self->priv->_cols;
							if (!(col < _tmp136_)) {
								break;
							}
							_tmp137_ = self->aligned_coords_for_cell;
							_tmp137__length1 = self->aligned_coords_for_cell_length1;
							_tmp137__length2 = self->aligned_coords_for_cell_length2;
							_tmp138_ = gee_hash_set_new (TYPE_COORD, (GBoxedCopyFunc) coord_dup, (GDestroyNotify) coord_free, (GeeHashDataFunc) coord_hash, NULL, NULL, (GeeEqualDataFunc) coord_equal, NULL, NULL);
							_g_object_unref0 (_tmp137_[(row * _tmp137__length2) + col]);
							_tmp137_[(row * _tmp137__length2) + col] = (GeeSet*) _tmp138_;
							{
								gint i = 0;
								i = 0;
								{
									gboolean _tmp139_ = FALSE;
									_tmp139_ = TRUE;
									while (TRUE) {
										GeeSet** _tmp141_;
										gint _tmp141__length1;
										gint _tmp141__length2;
										GeeSet* _tmp142_;
										Coord _tmp143_ = {0};
										GeeSet** _tmp144_;
										gint _tmp144__length1;
										gint _tmp144__length2;
										GeeSet* _tmp145_;
										Coord _tmp146_ = {0};
										if (!_tmp139_) {
											gint _tmp140_;
											_tmp140_ = i;
											i = _tmp140_ + 1;
										}
										_tmp139_ = FALSE;
										if (!(i < 9)) {
											break;
										}
										_tmp141_ = self->aligned_coords_for_cell;
										_tmp141__length1 = self->aligned_coords_for_cell_length1;
										_tmp141__length2 = self->aligned_coords_for_cell_length2;
										_tmp142_ = _tmp141_[(row * _tmp141__length2) + col];
										coord_init (&_tmp143_, row, i);
										gee_collection_add ((GeeCollection*) _tmp142_, &_tmp143_);
										_tmp144_ = self->aligned_coords_for_cell;
										_tmp144__length1 = self->aligned_coords_for_cell_length1;
										_tmp144__length2 = self->aligned_coords_for_cell_length2;
										_tmp145_ = _tmp144_[(row * _tmp144__length2) + col];
										coord_init (&_tmp146_, i, col);
										gee_collection_add ((GeeCollection*) _tmp145_, &_tmp146_);
									}
								}
							}
							row_block = row / 3;
							row_col = col / 3;
							{
								gint i = 0;
								i = row_block * 3;
								{
									gboolean _tmp147_ = FALSE;
									_tmp147_ = TRUE;
									while (TRUE) {
										if (!_tmp147_) {
											gint _tmp148_;
											_tmp148_ = i;
											i = _tmp148_ + 1;
										}
										_tmp147_ = FALSE;
										if (!(i < ((row_block + 1) * 3))) {
											break;
										}
										{
											gint j = 0;
											j = row_col * 3;
											{
												gboolean _tmp149_ = FALSE;
												_tmp149_ = TRUE;
												while (TRUE) {
													GeeSet** _tmp151_;
													gint _tmp151__length1;
													gint _tmp151__length2;
													GeeSet* _tmp152_;
													Coord _tmp153_ = {0};
													if (!_tmp149_) {
														gint _tmp150_;
														_tmp150_ = j;
														j = _tmp150_ + 1;
													}
													_tmp149_ = FALSE;
													if (!(j < ((row_col + 1) * 3))) {
														break;
													}
													_tmp151_ = self->aligned_coords_for_cell;
													_tmp151__length1 = self->aligned_coords_for_cell_length1;
													_tmp151__length2 = self->aligned_coords_for_cell_length2;
													_tmp152_ = _tmp151_[(row * _tmp151__length2) + col];
													coord_init (&_tmp153_, i, j);
													gee_collection_add ((GeeCollection*) _tmp152_, &_tmp153_);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	return self;
}

SudokuBoard*
sudoku_board_new (void)
{
	return sudoku_board_construct (TYPE_SUDOKU_BOARD);
}

static gchar
string_get (const gchar* self,
            glong index)
{
	gchar _tmp0_;
	gchar result;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = ((gchar*) self)[index];
	result = _tmp0_;
	return result;
}

SudokuBoard*
sudoku_board_construct_from_string (GType object_type,
                                    const gchar* s,
                                    GError** error)
{
	SudokuBoard * self = NULL;
	gboolean _tmp0_ = FALSE;
	gint _tmp1_;
	gint _tmp2_;
	gint row = 0;
	gint col = 0;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (s != NULL, NULL);
	_tmp1_ = strlen (s);
	_tmp2_ = _tmp1_;
	if (_tmp2_ > 100) {
		_tmp0_ = TRUE;
	} else {
		gint _tmp3_;
		gint _tmp4_;
		_tmp3_ = strlen (s);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_ < 81;
	}
	sudoku_board_ctor_err (_tmp0_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (self);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	self = (SudokuBoard*) sudoku_board_construct (object_type);
	row = 0;
	col = 0;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				gint _tmp7_;
				gint _tmp8_;
				gchar c = '\0';
				gboolean _tmp11_ = FALSE;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				_tmp7_ = strlen (s);
				_tmp8_ = _tmp7_;
				if (!(i < _tmp8_)) {
					break;
				}
				c = string_get (s, (glong) i);
				if (c == '\n') {
					continue;
				}
				if (g_ascii_isdigit (c)) {
					sudoku_board_insert (self, row, col, g_ascii_digit_value (c), TRUE);
				} else {
					gboolean _tmp9_ = FALSE;
					gboolean _tmp10_ = FALSE;
					if (c != '.') {
						_tmp10_ = c != ' ';
					} else {
						_tmp10_ = FALSE;
					}
					if (_tmp10_) {
						_tmp9_ = c != '-';
					} else {
						_tmp9_ = FALSE;
					}
					if (_tmp9_) {
						continue;
					}
				}
				if (row == 8) {
					_tmp11_ = col == 8;
				} else {
					_tmp11_ = FALSE;
				}
				if (_tmp11_) {
					return self;
				} else {
					if (col == 8) {
						gint _tmp12_;
						_tmp12_ = row;
						row = _tmp12_ + 1;
						col = 0;
						continue;
					} else {
						gint _tmp13_;
						_tmp13_ = col;
						col = _tmp13_ + 1;
					}
				}
			}
		}
	}
	sudoku_board_ctor_err (TRUE, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (self);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	return self;
}

SudokuBoard*
sudoku_board_new_from_string (const gchar* s,
                              GError** error)
{
	return sudoku_board_construct_from_string (TYPE_SUDOKU_BOARD, s, error);
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

SudokuBoard*
sudoku_board_construct_from_ascii_string (GType object_type,
                                          const gchar* s,
                                          GError** error)
{
	SudokuBoard * self = NULL;
	GeeArrayList* sizes = NULL;
	GeeArrayList* _tmp0_;
	gint string_sum = 0;
	gint _tmp19_;
	gint _tmp20_;
	gchar* rows_cols = NULL;
	gint _tmp21_;
	gint _tmp22_;
	gchar* _tmp23_;
	gint count = 0;
	gint current_number = 0;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (s != NULL, NULL);
	sudoku_board_ctor_err (string_get (s, (glong) 0) != '#', &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (self);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	self = (SudokuBoard*) sudoku_board_construct (object_type);
	_tmp0_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, NULL, NULL, NULL);
	sizes = _tmp0_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				gint* sizes_array = NULL;
				gint _tmp3_ = 0;
				gint* _tmp4_;
				gint sizes_array_length1;
				gint _sizes_array_size_;
				GeeArrayList* _tmp5_;
				gint* _tmp6_;
				gint _tmp6__length1;
				gint _tmp7_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(i < 5)) {
					break;
				}
				_tmp4_ = sudoku_board_from_printable_ascii (self, (gint) string_get (s, (glong) (i + 1)), &_tmp3_);
				sizes_array = _tmp4_;
				sizes_array_length1 = _tmp3_;
				_sizes_array_size_ = sizes_array_length1;
				_tmp5_ = sizes;
				_tmp6_ = sizes_array;
				_tmp6__length1 = sizes_array_length1;
				_tmp7_ = _tmp6_[0];
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp5_, (gpointer) ((gintptr) _tmp7_));
				if (i != 4) {
					GeeArrayList* _tmp8_;
					gint* _tmp9_;
					gint _tmp9__length1;
					gint _tmp10_;
					_tmp8_ = sizes;
					_tmp9_ = sizes_array;
					_tmp9__length1 = sizes_array_length1;
					_tmp10_ = _tmp9_[1];
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp8_, (gpointer) ((gintptr) _tmp10_));
				}
				sizes_array = (g_free (sizes_array), NULL);
			}
		}
	}
	string_sum = 6;
	{
		GeeArrayList* _size_list = NULL;
		GeeArrayList* _tmp11_;
		gint _size_size = 0;
		GeeArrayList* _tmp12_;
		gint _tmp13_;
		gint _tmp14_;
		gint _size_index = 0;
		_tmp11_ = sizes;
		_size_list = _tmp11_;
		_tmp12_ = _size_list;
		_tmp13_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp12_);
		_tmp14_ = _tmp13_;
		_size_size = _tmp14_;
		_size_index = -1;
		while (TRUE) {
			gint _tmp15_;
			gint _tmp16_;
			gint size = 0;
			GeeArrayList* _tmp17_;
			gpointer _tmp18_;
			_size_index = _size_index + 1;
			_tmp15_ = _size_index;
			_tmp16_ = _size_size;
			if (!(_tmp15_ < _tmp16_)) {
				break;
			}
			_tmp17_ = _size_list;
			_tmp18_ = gee_abstract_list_get ((GeeAbstractList*) _tmp17_, _size_index);
			size = (gint) ((gintptr) _tmp18_);
			string_sum += size;
		}
	}
	_tmp19_ = strlen (s);
	_tmp20_ = _tmp19_;
	sudoku_board_ctor_err (string_sum != _tmp20_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (sizes);
			_g_object_unref0 (self);
			return NULL;
		} else {
			_g_object_unref0 (sizes);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	_tmp21_ = strlen (s);
	_tmp22_ = _tmp21_;
	_tmp23_ = string_slice (s, (glong) 6, (glong) _tmp22_);
	rows_cols = _tmp23_;
	count = 0;
	current_number = 0;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp24_ = FALSE;
			_tmp24_ = TRUE;
			while (TRUE) {
				const gchar* _tmp26_;
				gint _tmp27_;
				gint _tmp28_;
				gint val = 0;
				gint* coords = NULL;
				const gchar* _tmp32_;
				gint _tmp33_ = 0;
				gint* _tmp34_;
				gint coords_length1;
				gint _coords_size_;
				gint row = 0;
				gint* _tmp35_;
				gint _tmp35__length1;
				gint _tmp36_;
				gint col = 0;
				gint* _tmp37_;
				gint _tmp37__length1;
				gint _tmp38_;
				GeeArrayList* _tmp39_;
				gpointer _tmp40_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				_tmp26_ = rows_cols;
				_tmp27_ = strlen (_tmp26_);
				_tmp28_ = _tmp27_;
				if (!(i < _tmp28_)) {
					break;
				}
				while (TRUE) {
					GeeArrayList* _tmp29_;
					gpointer _tmp30_;
					gint _tmp31_;
					_tmp29_ = sizes;
					_tmp30_ = gee_abstract_list_get ((GeeAbstractList*) _tmp29_, current_number);
					if (!(count >= ((gint) ((gintptr) _tmp30_)))) {
						break;
					}
					count = 0;
					_tmp31_ = current_number;
					current_number = _tmp31_ + 1;
				}
				val = current_number + 1;
				_tmp32_ = rows_cols;
				_tmp34_ = sudoku_board_from_printable_ascii (self, (gint) string_get (_tmp32_, (glong) i), &_tmp33_);
				coords = _tmp34_;
				coords_length1 = _tmp33_;
				_coords_size_ = coords_length1;
				_tmp35_ = coords;
				_tmp35__length1 = coords_length1;
				_tmp36_ = _tmp35_[0];
				row = _tmp36_;
				_tmp37_ = coords;
				_tmp37__length1 = coords_length1;
				_tmp38_ = _tmp37_[1];
				col = _tmp38_;
				sudoku_board_insert (self, row, col, val, TRUE);
				_tmp39_ = sizes;
				_tmp40_ = gee_abstract_list_get ((GeeAbstractList*) _tmp39_, current_number);
				if (count < ((gint) ((gintptr) _tmp40_))) {
					gint _tmp41_;
					_tmp41_ = count;
					count = _tmp41_ + 1;
				}
				coords = (g_free (coords), NULL);
			}
		}
	}
	_g_free0 (rows_cols);
	_g_object_unref0 (sizes);
	return self;
}

SudokuBoard*
sudoku_board_new_from_ascii_string (const gchar* s,
                                    GError** error)
{
	return sudoku_board_construct_from_ascii_string (TYPE_SUDOKU_BOARD, s, error);
}

static JsonNode*
_vala_JsonNode_copy (JsonNode* self)
{
	return g_boxed_copy (json_node_get_type (), self);
}

static gpointer
__vala_JsonNode_copy0 (gpointer self)
{
	return self ? _vala_JsonNode_copy (self) : NULL;
}

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

SudokuBoard*
sudoku_board_construct_from_json (GType object_type,
                                  const gchar* path,
                                  GError** error)
{
	SudokuBoard * self = NULL;
	JsonParser* parser = NULL;
	JsonParser* _tmp0_;
	JsonNode* node = NULL;
	JsonParser* _tmp3_;
	JsonNode* _tmp4_;
	JsonNode* _tmp5_;
	JsonReader* reader = NULL;
	JsonNode* _tmp6_;
	JsonReader* _tmp7_;
	JsonReader* _tmp8_;
	JsonReader* _tmp9_;
	JsonReader* _tmp51_;
	JsonReader* _tmp52_;
	JsonReader* _tmp53_;
	JsonReader* _tmp54_;
	gboolean _tmp55_ = FALSE;
	gdouble _tmp56_;
	JsonReader* _tmp58_;
	JsonReader* _tmp59_;
	JsonReader* _tmp60_;
	JsonReader* _tmp61_;
	const gchar* _tmp62_;
	DifficultyCategory _tmp63_;
	JsonReader* _tmp64_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (path != NULL, NULL);
	self = (SudokuBoard*) sudoku_board_construct (object_type);
	_tmp0_ = json_parser_new ();
	parser = _tmp0_;
	{
		JsonParser* _tmp1_;
		_tmp1_ = parser;
		json_parser_load_from_file (_tmp1_, path, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _tmp2_;
		g_clear_error (&_inner_error0_);
		_tmp2_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_NOT_FOUND, "Save file doesn't exist");
		_inner_error0_ = _tmp2_;
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (parser);
			_g_object_unref0 (self);
			return NULL;
		} else {
			_g_object_unref0 (parser);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	_tmp3_ = parser;
	_tmp4_ = json_parser_get_root (_tmp3_);
	_tmp5_ = __vala_JsonNode_copy0 (_tmp4_);
	node = _tmp5_;
	_tmp6_ = node;
	_tmp7_ = json_reader_new (_tmp6_);
	reader = _tmp7_;
	_tmp8_ = reader;
	json_reader_read_member (_tmp8_, "cells");
	_tmp9_ = reader;
	sudoku_board_ctor_err (!json_reader_is_array (_tmp9_), &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (reader);
			__vala_JsonNode_free0 (node);
			_g_object_unref0 (parser);
			_g_object_unref0 (self);
			return NULL;
		} else {
			_g_object_unref0 (reader);
			__vala_JsonNode_free0 (node);
			_g_object_unref0 (parser);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp10_ = FALSE;
			_tmp10_ = TRUE;
			while (TRUE) {
				JsonReader* _tmp12_;
				JsonReader* _tmp13_;
				JsonReader* _tmp14_;
				gboolean _tmp15_ = FALSE;
				JsonReader* _tmp16_;
				JsonReader* _tmp18_;
				JsonReader* _tmp19_;
				gint row = 0;
				JsonReader* _tmp20_;
				gboolean _tmp21_ = FALSE;
				JsonReader* _tmp22_;
				JsonReader* _tmp23_;
				JsonReader* _tmp24_;
				gint col = 0;
				JsonReader* _tmp25_;
				gboolean _tmp26_ = FALSE;
				JsonReader* _tmp27_;
				JsonReader* _tmp28_;
				JsonReader* _tmp29_;
				JsonReader* _tmp30_;
				gint val = 0;
				JsonReader* _tmp31_;
				gboolean _tmp32_ = FALSE;
				JsonReader* _tmp33_;
				JsonReader* _tmp34_;
				JsonReader* _tmp35_;
				gboolean is_fixed = FALSE;
				JsonReader* _tmp36_;
				JsonReader* _tmp37_;
				JsonReader* _tmp38_;
				JsonReader* _tmp39_;
				JsonReader* _tmp49_;
				JsonReader* _tmp50_;
				if (!_tmp10_) {
					gint _tmp11_;
					_tmp11_ = i;
					i = _tmp11_ + 1;
				}
				_tmp10_ = FALSE;
				_tmp12_ = reader;
				if (!(i < json_reader_count_elements (_tmp12_))) {
					break;
				}
				_tmp13_ = reader;
				json_reader_read_element (_tmp13_, (guint) i);
				_tmp14_ = reader;
				json_reader_read_member (_tmp14_, "position");
				_tmp16_ = reader;
				if (!json_reader_is_array (_tmp16_)) {
					_tmp15_ = TRUE;
				} else {
					JsonReader* _tmp17_;
					_tmp17_ = reader;
					_tmp15_ = json_reader_count_elements (_tmp17_) != 2;
				}
				sudoku_board_ctor_err (_tmp15_, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					if (_inner_error0_->domain == G_IO_ERROR) {
						g_propagate_error (error, _inner_error0_);
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						_g_object_unref0 (self);
						return NULL;
					} else {
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return NULL;
					}
				}
				_tmp18_ = reader;
				json_reader_read_element (_tmp18_, (guint) 0);
				_tmp19_ = reader;
				sudoku_board_ctor_err (!json_reader_is_value (_tmp19_), &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					if (_inner_error0_->domain == G_IO_ERROR) {
						g_propagate_error (error, _inner_error0_);
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						_g_object_unref0 (self);
						return NULL;
					} else {
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return NULL;
					}
				}
				_tmp20_ = reader;
				row = (gint) json_reader_get_int_value (_tmp20_);
				if (row < 0) {
					_tmp21_ = TRUE;
				} else {
					_tmp21_ = row > 9;
				}
				sudoku_board_ctor_err (_tmp21_, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					if (_inner_error0_->domain == G_IO_ERROR) {
						g_propagate_error (error, _inner_error0_);
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						_g_object_unref0 (self);
						return NULL;
					} else {
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return NULL;
					}
				}
				_tmp22_ = reader;
				json_reader_end_element (_tmp22_);
				_tmp23_ = reader;
				json_reader_read_element (_tmp23_, (guint) 1);
				_tmp24_ = reader;
				sudoku_board_ctor_err (!json_reader_is_value (_tmp24_), &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					if (_inner_error0_->domain == G_IO_ERROR) {
						g_propagate_error (error, _inner_error0_);
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						_g_object_unref0 (self);
						return NULL;
					} else {
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return NULL;
					}
				}
				_tmp25_ = reader;
				col = (gint) json_reader_get_int_value (_tmp25_);
				if (col < 0) {
					_tmp26_ = TRUE;
				} else {
					_tmp26_ = col > 9;
				}
				sudoku_board_ctor_err (_tmp26_, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					if (_inner_error0_->domain == G_IO_ERROR) {
						g_propagate_error (error, _inner_error0_);
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						_g_object_unref0 (self);
						return NULL;
					} else {
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return NULL;
					}
				}
				_tmp27_ = reader;
				json_reader_end_element (_tmp27_);
				_tmp28_ = reader;
				json_reader_end_member (_tmp28_);
				_tmp29_ = reader;
				json_reader_read_member (_tmp29_, "value");
				_tmp30_ = reader;
				sudoku_board_ctor_err (!json_reader_is_value (_tmp30_), &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					if (_inner_error0_->domain == G_IO_ERROR) {
						g_propagate_error (error, _inner_error0_);
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						_g_object_unref0 (self);
						return NULL;
					} else {
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return NULL;
					}
				}
				_tmp31_ = reader;
				val = (gint) json_reader_get_int_value (_tmp31_);
				if (val < 0) {
					_tmp32_ = TRUE;
				} else {
					_tmp32_ = val > 9;
				}
				sudoku_board_ctor_err (_tmp32_, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					if (_inner_error0_->domain == G_IO_ERROR) {
						g_propagate_error (error, _inner_error0_);
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						_g_object_unref0 (self);
						return NULL;
					} else {
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return NULL;
					}
				}
				_tmp33_ = reader;
				json_reader_end_member (_tmp33_);
				_tmp34_ = reader;
				json_reader_read_member (_tmp34_, "fixed");
				_tmp35_ = reader;
				sudoku_board_ctor_err (!json_reader_is_value (_tmp35_), &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					if (_inner_error0_->domain == G_IO_ERROR) {
						g_propagate_error (error, _inner_error0_);
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						_g_object_unref0 (self);
						return NULL;
					} else {
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return NULL;
					}
				}
				_tmp36_ = reader;
				is_fixed = json_reader_get_boolean_value (_tmp36_);
				_tmp37_ = reader;
				json_reader_end_member (_tmp37_);
				if (val != 0) {
					sudoku_board_insert (self, row, col, val, is_fixed);
				}
				_tmp38_ = reader;
				json_reader_read_member (_tmp38_, "earmarks");
				_tmp39_ = reader;
				sudoku_board_ctor_err (!json_reader_is_array (_tmp39_), &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					if (_inner_error0_->domain == G_IO_ERROR) {
						g_propagate_error (error, _inner_error0_);
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						_g_object_unref0 (self);
						return NULL;
					} else {
						_g_object_unref0 (reader);
						__vala_JsonNode_free0 (node);
						_g_object_unref0 (parser);
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
						g_clear_error (&_inner_error0_);
						return NULL;
					}
				}
				{
					gint k = 0;
					k = 0;
					{
						gboolean _tmp40_ = FALSE;
						_tmp40_ = TRUE;
						while (TRUE) {
							JsonReader* _tmp42_;
							JsonReader* _tmp43_;
							JsonReader* _tmp44_;
							gint earmark = 0;
							JsonReader* _tmp45_;
							gboolean _tmp46_ = FALSE;
							gboolean _tmp47_ = FALSE;
							JsonReader* _tmp48_;
							if (!_tmp40_) {
								gint _tmp41_;
								_tmp41_ = k;
								k = _tmp41_ + 1;
							}
							_tmp40_ = FALSE;
							_tmp42_ = reader;
							if (!(k < json_reader_count_elements (_tmp42_))) {
								break;
							}
							_tmp43_ = reader;
							json_reader_read_element (_tmp43_, (guint) k);
							_tmp44_ = reader;
							sudoku_board_ctor_err (!json_reader_is_value (_tmp44_), &_inner_error0_);
							if (G_UNLIKELY (_inner_error0_ != NULL)) {
								if (_inner_error0_->domain == G_IO_ERROR) {
									g_propagate_error (error, _inner_error0_);
									_g_object_unref0 (reader);
									__vala_JsonNode_free0 (node);
									_g_object_unref0 (parser);
									_g_object_unref0 (self);
									return NULL;
								} else {
									_g_object_unref0 (reader);
									__vala_JsonNode_free0 (node);
									_g_object_unref0 (parser);
									g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
									g_clear_error (&_inner_error0_);
									return NULL;
								}
							}
							_tmp45_ = reader;
							earmark = (gint) json_reader_get_int_value (_tmp45_);
							if (earmark < 0) {
								_tmp47_ = TRUE;
							} else {
								_tmp47_ = earmark > 10;
							}
							if (_tmp47_) {
								_tmp46_ = TRUE;
							} else {
								_tmp46_ = sudoku_board_is_earmark_enabled (self, row, col, earmark);
							}
							sudoku_board_ctor_err (_tmp46_, &_inner_error0_);
							if (G_UNLIKELY (_inner_error0_ != NULL)) {
								if (_inner_error0_->domain == G_IO_ERROR) {
									g_propagate_error (error, _inner_error0_);
									_g_object_unref0 (reader);
									__vala_JsonNode_free0 (node);
									_g_object_unref0 (parser);
									_g_object_unref0 (self);
									return NULL;
								} else {
									_g_object_unref0 (reader);
									__vala_JsonNode_free0 (node);
									_g_object_unref0 (parser);
									g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
									g_clear_error (&_inner_error0_);
									return NULL;
								}
							}
							sudoku_board_enable_earmark (self, row, col, earmark);
							_tmp48_ = reader;
							json_reader_end_element (_tmp48_);
						}
					}
				}
				_tmp49_ = reader;
				json_reader_end_member (_tmp49_);
				_tmp50_ = reader;
				json_reader_end_element (_tmp50_);
			}
		}
	}
	_tmp51_ = reader;
	json_reader_end_member (_tmp51_);
	_tmp52_ = reader;
	json_reader_read_member (_tmp52_, "time_elapsed");
	_tmp53_ = reader;
	sudoku_board_ctor_err (!json_reader_is_value (_tmp53_), &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (reader);
			__vala_JsonNode_free0 (node);
			_g_object_unref0 (parser);
			_g_object_unref0 (self);
			return NULL;
		} else {
			_g_object_unref0 (reader);
			__vala_JsonNode_free0 (node);
			_g_object_unref0 (parser);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	_tmp54_ = reader;
	sudoku_board_set_previous_played_time (self, json_reader_get_double_value (_tmp54_));
	_tmp56_ = self->priv->_previous_played_time;
	if (_tmp56_ < ((gdouble) 0)) {
		gdouble _tmp57_;
		_tmp57_ = self->priv->_previous_played_time;
		_tmp55_ = _tmp57_ != ((gdouble) -1);
	} else {
		_tmp55_ = FALSE;
	}
	sudoku_board_ctor_err (_tmp55_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (reader);
			__vala_JsonNode_free0 (node);
			_g_object_unref0 (parser);
			_g_object_unref0 (self);
			return NULL;
		} else {
			_g_object_unref0 (reader);
			__vala_JsonNode_free0 (node);
			_g_object_unref0 (parser);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	_tmp58_ = reader;
	json_reader_end_member (_tmp58_);
	_tmp59_ = reader;
	json_reader_read_member (_tmp59_, "difficulty_category");
	_tmp60_ = reader;
	sudoku_board_ctor_err (!json_reader_is_value (_tmp60_), &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (reader);
			__vala_JsonNode_free0 (node);
			_g_object_unref0 (parser);
			_g_object_unref0 (self);
			return NULL;
		} else {
			_g_object_unref0 (reader);
			__vala_JsonNode_free0 (node);
			_g_object_unref0 (parser);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	_tmp61_ = reader;
	_tmp62_ = json_reader_get_string_value (_tmp61_);
	sudoku_board_set_difficulty_category (self, difficulty_category_from_string (_tmp62_));
	_tmp63_ = self->priv->_difficulty_category;
	sudoku_board_ctor_err (_tmp63_ == DIFFICULTY_CATEGORY_UNKNOWN, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (reader);
			__vala_JsonNode_free0 (node);
			_g_object_unref0 (parser);
			_g_object_unref0 (self);
			return NULL;
		} else {
			_g_object_unref0 (reader);
			__vala_JsonNode_free0 (node);
			_g_object_unref0 (parser);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	_tmp64_ = reader;
	json_reader_end_member (_tmp64_);
	_g_object_unref0 (reader);
	__vala_JsonNode_free0 (node);
	_g_object_unref0 (parser);
	return self;
}

SudokuBoard*
sudoku_board_new_from_json (const gchar* path,
                            GError** error)
{
	return sudoku_board_construct_from_json (TYPE_SUDOKU_BOARD, path, error);
}

static void
sudoku_board_ctor_err (gboolean check,
                       GError** error)
{
	GError* _inner_error0_ = NULL;
	if (!check) {
		return;
	} else {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_NOT_FOUND, "Failed to construct the board");
		_inner_error0_ = _tmp0_;
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
}

static SudokuBoardCell*
_vala_array_dup2 (SudokuBoardCell* self,
                  gssize length)
{
	if (length > 0) {
		SudokuBoardCell* result;
		gssize i;
		result = g_new0 (SudokuBoardCell, length);
		for (i = 0; i < length; i++) {
			SudokuBoardCell _tmp0_;
			SudokuBoardCell _tmp1_ = {0};
			_tmp0_ = self[i];
			sudoku_board_cell_copy (&_tmp0_, &_tmp1_);
			result[i] = _tmp1_;
		}
		return result;
	}
	return NULL;
}

static SudokuBoardDigitOccurences*
_vala_array_dup3 (SudokuBoardDigitOccurences* self,
                  gssize length)
{
	if (length > 0) {
		SudokuBoardDigitOccurences* result;
		gssize i;
		result = g_new0 (SudokuBoardDigitOccurences, length);
		for (i = 0; i < length; i++) {
			SudokuBoardDigitOccurences _tmp0_;
			SudokuBoardDigitOccurences _tmp1_ = {0};
			_tmp0_ = self[i];
			sudoku_board_digit_occurences_copy (&_tmp0_, &_tmp1_);
			result[i] = _tmp1_;
		}
		return result;
	}
	return NULL;
}

SudokuBoard*
sudoku_board_clone (SudokuBoard* self)
{
	SudokuBoard* board = NULL;
	SudokuBoard* _tmp0_;
	SudokuBoardCell* _tmp1_;
	gint _tmp1__length1;
	gint _tmp1__length2;
	SudokuBoardCell* _tmp2_;
	gint _tmp2__length1;
	gint _tmp2__length2;
	SudokuBoardDigitOccurences* _tmp3_;
	gint _tmp3__length1;
	SudokuBoardDigitOccurences* _tmp4_;
	gint _tmp4__length1;
	gint _tmp5_;
	gint _tmp6_;
	GeeSet* _tmp7_;
	GeeSet* _tmp8_;
	DifficultyCategory _tmp9_;
	SudokuBoard* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = sudoku_board_new ();
	board = _tmp0_;
	_tmp1_ = self->priv->cells;
	_tmp1__length1 = self->priv->cells_length1;
	_tmp1__length2 = self->priv->cells_length2;
	_tmp2_ = (_tmp1_ != NULL) ? _vala_array_dup2 (_tmp1_, _tmp1__length1 * _tmp1__length2) : _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	_tmp2__length2 = _tmp1__length2;
	board->priv->cells = (_vala_SudokuBoardCell_array_free (board->priv->cells, board->priv->cells_length1 * board->priv->cells_length2), NULL);
	board->priv->cells = _tmp2_;
	board->priv->cells_length1 = _tmp2__length1;
	board->priv->cells_length2 = _tmp2__length2;
	_tmp3_ = self->priv->digits;
	_tmp3__length1 = self->priv->digits_length1;
	_tmp4_ = (_tmp3_ != NULL) ? _vala_array_dup3 (_tmp3_, _tmp3__length1) : _tmp3_;
	_tmp4__length1 = _tmp3__length1;
	board->priv->digits = (_vala_SudokuBoardDigitOccurences_array_free (board->priv->digits, board->priv->digits_length1), NULL);
	board->priv->digits = _tmp4_;
	board->priv->digits_length1 = _tmp4__length1;
	board->priv->_digits_size_ = board->priv->digits_length1;
	_tmp5_ = self->priv->_filled;
	sudoku_board_set_filled (board, _tmp5_);
	_tmp6_ = self->priv->_fixed;
	sudoku_board_set_fixed (board, _tmp6_);
	board->priv->n_earmarks = self->priv->n_earmarks;
	_tmp7_ = board->priv->_broken_coords;
	_tmp8_ = self->priv->_broken_coords;
	gee_collection_add_all ((GeeCollection*) _tmp7_, (GeeCollection*) _tmp8_);
	_tmp9_ = self->priv->_difficulty_category;
	sudoku_board_set_difficulty_category (board, _tmp9_);
	result = board;
	return result;
}

gint
sudoku_board_get (SudokuBoard* self,
                  gint row,
                  gint col)
{
	SudokuBoardCell* _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	SudokuBoardCell _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->cells;
	_tmp0__length1 = self->priv->cells_length1;
	_tmp0__length2 = self->priv->cells_length2;
	_tmp1_ = _tmp0_[(row * _tmp0__length2) + col];
	result = _tmp1_.value;
	return result;
}

static gboolean*
_vala_array_dup4 (gboolean* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gboolean));
	}
	return NULL;
}

gboolean*
sudoku_board_get_earmarks (SudokuBoard* self,
                           gint row,
                           gint col,
                           gint* result_length1)
{
	SudokuBoardCell* _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	SudokuBoardCell _tmp1_;
	gboolean* _tmp2_;
	gint _tmp2__length1;
	gboolean* _tmp3_;
	gint _tmp3__length1;
	gboolean* _tmp4_;
	gint _tmp4__length1;
	gboolean* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->cells;
	_tmp0__length1 = self->priv->cells_length1;
	_tmp0__length2 = self->priv->cells_length2;
	_tmp1_ = _tmp0_[(row * _tmp0__length2) + col];
	_tmp2_ = _tmp1_.earmarks;
	_tmp2__length1 = _tmp1_.earmarks_length1;
	_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup4 (_tmp2_, _tmp2__length1) : _tmp2_;
	_tmp3__length1 = _tmp2__length1;
	_tmp4_ = _tmp3_;
	_tmp4__length1 = _tmp3__length1;
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	return result;
}

gboolean
sudoku_board_get_is_fixed (SudokuBoard* self,
                           gint row,
                           gint col)
{
	SudokuBoardCell* _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	SudokuBoardCell _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->cells;
	_tmp0__length1 = self->priv->cells_length1;
	_tmp0__length2 = self->priv->cells_length2;
	_tmp1_ = _tmp0_[(row * _tmp0__length2) + col];
	result = _tmp1_.fixed;
	return result;
}

gint
sudoku_board_get_solution (SudokuBoard* self,
                           gint row,
                           gint col)
{
	SudokuBoardCell* _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	SudokuBoardCell _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->cells;
	_tmp0__length1 = self->priv->cells_length1;
	_tmp0__length2 = self->priv->cells_length2;
	_tmp1_ = _tmp0_[(row * _tmp0__length2) + col];
	result = _tmp1_.solution;
	return result;
}

gint*
sudoku_board_get_cells (SudokuBoard* self,
                        gint* result_length1,
                        gint* result_length2)
{
	gint* ret = NULL;
	gint _tmp0_;
	gint _tmp1_;
	gint* _tmp2_;
	gint ret_length1;
	gint ret_length2;
	gint* _tmp12_;
	gint _tmp12__length1;
	gint _tmp12__length2;
	gint* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_rows;
	_tmp1_ = self->priv->_cols;
	_tmp2_ = g_new0 (gint, _tmp0_ * _tmp1_);
	ret = _tmp2_;
	ret_length1 = _tmp0_;
	ret_length2 = _tmp1_;
	{
		gint row = 0;
		row = 0;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				gint _tmp5_;
				if (!_tmp3_) {
					gint _tmp4_;
					_tmp4_ = row;
					row = _tmp4_ + 1;
				}
				_tmp3_ = FALSE;
				_tmp5_ = self->priv->_rows;
				if (!(row < _tmp5_)) {
					break;
				}
				{
					gint col = 0;
					col = 0;
					{
						gboolean _tmp6_ = FALSE;
						_tmp6_ = TRUE;
						while (TRUE) {
							gint _tmp8_;
							gint* _tmp9_;
							gint _tmp9__length1;
							gint _tmp9__length2;
							SudokuBoardCell* _tmp10_;
							gint _tmp10__length1;
							gint _tmp10__length2;
							SudokuBoardCell _tmp11_;
							if (!_tmp6_) {
								gint _tmp7_;
								_tmp7_ = col;
								col = _tmp7_ + 1;
							}
							_tmp6_ = FALSE;
							_tmp8_ = self->priv->_cols;
							if (!(col < _tmp8_)) {
								break;
							}
							_tmp9_ = ret;
							_tmp9__length1 = ret_length1;
							_tmp9__length2 = ret_length2;
							_tmp10_ = self->priv->cells;
							_tmp10__length1 = self->priv->cells_length1;
							_tmp10__length2 = self->priv->cells_length2;
							_tmp11_ = _tmp10_[(row * _tmp10__length2) + col];
							_tmp9_[(row * _tmp9__length2) + col] = _tmp11_.value;
						}
					}
				}
			}
		}
	}
	_tmp12_ = ret;
	_tmp12__length1 = ret_length1;
	_tmp12__length2 = ret_length2;
	if (result_length1) {
		*result_length1 = _tmp12__length1;
	}
	if (result_length2) {
		*result_length2 = _tmp12__length2;
	}
	result = _tmp12_;
	return result;
}

static gint*
sudoku_board_get_fixed_cells (SudokuBoard* self,
                              gint* result_length1)
{
	gint* ret = NULL;
	gint _tmp0_;
	gint _tmp1_;
	gint* _tmp2_;
	gint ret_length1;
	gint _ret_size_;
	gint i = 0;
	SudokuBoardCell* _tmp3_;
	gint _tmp3__length1;
	gint _tmp3__length2;
	gint* _tmp11_;
	gint _tmp11__length1;
	gint* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_rows;
	_tmp1_ = self->priv->_cols;
	_tmp2_ = g_new0 (gint, _tmp0_ * _tmp1_);
	ret = _tmp2_;
	ret_length1 = _tmp0_ * _tmp1_;
	_ret_size_ = ret_length1;
	i = 0;
	_tmp3_ = self->priv->cells;
	_tmp3__length1 = self->priv->cells_length1;
	_tmp3__length2 = self->priv->cells_length2;
	{
		SudokuBoardCell* cell_collection = NULL;
		gint cell_collection_length1 = 0;
		gint cell_collection_length2 = 0;
		gint cell_it = 0;
		cell_collection = _tmp3_;
		cell_collection_length1 = _tmp3__length1 * _tmp3__length2;
		for (cell_it = 0; cell_it < cell_collection_length1; cell_it = cell_it + 1) {
			SudokuBoardCell _tmp4_;
			SudokuBoardCell _tmp5_ = {0};
			SudokuBoardCell cell = {0};
			_tmp4_ = cell_collection[cell_it];
			sudoku_board_cell_copy (&_tmp4_, &_tmp5_);
			cell = _tmp5_;
			{
				SudokuBoardCell _tmp6_;
				gint _tmp10_;
				_tmp6_ = cell;
				if (_tmp6_.fixed) {
					gint* _tmp7_;
					gint _tmp7__length1;
					SudokuBoardCell _tmp8_;
					_tmp7_ = ret;
					_tmp7__length1 = ret_length1;
					_tmp8_ = cell;
					_tmp7_[i] = _tmp8_.value;
				} else {
					gint* _tmp9_;
					gint _tmp9__length1;
					_tmp9_ = ret;
					_tmp9__length1 = ret_length1;
					_tmp9_[i] = 0;
				}
				_tmp10_ = i;
				i = _tmp10_ + 1;
				sudoku_board_cell_destroy (&cell);
			}
		}
	}
	_tmp11_ = ret;
	_tmp11__length1 = ret_length1;
	if (result_length1) {
		*result_length1 = _tmp11__length1;
	}
	result = _tmp11_;
	return result;
}

static gint*
_vala_array_dup5 (gint* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gint));
	}
	return NULL;
}

gint*
sudoku_board_get_possibilities (SudokuBoard* self,
                                gint row,
                                gint col,
                                gint* result_length1)
{
	SudokuBoardCell* _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	SudokuBoardCell _tmp1_;
	gint* possibilities = NULL;
	gint* _tmp4_;
	gint possibilities_length1;
	gint _possibilities_size_;
	gint count = 0;
	gint* _tmp11_;
	gint _tmp11__length1;
	gint* _tmp12_;
	gint _tmp12__length1;
	gint* _tmp13_;
	gint _tmp13__length1;
	gint* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->cells;
	_tmp0__length1 = self->priv->cells_length1;
	_tmp0__length2 = self->priv->cells_length2;
	_tmp1_ = _tmp0_[(row * _tmp0__length2) + col];
	if (_tmp1_.value != 0) {
		gint* _tmp2_;
		gint* _tmp3_;
		gint _tmp3__length1;
		_tmp2_ = g_new0 (gint, 0);
		_tmp3_ = _tmp2_;
		_tmp3__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp3__length1;
		}
		result = _tmp3_;
		return result;
	}
	_tmp4_ = g_new0 (gint, 9);
	possibilities = _tmp4_;
	possibilities_length1 = 9;
	_possibilities_size_ = possibilities_length1;
	count = 0;
	{
		gint l = 0;
		l = 1;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				gint _tmp7_;
				gint _tmp8_;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = l;
					l = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				_tmp7_ = sudoku_board_get_max_val (self);
				_tmp8_ = _tmp7_;
				if (!(l <= _tmp8_)) {
					break;
				}
				if (sudoku_board_is_possible (self, row, col, l)) {
					gint* _tmp9_;
					gint _tmp9__length1;
					gint _tmp10_;
					_tmp9_ = possibilities;
					_tmp9__length1 = possibilities_length1;
					_tmp9_[count] = l;
					_tmp10_ = count;
					count = _tmp10_ + 1;
				}
			}
		}
	}
	_tmp11_ = possibilities;
	_tmp11__length1 = possibilities_length1;
	_tmp12_ = (_tmp11_ != NULL) ? _vala_array_dup5 (_tmp11_ + 0, count - 0) : _tmp11_;
	_tmp12__length1 = count - 0;
	_tmp13_ = _tmp12_;
	_tmp13__length1 = _tmp12__length1;
	if (result_length1) {
		*result_length1 = _tmp13__length1;
	}
	result = _tmp13_;
	possibilities = (g_free (possibilities), NULL);
	return result;
}

gboolean*
sudoku_board_get_possibilities_as_bool_array (SudokuBoard* self,
                                              gint row,
                                              gint col,
                                              gint* result_length1)
{
	gboolean* possibilities = NULL;
	gint _tmp0_;
	gint _tmp1_;
	gboolean* _tmp2_;
	gint possibilities_length1;
	gint _possibilities_size_;
	gboolean* _tmp8_;
	gint _tmp8__length1;
	gboolean* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = sudoku_board_get_max_val (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_new0 (gboolean, _tmp1_);
	possibilities = _tmp2_;
	possibilities_length1 = _tmp1_;
	_possibilities_size_ = possibilities_length1;
	{
		gint l = 0;
		l = 1;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				gint _tmp5_;
				gint _tmp6_;
				gboolean* _tmp7_;
				gint _tmp7__length1;
				if (!_tmp3_) {
					gint _tmp4_;
					_tmp4_ = l;
					l = _tmp4_ + 1;
				}
				_tmp3_ = FALSE;
				_tmp5_ = sudoku_board_get_max_val (self);
				_tmp6_ = _tmp5_;
				if (!(l <= _tmp6_)) {
					break;
				}
				_tmp7_ = possibilities;
				_tmp7__length1 = possibilities_length1;
				_tmp7_[l - 1] = sudoku_board_is_possible (self, row, col, l);
			}
		}
	}
	_tmp8_ = possibilities;
	_tmp8__length1 = possibilities_length1;
	if (result_length1) {
		*result_length1 = _tmp8__length1;
	}
	result = _tmp8_;
	return result;
}

void
sudoku_board_set (SudokuBoard* self,
                  gint row,
                  gint col,
                  gint val)
{
	gint old_val = 0;
	g_return_if_fail (self != NULL);
	old_val = sudoku_board_get (self, row, col);
	if (old_val == 0) {
		sudoku_board_disable_all_earmarks (self, row, col);
	}
	if (old_val == val) {
		return;
	}
	if (val == 0) {
		sudoku_board_remove (self, row, col);
	} else {
		sudoku_board_insert (self, row, col, val, FALSE);
	}
}

void
sudoku_board_set_all_fixed (SudokuBoard* self)
{
	g_return_if_fail (self != NULL);
	{
		gint row = 0;
		row = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gint _tmp2_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = row;
					row = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_rows;
				if (!(row < _tmp2_)) {
					break;
				}
				{
					gint col = 0;
					col = 0;
					{
						gboolean _tmp3_ = FALSE;
						_tmp3_ = TRUE;
						while (TRUE) {
							gint _tmp5_;
							SudokuBoardCell* _tmp6_;
							gint _tmp6__length1;
							gint _tmp6__length2;
							SudokuBoardCell _tmp7_;
							if (!_tmp3_) {
								gint _tmp4_;
								_tmp4_ = col;
								col = _tmp4_ + 1;
							}
							_tmp3_ = FALSE;
							_tmp5_ = self->priv->_cols;
							if (!(col < _tmp5_)) {
								break;
							}
							_tmp6_ = self->priv->cells;
							_tmp6__length1 = self->priv->cells_length1;
							_tmp6__length2 = self->priv->cells_length2;
							_tmp7_ = _tmp6_[(row * _tmp6__length2) + col];
							if (_tmp7_.value > 0) {
								SudokuBoardCell* _tmp8_;
								gint _tmp8__length1;
								gint _tmp8__length2;
								gint _tmp9_;
								_tmp8_ = self->priv->cells;
								_tmp8__length1 = self->priv->cells_length1;
								_tmp8__length2 = self->priv->cells_length2;
								_tmp8_[(row * _tmp8__length2) + col].fixed = TRUE;
								_tmp9_ = self->priv->_fixed;
								sudoku_board_set_fixed (self, _tmp9_ + 1);
							}
						}
					}
				}
			}
		}
	}
}

void
sudoku_board_enable_earmark (SudokuBoard* self,
                             gint row,
                             gint col,
                             gint num)
{
	SudokuBoardCell* _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	SudokuBoardCell _tmp1_;
	SudokuBoardCell* _tmp2_;
	gint _tmp2__length1;
	gint _tmp2__length2;
	SudokuBoardCell _tmp3_;
	gboolean* _tmp4_;
	gint _tmp4__length1;
	gboolean _tmp5_;
	SudokuBoardCell* _tmp6_;
	gint _tmp6__length1;
	gint _tmp6__length2;
	SudokuBoardCell _tmp7_;
	gboolean* _tmp8_;
	gint _tmp8__length1;
	gint _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->cells;
	_tmp0__length1 = self->priv->cells_length1;
	_tmp0__length2 = self->priv->cells_length2;
	_tmp1_ = _tmp0_[(row * _tmp0__length2) + col];
	_vala_return_if_fail (_tmp1_.value == 0, "cells[row, col].value == 0");
	_tmp2_ = self->priv->cells;
	_tmp2__length1 = self->priv->cells_length1;
	_tmp2__length2 = self->priv->cells_length2;
	_tmp3_ = _tmp2_[(row * _tmp2__length2) + col];
	_tmp4_ = _tmp3_.earmarks;
	_tmp4__length1 = _tmp3_.earmarks_length1;
	_tmp5_ = _tmp4_[num - 1];
	_vala_return_if_fail (!_tmp5_, "!cells[row, col].earmarks[num - 1]");
	_tmp6_ = self->priv->cells;
	_tmp6__length1 = self->priv->cells_length1;
	_tmp6__length2 = self->priv->cells_length2;
	_tmp7_ = _tmp6_[(row * _tmp6__length2) + col];
	_tmp8_ = _tmp7_.earmarks;
	_tmp8__length1 = _tmp7_.earmarks_length1;
	_tmp8_[num - 1] = TRUE;
	_tmp9_ = self->priv->n_earmarks;
	self->priv->n_earmarks = _tmp9_ + 1;
	g_signal_emit (self, sudoku_board_signals[SUDOKU_BOARD_EARMARK_CHANGED_SIGNAL], 0, row, col, num, TRUE);
}

void
sudoku_board_disable_earmark (SudokuBoard* self,
                              gint row,
                              gint col,
                              gint num)
{
	SudokuBoardCell* _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	SudokuBoardCell _tmp1_;
	SudokuBoardCell* _tmp2_;
	gint _tmp2__length1;
	gint _tmp2__length2;
	SudokuBoardCell _tmp3_;
	gboolean* _tmp4_;
	gint _tmp4__length1;
	gboolean _tmp5_;
	SudokuBoardCell* _tmp6_;
	gint _tmp6__length1;
	gint _tmp6__length2;
	SudokuBoardCell _tmp7_;
	gboolean* _tmp8_;
	gint _tmp8__length1;
	gint _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->cells;
	_tmp0__length1 = self->priv->cells_length1;
	_tmp0__length2 = self->priv->cells_length2;
	_tmp1_ = _tmp0_[(row * _tmp0__length2) + col];
	_vala_return_if_fail (_tmp1_.value == 0, "cells[row, col].value == 0");
	_tmp2_ = self->priv->cells;
	_tmp2__length1 = self->priv->cells_length1;
	_tmp2__length2 = self->priv->cells_length2;
	_tmp3_ = _tmp2_[(row * _tmp2__length2) + col];
	_tmp4_ = _tmp3_.earmarks;
	_tmp4__length1 = _tmp3_.earmarks_length1;
	_tmp5_ = _tmp4_[num - 1];
	_vala_return_if_fail (_tmp5_, "cells[row, col].earmarks[num - 1]");
	_tmp6_ = self->priv->cells;
	_tmp6__length1 = self->priv->cells_length1;
	_tmp6__length2 = self->priv->cells_length2;
	_tmp7_ = _tmp6_[(row * _tmp6__length2) + col];
	_tmp8_ = _tmp7_.earmarks;
	_tmp8__length1 = _tmp7_.earmarks_length1;
	_tmp8_[num - 1] = FALSE;
	_tmp9_ = self->priv->n_earmarks;
	self->priv->n_earmarks = _tmp9_ - 1;
	g_signal_emit (self, sudoku_board_signals[SUDOKU_BOARD_EARMARK_CHANGED_SIGNAL], 0, row, col, num, FALSE);
}

void
sudoku_board_disable_all_earmarks (SudokuBoard* self,
                                   gint row,
                                   gint col)
{
	g_return_if_fail (self != NULL);
	{
		gint num = 0;
		num = 1;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gint _tmp2_;
				gint _tmp3_;
				SudokuBoardCell* _tmp4_;
				gint _tmp4__length1;
				gint _tmp4__length2;
				SudokuBoardCell _tmp5_;
				gboolean* _tmp6_;
				gint _tmp6__length1;
				gboolean _tmp7_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = num;
					num = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = sudoku_board_get_max_val (self);
				_tmp3_ = _tmp2_;
				if (!(num <= _tmp3_)) {
					break;
				}
				_tmp4_ = self->priv->cells;
				_tmp4__length1 = self->priv->cells_length1;
				_tmp4__length2 = self->priv->cells_length2;
				_tmp5_ = _tmp4_[(row * _tmp4__length2) + col];
				_tmp6_ = _tmp5_.earmarks;
				_tmp6__length1 = _tmp5_.earmarks_length1;
				_tmp7_ = _tmp6_[num - 1];
				if (_tmp7_) {
					sudoku_board_disable_earmark (self, row, col, num);
				}
			}
		}
	}
}

gboolean
sudoku_board_is_earmark_enabled (SudokuBoard* self,
                                 gint row,
                                 gint col,
                                 gint num)
{
	SudokuBoardCell* _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	SudokuBoardCell _tmp1_;
	gboolean* _tmp2_;
	gint _tmp2__length1;
	gboolean _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->cells;
	_tmp0__length1 = self->priv->cells_length1;
	_tmp0__length2 = self->priv->cells_length2;
	_tmp1_ = _tmp0_[(row * _tmp0__length2) + col];
	_tmp2_ = _tmp1_.earmarks;
	_tmp2__length1 = _tmp1_.earmarks_length1;
	_tmp3_ = _tmp2_[num - 1];
	result = _tmp3_;
	return result;
}

gboolean
sudoku_board_is_possible (SudokuBoard* self,
                          gint row,
                          gint col,
                          gint val)
{
	SudokuBoardDigitOccurences digit = {0};
	SudokuBoardDigitOccurences* _tmp0_;
	gint _tmp0__length1;
	SudokuBoardDigitOccurences _tmp1_;
	SudokuBoardDigitOccurences _tmp2_;
	SudokuBoardDigitOccurences _tmp3_ = {0};
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	SudokuBoardDigitOccurences _tmp6_;
	gint* _tmp7_;
	gint _tmp7__length1;
	gint _tmp8_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->digits;
	_tmp0__length1 = self->priv->digits_length1;
	_tmp1_ = _tmp0_[val - 1];
	_tmp2_ = _tmp1_;
	sudoku_board_digit_occurences_copy (&_tmp2_, &_tmp3_);
	digit = _tmp3_;
	_tmp6_ = digit;
	_tmp7_ = _tmp6_.occurrences_in_row;
	_tmp7__length1 = _tmp6_.occurrences_in_row_length1;
	_tmp8_ = _tmp7_[row];
	if (_tmp8_ == 0) {
		SudokuBoardDigitOccurences _tmp9_;
		gint* _tmp10_;
		gint _tmp10__length1;
		gint _tmp11_;
		_tmp9_ = digit;
		_tmp10_ = _tmp9_.occurrences_in_col;
		_tmp10__length1 = _tmp9_.occurrences_in_col_length1;
		_tmp11_ = _tmp10_[col];
		_tmp5_ = _tmp11_ == 0;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		SudokuBoardDigitOccurences _tmp12_;
		gint* _tmp13_;
		gint _tmp13__length1;
		gint _tmp13__length2;
		gint _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		_tmp12_ = digit;
		_tmp13_ = _tmp12_.occurrences_in_block;
		_tmp13__length1 = _tmp12_.occurrences_in_block_length1;
		_tmp13__length2 = _tmp12_.occurrences_in_block_length2;
		_tmp14_ = self->priv->_block_rows;
		_tmp15_ = self->priv->_block_cols;
		_tmp16_ = _tmp13_[((row / _tmp14_) * _tmp13__length2) + (col / _tmp15_)];
		_tmp4_ = _tmp16_ == 0;
	} else {
		_tmp4_ = FALSE;
	}
	result = _tmp4_;
	sudoku_board_digit_occurences_destroy (&digit);
	return result;
}

void
sudoku_board_insert (SudokuBoard* self,
                     gint row,
                     gint col,
                     gint val,
                     gboolean is_fixed)
{
	gint _tmp0_;
	gint _tmp1_;
	SudokuBoardCell* _tmp2_;
	gint _tmp2__length1;
	gint _tmp2__length2;
	SudokuBoardCell _tmp3_;
	gint old_val = 0;
	SudokuBoardCell* _tmp4_;
	gint _tmp4__length1;
	gint _tmp4__length2;
	SudokuBoardCell _tmp5_;
	SudokuBoardCell* _tmp6_;
	gint _tmp6__length1;
	gint _tmp6__length2;
	SudokuBoardCell* _tmp7_;
	gint _tmp7__length1;
	gint _tmp7__length2;
	gboolean _tmp10_;
	gboolean _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = sudoku_board_get_max_val (self);
	_tmp1_ = _tmp0_;
	_vala_return_if_fail ((val > 0) && (val <= _tmp1_), "val > 0 && val <= max_val");
	_tmp2_ = self->priv->cells;
	_tmp2__length1 = self->priv->cells_length1;
	_tmp2__length2 = self->priv->cells_length2;
	_tmp3_ = _tmp2_[(row * _tmp2__length2) + col];
	_vala_return_if_fail (!_tmp3_.fixed, "!cells[row, col].fixed");
	_tmp4_ = self->priv->cells;
	_tmp4__length1 = self->priv->cells_length1;
	_tmp4__length2 = self->priv->cells_length2;
	_tmp5_ = _tmp4_[(row * _tmp4__length2) + col];
	old_val = _tmp5_.value;
	_tmp6_ = self->priv->cells;
	_tmp6__length1 = self->priv->cells_length1;
	_tmp6__length2 = self->priv->cells_length2;
	_tmp6_[(row * _tmp6__length2) + col].value = val;
	_tmp7_ = self->priv->cells;
	_tmp7__length1 = self->priv->cells_length1;
	_tmp7__length2 = self->priv->cells_length2;
	_tmp7_[(row * _tmp7__length2) + col].fixed = is_fixed;
	if (is_fixed) {
		gint _tmp8_;
		_tmp8_ = self->priv->_fixed;
		sudoku_board_set_fixed (self, _tmp8_ + 1);
	}
	if (old_val != 0) {
		sudoku_board_update_old_breakages (self, row, col, old_val);
	} else {
		gint _tmp9_;
		_tmp9_ = self->priv->_filled;
		sudoku_board_set_filled (self, _tmp9_ + 1);
	}
	sudoku_board_add_to_occurrences (self, row, col, val, 1);
	sudoku_board_mark_breakages (self, row, col, val);
	g_signal_emit (self, sudoku_board_signals[SUDOKU_BOARD_VALUE_CHANGED_SIGNAL], 0, row, col, old_val, val);
	_tmp10_ = sudoku_board_get_complete (self);
	_tmp11_ = _tmp10_;
	if (_tmp11_) {
		g_signal_emit (self, sudoku_board_signals[SUDOKU_BOARD_COMPLETED_SIGNAL], 0);
	}
}

void
sudoku_board_remove (SudokuBoard* self,
                     gint row,
                     gint col)
{
	SudokuBoardCell* _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	SudokuBoardCell _tmp1_;
	SudokuBoardCell* _tmp2_;
	gint _tmp2__length1;
	gint _tmp2__length2;
	SudokuBoardCell _tmp3_;
	gint old_val = 0;
	SudokuBoardCell* _tmp4_;
	gint _tmp4__length1;
	gint _tmp4__length2;
	SudokuBoardCell _tmp5_;
	SudokuBoardCell* _tmp6_;
	gint _tmp6__length1;
	gint _tmp6__length2;
	gint _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->cells;
	_tmp0__length1 = self->priv->cells_length1;
	_tmp0__length2 = self->priv->cells_length2;
	_tmp1_ = _tmp0_[(row * _tmp0__length2) + col];
	_vala_return_if_fail (_tmp1_.value > 0, "cells[row, col].value > 0");
	_tmp2_ = self->priv->cells;
	_tmp2__length1 = self->priv->cells_length1;
	_tmp2__length2 = self->priv->cells_length2;
	_tmp3_ = _tmp2_[(row * _tmp2__length2) + col];
	_vala_return_if_fail (!_tmp3_.fixed, "!cells[row, col].fixed");
	_tmp4_ = self->priv->cells;
	_tmp4__length1 = self->priv->cells_length1;
	_tmp4__length2 = self->priv->cells_length2;
	_tmp5_ = _tmp4_[(row * _tmp4__length2) + col];
	old_val = _tmp5_.value;
	_tmp6_ = self->priv->cells;
	_tmp6__length1 = self->priv->cells_length1;
	_tmp6__length2 = self->priv->cells_length2;
	_tmp6_[(row * _tmp6__length2) + col].value = 0;
	_tmp7_ = self->priv->_filled;
	sudoku_board_set_filled (self, _tmp7_ - 1);
	sudoku_board_update_old_breakages (self, row, col, old_val);
	g_signal_emit (self, sudoku_board_signals[SUDOKU_BOARD_VALUE_CHANGED_SIGNAL], 0, row, col, old_val, 0);
}

static void
sudoku_board_update_old_breakages (SudokuBoard* self,
                                   gint row,
                                   gint col,
                                   gint val)
{
	GeeSet* _tmp0_;
	Coord _tmp1_ = {0};
	g_return_if_fail (self != NULL);
	sudoku_board_add_to_occurrences (self, row, col, val, -1);
	_tmp0_ = self->priv->_broken_coords;
	coord_init (&_tmp1_, row, col);
	if (gee_collection_contains ((GeeCollection*) _tmp0_, &_tmp1_)) {
		GeeSet* _tmp2_;
		Coord _tmp3_ = {0};
		GeeSet** _tmp4_;
		gint _tmp4__length1;
		gint _tmp4__length2;
		GeeSet* _tmp5_;
		_tmp2_ = self->priv->_broken_coords;
		coord_init (&_tmp3_, row, col);
		gee_collection_remove ((GeeCollection*) _tmp2_, &_tmp3_);
		_tmp4_ = self->aligned_coords_for_cell;
		_tmp4__length1 = self->aligned_coords_for_cell_length1;
		_tmp4__length2 = self->aligned_coords_for_cell_length2;
		_tmp5_ = _tmp4_[(row * _tmp4__length2) + col];
		sudoku_board_remove_breakages_for (self, _tmp5_, val);
	}
}

static void
sudoku_board_add_to_occurrences (SudokuBoard* self,
                                 gint row,
                                 gint col,
                                 gint val,
                                 gint add)
{
	SudokuBoardDigitOccurences* _tmp0_;
	gint _tmp0__length1;
	SudokuBoardDigitOccurences _tmp1_;
	gint* _tmp2_;
	gint _tmp2__length1;
	SudokuBoardDigitOccurences* _tmp3_;
	gint _tmp3__length1;
	SudokuBoardDigitOccurences _tmp4_;
	gint* _tmp5_;
	gint _tmp5__length1;
	SudokuBoardDigitOccurences* _tmp6_;
	gint _tmp6__length1;
	SudokuBoardDigitOccurences _tmp7_;
	gint* _tmp8_;
	gint _tmp8__length1;
	gint _tmp8__length2;
	gint _tmp9_;
	gint _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->digits;
	_tmp0__length1 = self->priv->digits_length1;
	_tmp1_ = _tmp0_[val - 1];
	_tmp2_ = _tmp1_.occurrences_in_row;
	_tmp2__length1 = _tmp1_.occurrences_in_row_length1;
	_tmp2_[row] += add;
	_tmp3_ = self->priv->digits;
	_tmp3__length1 = self->priv->digits_length1;
	_tmp4_ = _tmp3_[val - 1];
	_tmp5_ = _tmp4_.occurrences_in_col;
	_tmp5__length1 = _tmp4_.occurrences_in_col_length1;
	_tmp5_[col] += add;
	_tmp6_ = self->priv->digits;
	_tmp6__length1 = self->priv->digits_length1;
	_tmp7_ = _tmp6_[val - 1];
	_tmp8_ = _tmp7_.occurrences_in_block;
	_tmp8__length1 = _tmp7_.occurrences_in_block_length1;
	_tmp8__length2 = _tmp7_.occurrences_in_block_length2;
	_tmp9_ = self->priv->_block_rows;
	_tmp10_ = self->priv->_block_cols;
	_tmp8_[((row / _tmp9_) * _tmp8__length2) + (col / _tmp10_)] += add;
}

static void
sudoku_board_mark_breakages (SudokuBoard* self,
                             gint row,
                             gint col,
                             gint val)
{
	SudokuBoardDigitOccurences digit = {0};
	SudokuBoardDigitOccurences* _tmp0_;
	gint _tmp0__length1;
	SudokuBoardDigitOccurences _tmp1_;
	SudokuBoardDigitOccurences _tmp2_;
	SudokuBoardDigitOccurences _tmp3_ = {0};
	SudokuBoardDigitOccurences _tmp4_;
	gint* _tmp5_;
	gint _tmp5__length1;
	gint _tmp6_;
	SudokuBoardDigitOccurences _tmp10_;
	gint* _tmp11_;
	gint _tmp11__length1;
	gint _tmp12_;
	SudokuBoardDigitOccurences _tmp16_;
	gint* _tmp17_;
	gint _tmp17__length1;
	gint _tmp17__length2;
	gint _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->digits;
	_tmp0__length1 = self->priv->digits_length1;
	_tmp1_ = _tmp0_[val - 1];
	_tmp2_ = _tmp1_;
	sudoku_board_digit_occurences_copy (&_tmp2_, &_tmp3_);
	digit = _tmp3_;
	_tmp4_ = digit;
	_tmp5_ = _tmp4_.occurrences_in_row;
	_tmp5__length1 = _tmp4_.occurrences_in_row_length1;
	_tmp6_ = _tmp5_[row];
	if (_tmp6_ > 1) {
		GeeList* _tmp7_;
		gpointer _tmp8_;
		GeeList* _tmp9_;
		_tmp7_ = self->priv->_coords_for_row;
		_tmp8_ = gee_list_get (_tmp7_, row);
		_tmp9_ = (GeeList*) _tmp8_;
		sudoku_board_mark_breakages_for (self, _tmp9_, val);
		_g_object_unref0 (_tmp9_);
	}
	_tmp10_ = digit;
	_tmp11_ = _tmp10_.occurrences_in_col;
	_tmp11__length1 = _tmp10_.occurrences_in_col_length1;
	_tmp12_ = _tmp11_[col];
	if (_tmp12_ > 1) {
		GeeList* _tmp13_;
		gpointer _tmp14_;
		GeeList* _tmp15_;
		_tmp13_ = self->priv->_coords_for_col;
		_tmp14_ = gee_list_get (_tmp13_, col);
		_tmp15_ = (GeeList*) _tmp14_;
		sudoku_board_mark_breakages_for (self, _tmp15_, val);
		_g_object_unref0 (_tmp15_);
	}
	_tmp16_ = digit;
	_tmp17_ = _tmp16_.occurrences_in_block;
	_tmp17__length1 = _tmp16_.occurrences_in_block_length1;
	_tmp17__length2 = _tmp16_.occurrences_in_block_length2;
	_tmp18_ = self->priv->_block_rows;
	_tmp19_ = self->priv->_block_cols;
	_tmp20_ = _tmp17_[((row / _tmp18_) * _tmp17__length2) + (col / _tmp19_)];
	if (_tmp20_ > 1) {
		GeeMap* _tmp21_;
		gint _tmp22_;
		gint _tmp23_;
		Coord _tmp24_ = {0};
		gpointer _tmp25_;
		GeeList* _tmp26_;
		_tmp21_ = self->priv->_coords_for_block;
		_tmp22_ = self->priv->_block_rows;
		_tmp23_ = self->priv->_block_cols;
		coord_init (&_tmp24_, row / _tmp22_, col / _tmp23_);
		_tmp25_ = gee_map_get (_tmp21_, &_tmp24_);
		_tmp26_ = (GeeList*) _tmp25_;
		sudoku_board_mark_breakages_for (self, _tmp26_, val);
		_g_object_unref0 (_tmp26_);
	}
	sudoku_board_digit_occurences_destroy (&digit);
}

static void
sudoku_board_mark_breakages_for (SudokuBoard* self,
                                 GeeList* coords,
                                 gint val)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (coords != NULL);
	{
		GeeList* _coord_list = NULL;
		gint _coord_size = 0;
		GeeList* _tmp0_;
		gint _tmp1_;
		gint _tmp2_;
		gint _coord_index = 0;
		_coord_list = coords;
		_tmp0_ = _coord_list;
		_tmp1_ = gee_collection_get_size ((GeeCollection*) _tmp0_);
		_tmp2_ = _tmp1_;
		_coord_size = _tmp2_;
		_coord_index = -1;
		while (TRUE) {
			gint _tmp3_;
			gint _tmp4_;
			Coord coord = {0};
			GeeList* _tmp5_;
			gpointer _tmp6_;
			Coord* _tmp7_;
			Coord _tmp8_;
			SudokuBoardCell* _tmp9_;
			gint _tmp9__length1;
			gint _tmp9__length2;
			Coord _tmp10_;
			Coord _tmp11_;
			SudokuBoardCell _tmp12_;
			_coord_index = _coord_index + 1;
			_tmp3_ = _coord_index;
			_tmp4_ = _coord_size;
			if (!(_tmp3_ < _tmp4_)) {
				break;
			}
			_tmp5_ = _coord_list;
			_tmp6_ = gee_list_get (_tmp5_, _coord_index);
			_tmp7_ = (Coord*) _tmp6_;
			_tmp8_ = *_tmp7_;
			_coord_free0 (_tmp7_);
			coord = _tmp8_;
			_tmp9_ = self->priv->cells;
			_tmp9__length1 = self->priv->cells_length1;
			_tmp9__length2 = self->priv->cells_length2;
			_tmp10_ = coord;
			_tmp11_ = coord;
			_tmp12_ = _tmp9_[(_tmp10_.row * _tmp9__length2) + _tmp11_.col];
			if (_tmp12_.value == val) {
				GeeSet* _tmp13_;
				Coord _tmp14_;
				_tmp13_ = self->priv->_broken_coords;
				_tmp14_ = coord;
				gee_collection_add ((GeeCollection*) _tmp13_, &_tmp14_);
			}
		}
	}
}

void
sudoku_board_solve (SudokuBoard* self)
{
	gint* fixed_cells = NULL;
	gint _tmp0_ = 0;
	gint* _tmp1_;
	gint fixed_cells_length1;
	gint _fixed_cells_size_;
	gint difficulty = 0;
	gint* _tmp2_;
	gint _tmp2__length1;
	gint _tmp3_ = 0;
	gboolean _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp1_ = sudoku_board_get_fixed_cells (self, &_tmp0_);
	fixed_cells = _tmp1_;
	fixed_cells_length1 = _tmp0_;
	_fixed_cells_size_ = fixed_cells_length1;
	_tmp2_ = fixed_cells;
	_tmp2__length1 = fixed_cells_length1;
	_tmp4_ = qqwing_solve_puzzle (_tmp2_, &_tmp3_);
	difficulty = _tmp3_;
	if (_tmp4_) {
		gint i = 0;
		self->priv->has_solution = TRUE;
		i = 0;
		{
			gint row = 0;
			row = 0;
			{
				gboolean _tmp5_ = FALSE;
				_tmp5_ = TRUE;
				while (TRUE) {
					gint _tmp7_;
					if (!_tmp5_) {
						gint _tmp6_;
						_tmp6_ = row;
						row = _tmp6_ + 1;
					}
					_tmp5_ = FALSE;
					_tmp7_ = self->priv->_rows;
					if (!(row < _tmp7_)) {
						break;
					}
					{
						gint col = 0;
						col = 0;
						{
							gboolean _tmp8_ = FALSE;
							_tmp8_ = TRUE;
							while (TRUE) {
								gint _tmp10_;
								SudokuBoardCell* _tmp11_;
								gint _tmp11__length1;
								gint _tmp11__length2;
								gint* _tmp12_;
								gint _tmp12__length1;
								gint _tmp13_;
								gint _tmp14_;
								if (!_tmp8_) {
									gint _tmp9_;
									_tmp9_ = col;
									col = _tmp9_ + 1;
								}
								_tmp8_ = FALSE;
								_tmp10_ = self->priv->_cols;
								if (!(col < _tmp10_)) {
									break;
								}
								_tmp11_ = self->priv->cells;
								_tmp11__length1 = self->priv->cells_length1;
								_tmp11__length2 = self->priv->cells_length2;
								_tmp12_ = fixed_cells;
								_tmp12__length1 = fixed_cells_length1;
								_tmp13_ = _tmp12_[i];
								_tmp11_[(row * _tmp11__length2) + col].solution = _tmp13_;
								_tmp14_ = i;
								i = _tmp14_ + 1;
							}
						}
					}
				}
			}
		}
		sudoku_board_set_difficulty_category (self, (DifficultyCategory) difficulty);
	} else {
		self->priv->has_solution = FALSE;
	}
	fixed_cells = (g_free (fixed_cells), NULL);
}

gboolean
sudoku_board_solved (SudokuBoard* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->has_solution;
	return result;
}

static void
sudoku_board_remove_breakages_for (SudokuBoard* self,
                                   GeeSet* coords,
                                   gint val)
{
	SudokuBoardDigitOccurences digit = {0};
	SudokuBoardDigitOccurences* _tmp0_;
	gint _tmp0__length1;
	SudokuBoardDigitOccurences _tmp1_;
	SudokuBoardDigitOccurences _tmp2_;
	SudokuBoardDigitOccurences _tmp3_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (coords != NULL);
	_tmp0_ = self->priv->digits;
	_tmp0__length1 = self->priv->digits_length1;
	_tmp1_ = _tmp0_[val - 1];
	_tmp2_ = _tmp1_;
	sudoku_board_digit_occurences_copy (&_tmp2_, &_tmp3_);
	digit = _tmp3_;
	{
		GeeIterator* _coord_it = NULL;
		GeeIterator* _tmp4_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) coords);
		_coord_it = _tmp4_;
		while (TRUE) {
			GeeIterator* _tmp5_;
			Coord coord = {0};
			GeeIterator* _tmp6_;
			gpointer _tmp7_;
			Coord* _tmp8_;
			Coord _tmp9_;
			gboolean _tmp10_ = FALSE;
			gboolean _tmp11_ = FALSE;
			gboolean _tmp12_ = FALSE;
			gboolean _tmp13_ = FALSE;
			SudokuBoardCell* _tmp14_;
			gint _tmp14__length1;
			gint _tmp14__length2;
			Coord _tmp15_;
			Coord _tmp16_;
			SudokuBoardCell _tmp17_;
			_tmp5_ = _coord_it;
			if (!gee_iterator_next (_tmp5_)) {
				break;
			}
			_tmp6_ = _coord_it;
			_tmp7_ = gee_iterator_get (_tmp6_);
			_tmp8_ = (Coord*) _tmp7_;
			_tmp9_ = *_tmp8_;
			_coord_free0 (_tmp8_);
			coord = _tmp9_;
			_tmp14_ = self->priv->cells;
			_tmp14__length1 = self->priv->cells_length1;
			_tmp14__length2 = self->priv->cells_length2;
			_tmp15_ = coord;
			_tmp16_ = coord;
			_tmp17_ = _tmp14_[(_tmp15_.row * _tmp14__length2) + _tmp16_.col];
			if (_tmp17_.value == val) {
				GeeSet* _tmp18_;
				Coord _tmp19_;
				_tmp18_ = self->priv->_broken_coords;
				_tmp19_ = coord;
				_tmp13_ = gee_collection_contains ((GeeCollection*) _tmp18_, &_tmp19_);
			} else {
				_tmp13_ = FALSE;
			}
			if (_tmp13_) {
				SudokuBoardDigitOccurences _tmp20_;
				gint* _tmp21_;
				gint _tmp21__length1;
				Coord _tmp22_;
				gint _tmp23_;
				_tmp20_ = digit;
				_tmp21_ = _tmp20_.occurrences_in_row;
				_tmp21__length1 = _tmp20_.occurrences_in_row_length1;
				_tmp22_ = coord;
				_tmp23_ = _tmp21_[_tmp22_.row];
				_tmp12_ = _tmp23_ <= 1;
			} else {
				_tmp12_ = FALSE;
			}
			if (_tmp12_) {
				SudokuBoardDigitOccurences _tmp24_;
				gint* _tmp25_;
				gint _tmp25__length1;
				Coord _tmp26_;
				gint _tmp27_;
				_tmp24_ = digit;
				_tmp25_ = _tmp24_.occurrences_in_col;
				_tmp25__length1 = _tmp24_.occurrences_in_col_length1;
				_tmp26_ = coord;
				_tmp27_ = _tmp25_[_tmp26_.col];
				_tmp11_ = _tmp27_ <= 1;
			} else {
				_tmp11_ = FALSE;
			}
			if (_tmp11_) {
				SudokuBoardDigitOccurences _tmp28_;
				gint* _tmp29_;
				gint _tmp29__length1;
				gint _tmp29__length2;
				Coord _tmp30_;
				gint _tmp31_;
				Coord _tmp32_;
				gint _tmp33_;
				gint _tmp34_;
				_tmp28_ = digit;
				_tmp29_ = _tmp28_.occurrences_in_block;
				_tmp29__length1 = _tmp28_.occurrences_in_block_length1;
				_tmp29__length2 = _tmp28_.occurrences_in_block_length2;
				_tmp30_ = coord;
				_tmp31_ = self->priv->_block_cols;
				_tmp32_ = coord;
				_tmp33_ = self->priv->_block_rows;
				_tmp34_ = _tmp29_[((_tmp30_.row / _tmp31_) * _tmp29__length2) + (_tmp32_.col / _tmp33_)];
				_tmp10_ = _tmp34_ <= 1;
			} else {
				_tmp10_ = FALSE;
			}
			if (_tmp10_) {
				GeeSet* _tmp35_;
				Coord _tmp36_;
				_tmp35_ = self->priv->_broken_coords;
				_tmp36_ = coord;
				gee_collection_remove ((GeeCollection*) _tmp35_, &_tmp36_);
			}
		}
		_g_object_unref0 (_coord_it);
	}
	sudoku_board_digit_occurences_destroy (&digit);
}

gchar*
sudoku_board_fixed_to_string_pretty (SudokuBoard* self)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("");
	ret = _tmp0_;
	{
		gint row = 0;
		row = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				gint _tmp3_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = row;
					row = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				_tmp3_ = self->priv->_rows;
				if (!(row < _tmp3_)) {
					break;
				}
				{
					gint col = 0;
					col = 0;
					{
						gboolean _tmp4_ = FALSE;
						_tmp4_ = TRUE;
						while (TRUE) {
							gint _tmp6_;
							SudokuBoardCell* _tmp7_;
							gint _tmp7__length1;
							gint _tmp7__length2;
							SudokuBoardCell _tmp8_;
							const gchar* _tmp15_;
							gint _tmp16_;
							gint _tmp17_;
							if (!_tmp4_) {
								gint _tmp5_;
								_tmp5_ = col;
								col = _tmp5_ + 1;
							}
							_tmp4_ = FALSE;
							_tmp6_ = self->priv->_cols;
							if (!(col < _tmp6_)) {
								break;
							}
							_tmp7_ = self->priv->cells;
							_tmp7__length1 = self->priv->cells_length1;
							_tmp7__length2 = self->priv->cells_length2;
							_tmp8_ = _tmp7_[(row * _tmp7__length2) + col];
							if (_tmp8_.fixed) {
								const gchar* _tmp9_;
								SudokuBoardCell* _tmp10_;
								gint _tmp10__length1;
								gint _tmp10__length2;
								SudokuBoardCell _tmp11_;
								gchar* _tmp12_;
								gchar* _tmp13_;
								gchar* _tmp14_;
								_tmp9_ = ret;
								_tmp10_ = self->priv->cells;
								_tmp10__length1 = self->priv->cells_length1;
								_tmp10__length2 = self->priv->cells_length2;
								_tmp11_ = _tmp10_[(row * _tmp10__length2) + col];
								_tmp12_ = g_strdup_printf ("%i", _tmp11_.value);
								_tmp13_ = _tmp12_;
								_tmp14_ = g_strconcat (_tmp9_, _tmp13_, NULL);
								_g_free0 (ret);
								ret = _tmp14_;
								_g_free0 (_tmp13_);
							}
							_tmp15_ = ret;
							_tmp16_ = strlen (_tmp15_);
							_tmp17_ = _tmp16_;
							if (_tmp17_ >= 9) {
								result = ret;
								return result;
							}
						}
					}
				}
			}
		}
	}
	result = ret;
	return result;
}

static void
_vala_array_add1 (gint* * array,
                  gint* length,
                  gint* size,
                  gint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

gchar*
sudoku_board_to_json (SudokuBoard* self,
                      gdouble* elapsed_time)
{
	JsonBuilder* builder = NULL;
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* _tmp2_;
	JsonBuilder* _tmp3_;
	DifficultyCategory _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	JsonBuilder* _tmp7_;
	JsonBuilder* _tmp10_;
	JsonBuilder* _tmp11_;
	JsonBuilder* _tmp45_;
	JsonBuilder* _tmp46_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp47_;
	JsonNode* root = NULL;
	JsonBuilder* _tmp48_;
	JsonNode* _tmp49_;
	gchar* _tmp50_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = json_builder_new ();
	builder = _tmp0_;
	_tmp1_ = builder;
	json_builder_begin_object (_tmp1_);
	_tmp2_ = builder;
	json_builder_set_member_name (_tmp2_, "difficulty_category");
	_tmp3_ = builder;
	_tmp4_ = self->priv->_difficulty_category;
	_tmp5_ = difficulty_category_to_untranslated_string (_tmp4_);
	_tmp6_ = _tmp5_;
	json_builder_add_string_value (_tmp3_, _tmp6_);
	_g_free0 (_tmp6_);
	_tmp7_ = builder;
	json_builder_set_member_name (_tmp7_, "time_elapsed");
	if (elapsed_time != NULL) {
		JsonBuilder* _tmp8_;
		_tmp8_ = builder;
		json_builder_add_double_value (_tmp8_, *elapsed_time);
	} else {
		JsonBuilder* _tmp9_;
		_tmp9_ = builder;
		json_builder_add_double_value (_tmp9_, (gdouble) -1);
	}
	_tmp10_ = builder;
	json_builder_set_member_name (_tmp10_, "cells");
	_tmp11_ = builder;
	json_builder_begin_array (_tmp11_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp12_ = FALSE;
			_tmp12_ = TRUE;
			while (TRUE) {
				gint _tmp14_;
				if (!_tmp12_) {
					gint _tmp13_;
					_tmp13_ = i;
					i = _tmp13_ + 1;
				}
				_tmp12_ = FALSE;
				_tmp14_ = self->priv->_rows;
				if (!(i < _tmp14_)) {
					break;
				}
				{
					gint j = 0;
					j = 0;
					{
						gboolean _tmp15_ = FALSE;
						_tmp15_ = TRUE;
						while (TRUE) {
							gint _tmp17_;
							gint* earmarks = NULL;
							gint* _tmp18_;
							gint earmarks_length1;
							gint _earmarks_size_;
							gboolean _tmp23_ = FALSE;
							SudokuBoardCell* _tmp24_;
							gint _tmp24__length1;
							gint _tmp24__length2;
							SudokuBoardCell _tmp25_;
							JsonBuilder* _tmp27_;
							JsonBuilder* _tmp28_;
							JsonBuilder* _tmp29_;
							JsonBuilder* _tmp30_;
							JsonBuilder* _tmp31_;
							JsonBuilder* _tmp32_;
							JsonBuilder* _tmp33_;
							JsonBuilder* _tmp34_;
							SudokuBoardCell* _tmp35_;
							gint _tmp35__length1;
							gint _tmp35__length2;
							SudokuBoardCell _tmp36_;
							JsonBuilder* _tmp37_;
							JsonBuilder* _tmp38_;
							JsonBuilder* _tmp39_;
							JsonBuilder* _tmp40_;
							gint* _tmp41_;
							gint _tmp41__length1;
							JsonBuilder* _tmp43_;
							JsonBuilder* _tmp44_;
							if (!_tmp15_) {
								gint _tmp16_;
								_tmp16_ = j;
								j = _tmp16_ + 1;
							}
							_tmp15_ = FALSE;
							_tmp17_ = self->priv->_cols;
							if (!(j < _tmp17_)) {
								break;
							}
							_tmp18_ = g_new0 (gint, 0);
							earmarks = _tmp18_;
							earmarks_length1 = 0;
							_earmarks_size_ = earmarks_length1;
							{
								gint k = 0;
								k = 1;
								{
									gboolean _tmp19_ = FALSE;
									_tmp19_ = TRUE;
									while (TRUE) {
										gint _tmp21_;
										gint _tmp22_;
										if (!_tmp19_) {
											gint _tmp20_;
											_tmp20_ = k;
											k = _tmp20_ + 1;
										}
										_tmp19_ = FALSE;
										_tmp21_ = sudoku_board_get_max_val (self);
										_tmp22_ = _tmp21_;
										if (!(k <= _tmp22_)) {
											break;
										}
										if (sudoku_board_is_earmark_enabled (self, i, j, k)) {
											_vala_array_add1 (&earmarks, &earmarks_length1, &_earmarks_size_, k);
										}
									}
								}
							}
							_tmp24_ = self->priv->cells;
							_tmp24__length1 = self->priv->cells_length1;
							_tmp24__length2 = self->priv->cells_length2;
							_tmp25_ = _tmp24_[(i * _tmp24__length2) + j];
							if (_tmp25_.value == 0) {
								gint* _tmp26_;
								gint _tmp26__length1;
								_tmp26_ = earmarks;
								_tmp26__length1 = earmarks_length1;
								_tmp23_ = _tmp26__length1 == 0;
							} else {
								_tmp23_ = FALSE;
							}
							if (_tmp23_) {
								earmarks = (g_free (earmarks), NULL);
								continue;
							}
							_tmp27_ = builder;
							json_builder_begin_object (_tmp27_);
							_tmp28_ = builder;
							json_builder_set_member_name (_tmp28_, "position");
							_tmp29_ = builder;
							json_builder_begin_array (_tmp29_);
							_tmp30_ = builder;
							json_builder_add_int_value (_tmp30_, (gint64) i);
							_tmp31_ = builder;
							json_builder_add_int_value (_tmp31_, (gint64) j);
							_tmp32_ = builder;
							json_builder_end_array (_tmp32_);
							_tmp33_ = builder;
							json_builder_set_member_name (_tmp33_, "value");
							_tmp34_ = builder;
							_tmp35_ = self->priv->cells;
							_tmp35__length1 = self->priv->cells_length1;
							_tmp35__length2 = self->priv->cells_length2;
							_tmp36_ = _tmp35_[(i * _tmp35__length2) + j];
							json_builder_add_int_value (_tmp34_, (gint64) _tmp36_.value);
							_tmp37_ = builder;
							json_builder_set_member_name (_tmp37_, "fixed");
							_tmp38_ = builder;
							json_builder_add_boolean_value (_tmp38_, sudoku_board_get_is_fixed (self, i, j));
							_tmp39_ = builder;
							json_builder_set_member_name (_tmp39_, "earmarks");
							_tmp40_ = builder;
							json_builder_begin_array (_tmp40_);
							_tmp41_ = earmarks;
							_tmp41__length1 = earmarks_length1;
							{
								gint* k_collection = NULL;
								gint k_collection_length1 = 0;
								gint _k_collection_size_ = 0;
								gint k_it = 0;
								k_collection = _tmp41_;
								k_collection_length1 = _tmp41__length1;
								for (k_it = 0; k_it < k_collection_length1; k_it = k_it + 1) {
									gint k = 0;
									k = k_collection[k_it];
									{
										JsonBuilder* _tmp42_;
										_tmp42_ = builder;
										json_builder_add_int_value (_tmp42_, (gint64) k);
									}
								}
							}
							_tmp43_ = builder;
							json_builder_end_array (_tmp43_);
							_tmp44_ = builder;
							json_builder_end_object (_tmp44_);
							earmarks = (g_free (earmarks), NULL);
						}
					}
				}
			}
		}
	}
	_tmp45_ = builder;
	json_builder_end_array (_tmp45_);
	_tmp46_ = builder;
	json_builder_end_object (_tmp46_);
	_tmp47_ = json_generator_new ();
	generator = _tmp47_;
	json_generator_set_pretty (generator, TRUE);
	_tmp48_ = builder;
	_tmp49_ = json_builder_get_root (_tmp48_);
	root = _tmp49_;
	json_generator_set_root (generator, root);
	_tmp50_ = json_generator_to_data (generator, NULL);
	result = _tmp50_;
	__vala_JsonNode_free0 (root);
	_g_object_unref0 (generator);
	_g_object_unref0 (builder);
	return result;
}

gchar*
sudoku_board_to_string (SudokuBoard* self)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("");
	ret = _tmp0_;
	{
		gint row = 0;
		row = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				gint _tmp3_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = row;
					row = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				_tmp3_ = self->priv->_rows;
				if (!(row < _tmp3_)) {
					break;
				}
				{
					gint col = 0;
					col = 0;
					{
						gboolean _tmp4_ = FALSE;
						_tmp4_ = TRUE;
						while (TRUE) {
							gint _tmp6_;
							SudokuBoardCell* _tmp7_;
							gint _tmp7__length1;
							gint _tmp7__length2;
							SudokuBoardCell _tmp8_;
							if (!_tmp4_) {
								gint _tmp5_;
								_tmp5_ = col;
								col = _tmp5_ + 1;
							}
							_tmp4_ = FALSE;
							_tmp6_ = self->priv->_cols;
							if (!(col < _tmp6_)) {
								break;
							}
							_tmp7_ = self->priv->cells;
							_tmp7__length1 = self->priv->cells_length1;
							_tmp7__length2 = self->priv->cells_length2;
							_tmp8_ = _tmp7_[(row * _tmp7__length2) + col];
							if (_tmp8_.fixed) {
								const gchar* _tmp9_;
								SudokuBoardCell* _tmp10_;
								gint _tmp10__length1;
								gint _tmp10__length2;
								SudokuBoardCell _tmp11_;
								gchar* _tmp12_;
								gchar* _tmp13_;
								gchar* _tmp14_;
								_tmp9_ = ret;
								_tmp10_ = self->priv->cells;
								_tmp10__length1 = self->priv->cells_length1;
								_tmp10__length2 = self->priv->cells_length2;
								_tmp11_ = _tmp10_[(row * _tmp10__length2) + col];
								_tmp12_ = g_strdup_printf ("%i", _tmp11_.value);
								_tmp13_ = _tmp12_;
								_tmp14_ = g_strconcat (_tmp9_, _tmp13_, NULL);
								_g_free0 (ret);
								ret = _tmp14_;
								_g_free0 (_tmp13_);
							} else {
								const gchar* _tmp15_;
								gchar* _tmp16_;
								_tmp15_ = ret;
								_tmp16_ = g_strconcat (_tmp15_, "0", NULL);
								_g_free0 (ret);
								ret = _tmp16_;
							}
						}
					}
				}
			}
		}
	}
	result = ret;
	return result;
}

gchar*
sudoku_board_to_string_pretty (SudokuBoard* self)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("");
	ret = _tmp0_;
	{
		gint row = 0;
		row = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				gint _tmp3_;
				const gchar* _tmp17_;
				gchar* _tmp18_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = row;
					row = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				_tmp3_ = self->priv->_rows;
				if (!(row < _tmp3_)) {
					break;
				}
				{
					gint col = 0;
					col = 0;
					{
						gboolean _tmp4_ = FALSE;
						_tmp4_ = TRUE;
						while (TRUE) {
							gint _tmp6_;
							SudokuBoardCell* _tmp7_;
							gint _tmp7__length1;
							gint _tmp7__length2;
							SudokuBoardCell _tmp8_;
							if (!_tmp4_) {
								gint _tmp5_;
								_tmp5_ = col;
								col = _tmp5_ + 1;
							}
							_tmp4_ = FALSE;
							_tmp6_ = self->priv->_cols;
							if (!(col < _tmp6_)) {
								break;
							}
							_tmp7_ = self->priv->cells;
							_tmp7__length1 = self->priv->cells_length1;
							_tmp7__length2 = self->priv->cells_length2;
							_tmp8_ = _tmp7_[(row * _tmp7__length2) + col];
							if (_tmp8_.fixed) {
								const gchar* _tmp9_;
								SudokuBoardCell* _tmp10_;
								gint _tmp10__length1;
								gint _tmp10__length2;
								SudokuBoardCell _tmp11_;
								gchar* _tmp12_;
								gchar* _tmp13_;
								gchar* _tmp14_;
								_tmp9_ = ret;
								_tmp10_ = self->priv->cells;
								_tmp10__length1 = self->priv->cells_length1;
								_tmp10__length2 = self->priv->cells_length2;
								_tmp11_ = _tmp10_[(row * _tmp10__length2) + col];
								_tmp12_ = g_strdup_printf ("%i", _tmp11_.value);
								_tmp13_ = _tmp12_;
								_tmp14_ = g_strconcat (_tmp9_, _tmp13_, NULL);
								_g_free0 (ret);
								ret = _tmp14_;
								_g_free0 (_tmp13_);
							} else {
								const gchar* _tmp15_;
								gchar* _tmp16_;
								_tmp15_ = ret;
								_tmp16_ = g_strconcat (_tmp15_, ".", NULL);
								_g_free0 (ret);
								ret = _tmp16_;
							}
						}
					}
				}
				_tmp17_ = ret;
				_tmp18_ = g_strconcat (_tmp17_, "\n", NULL);
				_g_free0 (ret);
				ret = _tmp18_;
			}
		}
	}
	result = ret;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

gchar*
sudoku_board_fixed_to_ascii_string (SudokuBoard* self)
{
	gchar* ret = NULL;
	gchar* _tmp0_;
	GeeArrayList** array = NULL;
	GeeArrayList** _tmp1_;
	gint array_length1;
	gint _array_size_;
	GeeArrayList** _tmp34_;
	gint _tmp34__length1;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("#");
	ret = _tmp0_;
	_tmp1_ = g_new0 (GeeArrayList*, 9 + 1);
	array = _tmp1_;
	array_length1 = 9;
	_array_size_ = array_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				GeeArrayList** _tmp4_;
				gint _tmp4__length1;
				GeeArrayList* _tmp5_;
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = i;
					i = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				if (!(i < 9)) {
					break;
				}
				_tmp4_ = array;
				_tmp4__length1 = array_length1;
				_tmp5_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, NULL, NULL, NULL);
				_g_object_unref0 (_tmp4_[i]);
				_tmp4_[i] = _tmp5_;
			}
		}
	}
	{
		gint row = 0;
		row = 0;
		{
			gboolean _tmp6_ = FALSE;
			_tmp6_ = TRUE;
			while (TRUE) {
				if (!_tmp6_) {
					gint _tmp7_;
					_tmp7_ = row;
					row = _tmp7_ + 1;
				}
				_tmp6_ = FALSE;
				if (!(row < 9)) {
					break;
				}
				{
					gint col = 0;
					col = 0;
					{
						gboolean _tmp8_ = FALSE;
						_tmp8_ = TRUE;
						while (TRUE) {
							SudokuBoardCell cell = {0};
							SudokuBoardCell* _tmp10_;
							gint _tmp10__length1;
							gint _tmp10__length2;
							SudokuBoardCell _tmp11_;
							SudokuBoardCell _tmp12_;
							SudokuBoardCell _tmp13_ = {0};
							gboolean _tmp14_ = FALSE;
							SudokuBoardCell _tmp15_;
							if (!_tmp8_) {
								gint _tmp9_;
								_tmp9_ = col;
								col = _tmp9_ + 1;
							}
							_tmp8_ = FALSE;
							if (!(col < 9)) {
								break;
							}
							_tmp10_ = self->priv->cells;
							_tmp10__length1 = self->priv->cells_length1;
							_tmp10__length2 = self->priv->cells_length2;
							_tmp11_ = _tmp10_[(row * _tmp10__length2) + col];
							_tmp12_ = _tmp11_;
							sudoku_board_cell_copy (&_tmp12_, &_tmp13_);
							cell = _tmp13_;
							_tmp15_ = cell;
							if (_tmp15_.value != 0) {
								SudokuBoardCell _tmp16_;
								_tmp16_ = cell;
								_tmp14_ = _tmp16_.fixed == TRUE;
							} else {
								_tmp14_ = FALSE;
							}
							if (_tmp14_) {
								GeeArrayList** _tmp17_;
								gint _tmp17__length1;
								SudokuBoardCell _tmp18_;
								GeeArrayList* _tmp19_;
								_tmp17_ = array;
								_tmp17__length1 = array_length1;
								_tmp18_ = cell;
								_tmp19_ = _tmp17_[_tmp18_.value - 1];
								gee_abstract_collection_add ((GeeAbstractCollection*) _tmp19_, (gpointer) ((gintptr) sudoku_board_to_printable_ascii (self, row, col)));
							}
							sudoku_board_cell_destroy (&cell);
						}
					}
				}
			}
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp20_ = FALSE;
			_tmp20_ = TRUE;
			while (TRUE) {
				gint size1 = 0;
				GeeArrayList** _tmp22_;
				gint _tmp22__length1;
				GeeArrayList* _tmp23_;
				gint _tmp24_;
				gint _tmp25_;
				gint size2 = 0;
				gchar c = '\0';
				const gchar* _tmp30_;
				gchar* _tmp31_;
				gchar* _tmp32_;
				gchar* _tmp33_;
				if (!_tmp20_) {
					gint _tmp21_;
					_tmp21_ = i;
					i = _tmp21_ + 1;
				}
				_tmp20_ = FALSE;
				if (!(i < 5)) {
					break;
				}
				_tmp22_ = array;
				_tmp22__length1 = array_length1;
				_tmp23_ = _tmp22_[i * 2];
				_tmp24_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp23_);
				_tmp25_ = _tmp24_;
				size1 = _tmp25_;
				size2 = 0;
				if (i != 4) {
					GeeArrayList** _tmp26_;
					gint _tmp26__length1;
					GeeArrayList* _tmp27_;
					gint _tmp28_;
					gint _tmp29_;
					_tmp26_ = array;
					_tmp26__length1 = array_length1;
					_tmp27_ = _tmp26_[(i * 2) + 1];
					_tmp28_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp27_);
					_tmp29_ = _tmp28_;
					size2 = _tmp29_;
				}
				c = (gchar) sudoku_board_to_printable_ascii (self, size1, size2);
				_tmp30_ = ret;
				_tmp31_ = g_strdup_printf ("%c", c);
				_tmp32_ = _tmp31_;
				_tmp33_ = g_strconcat (_tmp30_, _tmp32_, NULL);
				_g_free0 (ret);
				ret = _tmp33_;
				_g_free0 (_tmp32_);
			}
		}
	}
	_tmp34_ = array;
	_tmp34__length1 = array_length1;
	{
		GeeArrayList** list_collection = NULL;
		gint list_collection_length1 = 0;
		gint _list_collection_size_ = 0;
		gint list_it = 0;
		list_collection = _tmp34_;
		list_collection_length1 = _tmp34__length1;
		for (list_it = 0; list_it < list_collection_length1; list_it = list_it + 1) {
			GeeArrayList* _tmp35_;
			GeeArrayList* list = NULL;
			_tmp35_ = _g_object_ref0 (list_collection[list_it]);
			list = _tmp35_;
			{
				{
					GeeArrayList* _row_col_list = NULL;
					GeeArrayList* _tmp36_;
					gint _row_col_size = 0;
					GeeArrayList* _tmp37_;
					gint _tmp38_;
					gint _tmp39_;
					gint _row_col_index = 0;
					_tmp36_ = list;
					_row_col_list = _tmp36_;
					_tmp37_ = _row_col_list;
					_tmp38_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp37_);
					_tmp39_ = _tmp38_;
					_row_col_size = _tmp39_;
					_row_col_index = -1;
					while (TRUE) {
						gint _tmp40_;
						gint _tmp41_;
						gint row_col = 0;
						GeeArrayList* _tmp42_;
						gpointer _tmp43_;
						gchar c = '\0';
						const gchar* _tmp44_;
						gchar* _tmp45_;
						gchar* _tmp46_;
						gchar* _tmp47_;
						_row_col_index = _row_col_index + 1;
						_tmp40_ = _row_col_index;
						_tmp41_ = _row_col_size;
						if (!(_tmp40_ < _tmp41_)) {
							break;
						}
						_tmp42_ = _row_col_list;
						_tmp43_ = gee_abstract_list_get ((GeeAbstractList*) _tmp42_, _row_col_index);
						row_col = (gint) ((gintptr) _tmp43_);
						c = (gchar) row_col;
						_tmp44_ = ret;
						_tmp45_ = g_strdup_printf ("%c", c);
						_tmp46_ = _tmp45_;
						_tmp47_ = g_strconcat (_tmp44_, _tmp46_, NULL);
						_g_free0 (ret);
						ret = _tmp47_;
						_g_free0 (_tmp46_);
					}
				}
				_g_object_unref0 (list);
			}
		}
	}
	result = ret;
	array = (_vala_array_free (array, array_length1, (GDestroyNotify) g_object_unref), NULL);
	return result;
}

static gint
sudoku_board_to_printable_ascii (SudokuBoard* self,
                                 gint val1,
                                 gint val2)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = (val1 + 33) + (val2 * 9);
	return result;
}

static gint*
sudoku_board_from_printable_ascii (SudokuBoard* self,
                                   gint val,
                                   gint* result_length1)
{
	gint* ret = NULL;
	gint* _tmp0_;
	gint ret_length1;
	gint _ret_size_;
	gint* _tmp1_;
	gint _tmp1__length1;
	gint* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (gint, 2);
	ret = _tmp0_;
	ret_length1 = 2;
	_ret_size_ = ret_length1;
	ret[0] = (val - 33) % 9;
	ret[1] = (val - 33) / 9;
	_tmp1_ = ret;
	_tmp1__length1 = ret_length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

gboolean
sudoku_board_has_earmarks (SudokuBoard* self,
                           gint row,
                           gint col)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				SudokuBoardCell* _tmp2_;
				gint _tmp2__length1;
				gint _tmp2__length2;
				SudokuBoardCell _tmp3_;
				gboolean* _tmp4_;
				gint _tmp4__length1;
				gboolean _tmp5_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(i < 9)) {
					break;
				}
				_tmp2_ = self->priv->cells;
				_tmp2__length1 = self->priv->cells_length1;
				_tmp2__length2 = self->priv->cells_length2;
				_tmp3_ = _tmp2_[(row * _tmp2__length2) + col];
				_tmp4_ = _tmp3_.earmarks;
				_tmp4__length1 = _tmp3_.earmarks_length1;
				_tmp5_ = _tmp4_[i];
				if (_tmp5_) {
					result = TRUE;
					return result;
				}
			}
		}
	}
	result = FALSE;
	return result;
}

gdouble
sudoku_board_get_previous_played_time (SudokuBoard* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_previous_played_time;
	return result;
}

void
sudoku_board_set_previous_played_time (SudokuBoard* self,
                                       gdouble value)
{
	gdouble old_value;
	g_return_if_fail (self != NULL);
	old_value = sudoku_board_get_previous_played_time (self);
	if (old_value != value) {
		self->priv->_previous_played_time = value;
		g_object_notify_by_pspec ((GObject *) self, sudoku_board_properties[SUDOKU_BOARD_PREVIOUS_PLAYED_TIME_PROPERTY]);
	}
}

DifficultyCategory
sudoku_board_get_difficulty_category (SudokuBoard* self)
{
	DifficultyCategory result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_difficulty_category;
	return result;
}

void
sudoku_board_set_difficulty_category (SudokuBoard* self,
                                      DifficultyCategory value)
{
	DifficultyCategory old_value;
	g_return_if_fail (self != NULL);
	old_value = sudoku_board_get_difficulty_category (self);
	if (old_value != value) {
		self->priv->_difficulty_category = value;
		g_object_notify_by_pspec ((GObject *) self, sudoku_board_properties[SUDOKU_BOARD_DIFFICULTY_CATEGORY_PROPERTY]);
	}
}

gint
sudoku_board_get_block_rows (SudokuBoard* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_block_rows;
	return result;
}

static void
sudoku_board_set_block_rows (SudokuBoard* self,
                             gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = sudoku_board_get_block_rows (self);
	if (old_value != value) {
		self->priv->_block_rows = value;
		g_object_notify_by_pspec ((GObject *) self, sudoku_board_properties[SUDOKU_BOARD_BLOCK_ROWS_PROPERTY]);
	}
}

gint
sudoku_board_get_block_cols (SudokuBoard* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_block_cols;
	return result;
}

static void
sudoku_board_set_block_cols (SudokuBoard* self,
                             gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = sudoku_board_get_block_cols (self);
	if (old_value != value) {
		self->priv->_block_cols = value;
		g_object_notify_by_pspec ((GObject *) self, sudoku_board_properties[SUDOKU_BOARD_BLOCK_COLS_PROPERTY]);
	}
}

gint
sudoku_board_get_rows (SudokuBoard* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_rows;
	return result;
}

static void
sudoku_board_set_rows (SudokuBoard* self,
                       gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = sudoku_board_get_rows (self);
	if (old_value != value) {
		self->priv->_rows = value;
		g_object_notify_by_pspec ((GObject *) self, sudoku_board_properties[SUDOKU_BOARD_ROWS_PROPERTY]);
	}
}

gint
sudoku_board_get_cols (SudokuBoard* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_cols;
	return result;
}

static void
sudoku_board_set_cols (SudokuBoard* self,
                       gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = sudoku_board_get_cols (self);
	if (old_value != value) {
		self->priv->_cols = value;
		g_object_notify_by_pspec ((GObject *) self, sudoku_board_properties[SUDOKU_BOARD_COLS_PROPERTY]);
	}
}

gint
sudoku_board_get_max_val (SudokuBoard* self)
{
	gint result;
	gint _tmp0_;
	gint _tmp1_;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->_block_rows;
	_tmp1_ = self->priv->_block_cols;
	result = _tmp0_ * _tmp1_;
	return result;
}

gint
sudoku_board_get_filled (SudokuBoard* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_filled;
	return result;
}

static void
sudoku_board_set_filled (SudokuBoard* self,
                         gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = sudoku_board_get_filled (self);
	if (old_value != value) {
		self->priv->_filled = value;
		g_object_notify_by_pspec ((GObject *) self, sudoku_board_properties[SUDOKU_BOARD_FILLED_PROPERTY]);
	}
}

gint
sudoku_board_get_fixed (SudokuBoard* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_fixed;
	return result;
}

static void
sudoku_board_set_fixed (SudokuBoard* self,
                        gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = sudoku_board_get_fixed (self);
	if (old_value != value) {
		self->priv->_fixed = value;
		g_object_notify_by_pspec ((GObject *) self, sudoku_board_properties[SUDOKU_BOARD_FIXED_PROPERTY]);
	}
}

gboolean
sudoku_board_get_complete (SudokuBoard* self)
{
	gboolean result;
	gboolean broken = FALSE;
	GeeSet* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gboolean _tmp3_ = FALSE;
	gint _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_broken_coords;
	_tmp1_ = gee_collection_get_size ((GeeCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	broken = _tmp2_ != 0;
	_tmp4_ = self->priv->_filled;
	_tmp5_ = self->priv->_cols;
	_tmp6_ = self->priv->_rows;
	if (_tmp4_ == (_tmp5_ * _tmp6_)) {
		_tmp3_ = !broken;
	} else {
		_tmp3_ = FALSE;
	}
	result = _tmp3_;
	return result;
}

GeeSet*
sudoku_board_get_broken_coords (SudokuBoard* self)
{
	GeeSet* result;
	GeeSet* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_broken_coords;
	result = _tmp0_;
	return result;
}

static void
sudoku_board_set_broken_coords (SudokuBoard* self,
                                GeeSet* value)
{
	GeeSet* old_value;
	g_return_if_fail (self != NULL);
	old_value = sudoku_board_get_broken_coords (self);
	if (old_value != value) {
		GeeSet* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_broken_coords);
		self->priv->_broken_coords = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, sudoku_board_properties[SUDOKU_BOARD_BROKEN_COORDS_PROPERTY]);
	}
}

GeeList*
sudoku_board_get_coords_for_col (SudokuBoard* self)
{
	GeeList* result;
	GeeList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_coords_for_col;
	result = _tmp0_;
	return result;
}

static void
sudoku_board_set_coords_for_col (SudokuBoard* self,
                                 GeeList* value)
{
	GeeList* old_value;
	g_return_if_fail (self != NULL);
	old_value = sudoku_board_get_coords_for_col (self);
	if (old_value != value) {
		GeeList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_coords_for_col);
		self->priv->_coords_for_col = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, sudoku_board_properties[SUDOKU_BOARD_COORDS_FOR_COL_PROPERTY]);
	}
}

GeeList*
sudoku_board_get_coords_for_row (SudokuBoard* self)
{
	GeeList* result;
	GeeList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_coords_for_row;
	result = _tmp0_;
	return result;
}

static void
sudoku_board_set_coords_for_row (SudokuBoard* self,
                                 GeeList* value)
{
	GeeList* old_value;
	g_return_if_fail (self != NULL);
	old_value = sudoku_board_get_coords_for_row (self);
	if (old_value != value) {
		GeeList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_coords_for_row);
		self->priv->_coords_for_row = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, sudoku_board_properties[SUDOKU_BOARD_COORDS_FOR_ROW_PROPERTY]);
	}
}

GeeMap*
sudoku_board_get_coords_for_block (SudokuBoard* self)
{
	GeeMap* result;
	GeeMap* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_coords_for_block;
	result = _tmp0_;
	return result;
}

static void
sudoku_board_set_coords_for_block (SudokuBoard* self,
                                   GeeMap* value)
{
	GeeMap* old_value;
	g_return_if_fail (self != NULL);
	old_value = sudoku_board_get_coords_for_block (self);
	if (old_value != value) {
		GeeMap* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_coords_for_block);
		self->priv->_coords_for_block = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, sudoku_board_properties[SUDOKU_BOARD_COORDS_FOR_BLOCK_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_VOID__INT_INT_INT_BOOLEAN (GClosure * closure,
                                                   GValue * return_value,
                                                   guint n_param_values,
                                                   const GValue * param_values,
                                                   gpointer invocation_hint,
                                                   gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__INT_INT_INT_BOOLEAN) (gpointer data1, gint arg_1, gint arg_2, gint arg_3, gboolean arg_4, gpointer data2);
	register GMarshalFunc_VOID__INT_INT_INT_BOOLEAN callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 5);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__INT_INT_INT_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_int (param_values + 1), g_value_get_int (param_values + 2), g_value_get_int (param_values + 3), g_value_get_boolean (param_values + 4), data2);
}

static void
g_cclosure_user_marshal_VOID__INT_INT_INT_INT (GClosure * closure,
                                               GValue * return_value,
                                               guint n_param_values,
                                               const GValue * param_values,
                                               gpointer invocation_hint,
                                               gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__INT_INT_INT_INT) (gpointer data1, gint arg_1, gint arg_2, gint arg_3, gint arg_4, gpointer data2);
	register GMarshalFunc_VOID__INT_INT_INT_INT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 5);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__INT_INT_INT_INT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_int (param_values + 1), g_value_get_int (param_values + 2), g_value_get_int (param_values + 3), g_value_get_int (param_values + 4), data2);
}

static gboolean*
_vala_array_dup6 (gboolean* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gboolean));
	}
	return NULL;
}

static void
sudoku_board_cell_copy (const SudokuBoardCell* self,
                        SudokuBoardCell* dest)
{
	gboolean* _tmp0_;
	gint _tmp0__length1;
	gboolean* _tmp1_;
	gint _tmp1__length1;
	(*dest).value = (*self).value;
	(*dest).solution = (*self).solution;
	_tmp0_ = (*self).earmarks;
	_tmp0__length1 = (*self).earmarks_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup6 (_tmp0_, _tmp0__length1) : _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	(*dest).earmarks = (g_free ((*dest).earmarks), NULL);
	(*dest).earmarks = _tmp1_;
	(*dest).earmarks_length1 = _tmp1__length1;
	(*dest)._earmarks_size_ = (*dest).earmarks_length1;
	(*dest).fixed = (*self).fixed;
}

static void
sudoku_board_cell_destroy (SudokuBoardCell* self)
{
	(*self).earmarks = (g_free ((*self).earmarks), NULL);
}

static SudokuBoardCell*
sudoku_board_cell_dup (const SudokuBoardCell* self)
{
	SudokuBoardCell* dup;
	dup = g_new0 (SudokuBoardCell, 1);
	sudoku_board_cell_copy (self, dup);
	return dup;
}

static void
sudoku_board_cell_free (SudokuBoardCell* self)
{
	sudoku_board_cell_destroy (self);
	g_free (self);
}

static GType
sudoku_board_cell_get_type_once (void)
{
	GType sudoku_board_cell_type_id;
	sudoku_board_cell_type_id = g_boxed_type_register_static ("SudokuBoardCell", (GBoxedCopyFunc) sudoku_board_cell_dup, (GBoxedFreeFunc) sudoku_board_cell_free);
	return sudoku_board_cell_type_id;
}

static GType
sudoku_board_cell_get_type (void)
{
	static volatile gsize sudoku_board_cell_type_id__once = 0;
	if (g_once_init_enter (&sudoku_board_cell_type_id__once)) {
		GType sudoku_board_cell_type_id;
		sudoku_board_cell_type_id = sudoku_board_cell_get_type_once ();
		g_once_init_leave (&sudoku_board_cell_type_id__once, sudoku_board_cell_type_id);
	}
	return sudoku_board_cell_type_id__once;
}

static gint*
_vala_array_dup7 (gint* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gint));
	}
	return NULL;
}

static gint*
_vala_array_dup8 (gint* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gint));
	}
	return NULL;
}

static gint*
_vala_array_dup9 (gint* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gint));
	}
	return NULL;
}

static void
sudoku_board_digit_occurences_copy (const SudokuBoardDigitOccurences* self,
                                    SudokuBoardDigitOccurences* dest)
{
	gint* _tmp0_;
	gint _tmp0__length1;
	gint* _tmp1_;
	gint _tmp1__length1;
	gint* _tmp2_;
	gint _tmp2__length1;
	gint* _tmp3_;
	gint _tmp3__length1;
	gint* _tmp4_;
	gint _tmp4__length1;
	gint _tmp4__length2;
	gint* _tmp5_;
	gint _tmp5__length1;
	gint _tmp5__length2;
	_tmp0_ = (*self).occurrences_in_row;
	_tmp0__length1 = (*self).occurrences_in_row_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup7 (_tmp0_, _tmp0__length1) : _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	(*dest).occurrences_in_row = (g_free ((*dest).occurrences_in_row), NULL);
	(*dest).occurrences_in_row = _tmp1_;
	(*dest).occurrences_in_row_length1 = _tmp1__length1;
	(*dest)._occurrences_in_row_size_ = (*dest).occurrences_in_row_length1;
	_tmp2_ = (*self).occurrences_in_col;
	_tmp2__length1 = (*self).occurrences_in_col_length1;
	_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup8 (_tmp2_, _tmp2__length1) : _tmp2_;
	_tmp3__length1 = _tmp2__length1;
	(*dest).occurrences_in_col = (g_free ((*dest).occurrences_in_col), NULL);
	(*dest).occurrences_in_col = _tmp3_;
	(*dest).occurrences_in_col_length1 = _tmp3__length1;
	(*dest)._occurrences_in_col_size_ = (*dest).occurrences_in_col_length1;
	_tmp4_ = (*self).occurrences_in_block;
	_tmp4__length1 = (*self).occurrences_in_block_length1;
	_tmp4__length2 = (*self).occurrences_in_block_length2;
	_tmp5_ = (_tmp4_ != NULL) ? _vala_array_dup9 (_tmp4_, _tmp4__length1 * _tmp4__length2) : _tmp4_;
	_tmp5__length1 = _tmp4__length1;
	_tmp5__length2 = _tmp4__length2;
	(*dest).occurrences_in_block = (g_free ((*dest).occurrences_in_block), NULL);
	(*dest).occurrences_in_block = _tmp5_;
	(*dest).occurrences_in_block_length1 = _tmp5__length1;
	(*dest).occurrences_in_block_length2 = _tmp5__length2;
}

static void
sudoku_board_digit_occurences_destroy (SudokuBoardDigitOccurences* self)
{
	(*self).occurrences_in_row = (g_free ((*self).occurrences_in_row), NULL);
	(*self).occurrences_in_col = (g_free ((*self).occurrences_in_col), NULL);
	(*self).occurrences_in_block = (g_free ((*self).occurrences_in_block), NULL);
}

static SudokuBoardDigitOccurences*
sudoku_board_digit_occurences_dup (const SudokuBoardDigitOccurences* self)
{
	SudokuBoardDigitOccurences* dup;
	dup = g_new0 (SudokuBoardDigitOccurences, 1);
	sudoku_board_digit_occurences_copy (self, dup);
	return dup;
}

static void
sudoku_board_digit_occurences_free (SudokuBoardDigitOccurences* self)
{
	sudoku_board_digit_occurences_destroy (self);
	g_free (self);
}

static GType
sudoku_board_digit_occurences_get_type_once (void)
{
	GType sudoku_board_digit_occurences_type_id;
	sudoku_board_digit_occurences_type_id = g_boxed_type_register_static ("SudokuBoardDigitOccurences", (GBoxedCopyFunc) sudoku_board_digit_occurences_dup, (GBoxedFreeFunc) sudoku_board_digit_occurences_free);
	return sudoku_board_digit_occurences_type_id;
}

static GType
sudoku_board_digit_occurences_get_type (void)
{
	static volatile gsize sudoku_board_digit_occurences_type_id__once = 0;
	if (g_once_init_enter (&sudoku_board_digit_occurences_type_id__once)) {
		GType sudoku_board_digit_occurences_type_id;
		sudoku_board_digit_occurences_type_id = sudoku_board_digit_occurences_get_type_once ();
		g_once_init_leave (&sudoku_board_digit_occurences_type_id__once, sudoku_board_digit_occurences_type_id);
	}
	return sudoku_board_digit_occurences_type_id__once;
}

static void
sudoku_board_class_init (SudokuBoardClass * klass,
                         gpointer klass_data)
{
	sudoku_board_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SudokuBoard_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_sudoku_board_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_sudoku_board_set_property;
	G_OBJECT_CLASS (klass)->finalize = sudoku_board_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_PREVIOUS_PLAYED_TIME_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_PREVIOUS_PLAYED_TIME_PROPERTY] = g_param_spec_double ("previous-played-time", "previous-played-time", "previous-played-time", -G_MAXDOUBLE, G_MAXDOUBLE, (gdouble) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_DIFFICULTY_CATEGORY_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_DIFFICULTY_CATEGORY_PROPERTY] = g_param_spec_enum ("difficulty-category", "difficulty-category", "difficulty-category", TYPE_DIFFICULTY_CATEGORY, DIFFICULTY_CATEGORY_UNKNOWN, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_BLOCK_ROWS_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_BLOCK_ROWS_PROPERTY] = g_param_spec_int ("block-rows", "block-rows", "block-rows", G_MININT, G_MAXINT, 3, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_BLOCK_COLS_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_BLOCK_COLS_PROPERTY] = g_param_spec_int ("block-cols", "block-cols", "block-cols", G_MININT, G_MAXINT, 3, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_ROWS_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_ROWS_PROPERTY] = g_param_spec_int ("rows", "rows", "rows", G_MININT, G_MAXINT, 9, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_COLS_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_COLS_PROPERTY] = g_param_spec_int ("cols", "cols", "cols", G_MININT, G_MAXINT, 9, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_MAX_VAL_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_MAX_VAL_PROPERTY] = g_param_spec_int ("max-val", "max-val", "max-val", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_FILLED_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_FILLED_PROPERTY] = g_param_spec_int ("filled", "filled", "filled", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_FIXED_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_FIXED_PROPERTY] = g_param_spec_int ("fixed", "fixed", "fixed", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_COMPLETE_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_COMPLETE_PROPERTY] = g_param_spec_boolean ("complete", "complete", "complete", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_BROKEN_COORDS_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_BROKEN_COORDS_PROPERTY] = g_param_spec_object ("broken-coords", "broken-coords", "broken-coords", GEE_TYPE_SET, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_COORDS_FOR_COL_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_COORDS_FOR_COL_PROPERTY] = g_param_spec_object ("coords-for-col", "coords-for-col", "coords-for-col", GEE_TYPE_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_COORDS_FOR_ROW_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_COORDS_FOR_ROW_PROPERTY] = g_param_spec_object ("coords-for-row", "coords-for-row", "coords-for-row", GEE_TYPE_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SUDOKU_BOARD_COORDS_FOR_BLOCK_PROPERTY, sudoku_board_properties[SUDOKU_BOARD_COORDS_FOR_BLOCK_PROPERTY] = g_param_spec_object ("coords-for-block", "coords-for-block", "coords-for-block", GEE_TYPE_MAP, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	sudoku_board_signals[SUDOKU_BOARD_COMPLETED_SIGNAL] = g_signal_new ("completed", TYPE_SUDOKU_BOARD, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	sudoku_board_signals[SUDOKU_BOARD_EARMARK_CHANGED_SIGNAL] = g_signal_new ("earmark-changed", TYPE_SUDOKU_BOARD, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT_INT_INT_BOOLEAN, G_TYPE_NONE, 4, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_BOOLEAN);
	sudoku_board_signals[SUDOKU_BOARD_VALUE_CHANGED_SIGNAL] = g_signal_new ("value-changed", TYPE_SUDOKU_BOARD, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT_INT_INT_INT, G_TYPE_NONE, 4, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
}

static void
sudoku_board_instance_init (SudokuBoard * self,
                            gpointer klass)
{
	self->priv = sudoku_board_get_instance_private (self);
	self->priv->has_solution = FALSE;
	self->priv->_previous_played_time = (gdouble) 0;
	self->priv->_difficulty_category = DIFFICULTY_CATEGORY_UNKNOWN;
	self->priv->_block_rows = 3;
	self->priv->_block_cols = 3;
	self->priv->_rows = 9;
	self->priv->_cols = 9;
}

static void
sudoku_board_finalize (GObject * obj)
{
	SudokuBoard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SUDOKU_BOARD, SudokuBoard);
	self->priv->cells = (_vala_SudokuBoardCell_array_free (self->priv->cells, self->priv->cells_length1 * self->priv->cells_length2), NULL);
	self->priv->digits = (_vala_SudokuBoardDigitOccurences_array_free (self->priv->digits, self->priv->digits_length1), NULL);
	_g_object_unref0 (self->priv->_broken_coords);
	_g_object_unref0 (self->priv->_coords_for_col);
	_g_object_unref0 (self->priv->_coords_for_row);
	_g_object_unref0 (self->priv->_coords_for_block);
	self->aligned_coords_for_cell = (_vala_array_free (self->aligned_coords_for_cell, self->aligned_coords_for_cell_length1 * self->aligned_coords_for_cell_length2, (GDestroyNotify) g_object_unref), NULL);
	G_OBJECT_CLASS (sudoku_board_parent_class)->finalize (obj);
}

static GType
sudoku_board_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SudokuBoardClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sudoku_board_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SudokuBoard), 0, (GInstanceInitFunc) sudoku_board_instance_init, NULL };
	GType sudoku_board_type_id;
	sudoku_board_type_id = g_type_register_static (G_TYPE_OBJECT, "SudokuBoard", &g_define_type_info, 0);
	SudokuBoard_private_offset = g_type_add_instance_private (sudoku_board_type_id, sizeof (SudokuBoardPrivate));
	return sudoku_board_type_id;
}

GType
sudoku_board_get_type (void)
{
	static volatile gsize sudoku_board_type_id__once = 0;
	if (g_once_init_enter (&sudoku_board_type_id__once)) {
		GType sudoku_board_type_id;
		sudoku_board_type_id = sudoku_board_get_type_once ();
		g_once_init_leave (&sudoku_board_type_id__once, sudoku_board_type_id);
	}
	return sudoku_board_type_id__once;
}

static void
_vala_sudoku_board_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec)
{
	SudokuBoard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_SUDOKU_BOARD, SudokuBoard);
	switch (property_id) {
		case SUDOKU_BOARD_PREVIOUS_PLAYED_TIME_PROPERTY:
		g_value_set_double (value, sudoku_board_get_previous_played_time (self));
		break;
		case SUDOKU_BOARD_DIFFICULTY_CATEGORY_PROPERTY:
		g_value_set_enum (value, sudoku_board_get_difficulty_category (self));
		break;
		case SUDOKU_BOARD_BLOCK_ROWS_PROPERTY:
		g_value_set_int (value, sudoku_board_get_block_rows (self));
		break;
		case SUDOKU_BOARD_BLOCK_COLS_PROPERTY:
		g_value_set_int (value, sudoku_board_get_block_cols (self));
		break;
		case SUDOKU_BOARD_ROWS_PROPERTY:
		g_value_set_int (value, sudoku_board_get_rows (self));
		break;
		case SUDOKU_BOARD_COLS_PROPERTY:
		g_value_set_int (value, sudoku_board_get_cols (self));
		break;
		case SUDOKU_BOARD_MAX_VAL_PROPERTY:
		g_value_set_int (value, sudoku_board_get_max_val (self));
		break;
		case SUDOKU_BOARD_FILLED_PROPERTY:
		g_value_set_int (value, sudoku_board_get_filled (self));
		break;
		case SUDOKU_BOARD_FIXED_PROPERTY:
		g_value_set_int (value, sudoku_board_get_fixed (self));
		break;
		case SUDOKU_BOARD_COMPLETE_PROPERTY:
		g_value_set_boolean (value, sudoku_board_get_complete (self));
		break;
		case SUDOKU_BOARD_BROKEN_COORDS_PROPERTY:
		g_value_set_object (value, sudoku_board_get_broken_coords (self));
		break;
		case SUDOKU_BOARD_COORDS_FOR_COL_PROPERTY:
		g_value_set_object (value, sudoku_board_get_coords_for_col (self));
		break;
		case SUDOKU_BOARD_COORDS_FOR_ROW_PROPERTY:
		g_value_set_object (value, sudoku_board_get_coords_for_row (self));
		break;
		case SUDOKU_BOARD_COORDS_FOR_BLOCK_PROPERTY:
		g_value_set_object (value, sudoku_board_get_coords_for_block (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_sudoku_board_set_property (GObject * object,
                                 guint property_id,
                                 const GValue * value,
                                 GParamSpec * pspec)
{
	SudokuBoard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_SUDOKU_BOARD, SudokuBoard);
	switch (property_id) {
		case SUDOKU_BOARD_PREVIOUS_PLAYED_TIME_PROPERTY:
		sudoku_board_set_previous_played_time (self, g_value_get_double (value));
		break;
		case SUDOKU_BOARD_DIFFICULTY_CATEGORY_PROPERTY:
		sudoku_board_set_difficulty_category (self, g_value_get_enum (value));
		break;
		case SUDOKU_BOARD_BLOCK_ROWS_PROPERTY:
		sudoku_board_set_block_rows (self, g_value_get_int (value));
		break;
		case SUDOKU_BOARD_BLOCK_COLS_PROPERTY:
		sudoku_board_set_block_cols (self, g_value_get_int (value));
		break;
		case SUDOKU_BOARD_ROWS_PROPERTY:
		sudoku_board_set_rows (self, g_value_get_int (value));
		break;
		case SUDOKU_BOARD_COLS_PROPERTY:
		sudoku_board_set_cols (self, g_value_get_int (value));
		break;
		case SUDOKU_BOARD_FILLED_PROPERTY:
		sudoku_board_set_filled (self, g_value_get_int (value));
		break;
		case SUDOKU_BOARD_FIXED_PROPERTY:
		sudoku_board_set_fixed (self, g_value_get_int (value));
		break;
		case SUDOKU_BOARD_BROKEN_COORDS_PROPERTY:
		sudoku_board_set_broken_coords (self, g_value_get_object (value));
		break;
		case SUDOKU_BOARD_COORDS_FOR_COL_PROPERTY:
		sudoku_board_set_coords_for_col (self, g_value_get_object (value));
		break;
		case SUDOKU_BOARD_COORDS_FOR_ROW_PROPERTY:
		sudoku_board_set_coords_for_row (self, g_value_get_object (value));
		break;
		case SUDOKU_BOARD_COORDS_FOR_BLOCK_PROPERTY:
		sudoku_board_set_coords_for_block (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

void
coord_init (Coord *self,
            gint row,
            gint col)
{
	memset (self, 0, sizeof (Coord));
	(*self).row = row;
	(*self).col = col;
}

gint
coord_hash (Coord* coord)
{
	Coord _tmp0_;
	Coord _tmp1_;
	gint result;
	g_return_val_if_fail (coord != NULL, -1);
	_tmp0_ = *coord;
	_tmp1_ = *coord;
	result = (_tmp0_.row * 33) ^ _tmp1_.col;
	return result;
}

gboolean
coord_equal (Coord* a,
             Coord* b)
{
	gboolean _tmp0_ = FALSE;
	Coord _tmp1_;
	Coord _tmp2_;
	gboolean result;
	g_return_val_if_fail (a != NULL, FALSE);
	g_return_val_if_fail (b != NULL, FALSE);
	_tmp1_ = *a;
	_tmp2_ = *b;
	if (_tmp1_.row == _tmp2_.row) {
		Coord _tmp3_;
		Coord _tmp4_;
		_tmp3_ = *a;
		_tmp4_ = *b;
		_tmp0_ = _tmp3_.col == _tmp4_.col;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

Coord*
coord_dup (const Coord* self)
{
	Coord* dup;
	dup = g_new0 (Coord, 1);
	memcpy (dup, self, sizeof (Coord));
	return dup;
}

void
coord_free (Coord* self)
{
	g_free (self);
}

static GType
coord_get_type_once (void)
{
	GType coord_type_id;
	coord_type_id = g_boxed_type_register_static ("Coord", (GBoxedCopyFunc) coord_dup, (GBoxedFreeFunc) coord_free);
	return coord_type_id;
}

GType
coord_get_type (void)
{
	static volatile gsize coord_type_id__once = 0;
	if (g_once_init_enter (&coord_type_id__once)) {
		GType coord_type_id;
		coord_type_id = coord_get_type_once ();
		g_once_init_leave (&coord_type_id__once, coord_type_id);
	}
	return coord_type_id__once;
}

gchar*
difficulty_category_to_string (DifficultyCategory self)
{
	gchar* result;
	switch (self) {
		case DIFFICULTY_CATEGORY_UNKNOWN:
		{
			gchar* _tmp0_;
			_tmp0_ = g_strdup (_ ("Unknown Difficulty"));
			result = _tmp0_;
			return result;
		}
		case DIFFICULTY_CATEGORY_EASY:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup (_ ("Easy Difficulty"));
			result = _tmp1_;
			return result;
		}
		case DIFFICULTY_CATEGORY_MEDIUM:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup (_ ("Medium Difficulty"));
			result = _tmp2_;
			return result;
		}
		case DIFFICULTY_CATEGORY_HARD:
		{
			gchar* _tmp3_;
			_tmp3_ = g_strdup (_ ("Hard Difficulty"));
			result = _tmp3_;
			return result;
		}
		case DIFFICULTY_CATEGORY_VERY_HARD:
		{
			gchar* _tmp4_;
			_tmp4_ = g_strdup (_ ("Very Hard Difficulty"));
			result = _tmp4_;
			return result;
		}
		case DIFFICULTY_CATEGORY_CUSTOM:
		{
			gchar* _tmp5_;
			g_warning ("board.vala:849: Custom difficulty is no longer supported");
			_tmp5_ = g_strdup (_ ("Unknown Difficulty"));
			result = _tmp5_;
			return result;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
}

gchar*
difficulty_category_to_untranslated_string (DifficultyCategory self)
{
	gchar* result;
	switch (self) {
		case DIFFICULTY_CATEGORY_UNKNOWN:
		{
			gchar* _tmp0_;
			_tmp0_ = g_strdup ("Unknown Difficulty");
			result = _tmp0_;
			return result;
		}
		case DIFFICULTY_CATEGORY_EASY:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("Easy Difficulty");
			result = _tmp1_;
			return result;
		}
		case DIFFICULTY_CATEGORY_MEDIUM:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("Medium Difficulty");
			result = _tmp2_;
			return result;
		}
		case DIFFICULTY_CATEGORY_HARD:
		{
			gchar* _tmp3_;
			_tmp3_ = g_strdup ("Hard Difficulty");
			result = _tmp3_;
			return result;
		}
		case DIFFICULTY_CATEGORY_VERY_HARD:
		{
			gchar* _tmp4_;
			_tmp4_ = g_strdup ("Very Hard Difficulty");
			result = _tmp4_;
			return result;
		}
		case DIFFICULTY_CATEGORY_CUSTOM:
		{
			gchar* _tmp5_;
			g_warning ("board.vala:871: Custom difficulty is no longer supported");
			_tmp5_ = g_strdup ("Unknown Difficulty");
			result = _tmp5_;
			return result;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
}

DifficultyCategory
difficulty_category_from_string (const gchar* input)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	static GQuark _tmp1_label2 = 0;
	static GQuark _tmp1_label3 = 0;
	static GQuark _tmp1_label4 = 0;
	static GQuark _tmp1_label5 = 0;
	DifficultyCategory result;
	g_return_val_if_fail (input != NULL, 0);
	_tmp0_ = input;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("Unknown Difficulty")))) {
		switch (0) {
			default:
			{
				result = DIFFICULTY_CATEGORY_UNKNOWN;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("Easy Difficulty")))) {
		switch (0) {
			default:
			{
				result = DIFFICULTY_CATEGORY_EASY;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label2) ? _tmp1_label2 : (_tmp1_label2 = g_quark_from_static_string ("Medium Difficulty")))) {
		switch (0) {
			default:
			{
				result = DIFFICULTY_CATEGORY_MEDIUM;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label3) ? _tmp1_label3 : (_tmp1_label3 = g_quark_from_static_string ("Hard Difficulty")))) {
		switch (0) {
			default:
			{
				result = DIFFICULTY_CATEGORY_HARD;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label4) ? _tmp1_label4 : (_tmp1_label4 = g_quark_from_static_string ("Very Hard Difficulty")))) {
		switch (0) {
			default:
			{
				result = DIFFICULTY_CATEGORY_VERY_HARD;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label5) ? _tmp1_label5 : (_tmp1_label5 = g_quark_from_static_string ("Custom Puzzle")))) {
		switch (0) {
			default:
			{
				g_warning ("board.vala:893: Custom difficulty is no longer supported");
				result = DIFFICULTY_CATEGORY_UNKNOWN;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				g_warning ("board.vala:896: Difficulty is not valid");
				result = DIFFICULTY_CATEGORY_UNKNOWN;
				return result;
			}
		}
	}
}

static GType
difficulty_category_get_type_once (void)
{
	static const GEnumValue values[] = {{DIFFICULTY_CATEGORY_UNKNOWN, "DIFFICULTY_CATEGORY_UNKNOWN", "unknown"}, {DIFFICULTY_CATEGORY_EASY, "DIFFICULTY_CATEGORY_EASY", "easy"}, {DIFFICULTY_CATEGORY_MEDIUM, "DIFFICULTY_CATEGORY_MEDIUM", "medium"}, {DIFFICULTY_CATEGORY_HARD, "DIFFICULTY_CATEGORY_HARD", "hard"}, {DIFFICULTY_CATEGORY_VERY_HARD, "DIFFICULTY_CATEGORY_VERY_HARD", "very-hard"}, {DIFFICULTY_CATEGORY_CUSTOM, "DIFFICULTY_CATEGORY_CUSTOM", "custom"}, {0, NULL, NULL}};
	GType difficulty_category_type_id;
	difficulty_category_type_id = g_enum_register_static ("DifficultyCategory", values);
	return difficulty_category_type_id;
}

GType
difficulty_category_get_type (void)
{
	static volatile gsize difficulty_category_type_id__once = 0;
	if (g_once_init_enter (&difficulty_category_type_id__once)) {
		GType difficulty_category_type_id;
		difficulty_category_type_id = difficulty_category_get_type_once ();
		g_once_init_leave (&difficulty_category_type_id__once, difficulty_category_type_id);
	}
	return difficulty_category_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

