Exemplo n.º 1
0
  static bool r_solve(std::vector<std::vector<int> >& s) {
    //kiprint(s);
    //char x;
    //std::cin>> x;

	cell c = best_choice(s);
	// Készen vagyunk?
	if (c.pos_val_num ==10000 ) // are there possibilities left?
	{
        filter_sudoku=s;
		return true;
	}
    for( auto n : s[c.x + table_width*c.y] ) { // Iterate throught the possible values

        // Másoljuk le a táblát
        auto other = s;
        // Írjuk bele az új értéket
        std::vector<int> nn{n};
        other[c.x + table_width*c.y] = nn;
        if (!filter(other, c.x, c.y))
            continue;

        if (r_solve(other))
            return true;
    }
    return false;
  }
Exemplo n.º 2
0
inline void Agent::act( char *msg)
{
	int i = best_choice();
	sprintf(msg, "%c", (char)(i));
	printf(">>>> action sended: x %d, y %d, pos %d\n", xx[i], yy[i], i);
}