sudoku

ambigous call on recursive sudoku_backtracker function.

[亡魂溺海] 提交于 2019-12-12 02:02:31
问题 This is my program to solve a sudoku puzzle by using a backtracking algorithm. The program will recursively call itself until it is either solved or if it is unsolvable. The problem is that when I run it the compiler says that the sudoku_backtracker() function call in line 19 of sudoku_solver.cpp is ambiguous. Can someone please explain to me why it says that and how can I fix it. If there are other problems I would also appreciate the help. Thanks alot. #include <iostream> #include <string>

Block scanning on sudoku solver explanation

ε祈祈猫儿з 提交于 2019-12-11 20:27:15
问题 I tried this sudoku solver http://www.emanueleferonato.com/2008/12/09/sudoku-creatorsolver-with-php/. It works fine. Also see this spreadsheet to see more detail in calculation : spreadsheet I understand how the row and col scanning. From the board, we know that: index = 9*row + col row = floor(index/9) col = index % 9 And for the block, because it build from 3x3 board so the formula: block_index = 3*row_block + col_row . Because per block there are 3 rows and cols, so the formula for row

How to solve Sudoku by backtracking and recursion?

99封情书 提交于 2019-12-11 12:31:57
问题 the reason why I am creating this new thread instead of just reading the answers to this particular question that have been given before is that I feel I just don't fully understand the whole idea behind it. I can't seem to get my head around the whole backtracking concept. So I need to fully understand backtracking and then solve the particular sudoku problem. What I understand so far is that backtracking is a technique to go back, in (e.g.) a recursive flow if one discovers that decisions

Brute force Sudoku algorithm [duplicate]

隐身守侯 提交于 2019-12-11 11:10:12
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: Sudoku algorithm, brute force For several days I have tried to write a brute force algorithm for solving sudoku, my problem is that I never realy get the algorithm to work 100 %, can someone please direct me and give some help ? The Algorithm is located in Square class, recursive function. public abstract class Square { private Square next; private Box box; private Row row; private Columne columne; private int

Generation of sudoku questions

萝らか妹 提交于 2019-12-11 08:24:24
问题 I am doing a sudoku game. My problem is the generation of sudoku questions. I want to generate questions in three difficulties. Is there any idea to generate 3 level questions? 回答1: If we go for pre generated sudoku puzzles, maybe you could have a look at this : http://www.setbb.com/phpbb/viewtopic.php?t=102&mforum=sudoku we used terminal sudoku in the Linux distributions it has a batch generator mode. the website is down but it is packaged for some linux distributions. generate puzzles for

how is sudoku np-complete?

和自甴很熟 提交于 2019-12-11 06:24:22
问题 how is Sudoku an np-complete problem? according to wiki, to be classed as an np-complete problem it must satisfy 2 conditions problem must be in np every other problem in np must be reducible to given problem in polynomial time how is the second condition satisfied? can you give an example? for instance, I don't see any correlation between Sudoku problem and the travelling salesman problem or knapsack problem (kindly forgive poor formatting as I'm typing this question on my mobile device) 回答1

android sudoku game, button press crashes the game

蓝咒 提交于 2019-12-11 05:37:55
问题 I'm creating a sudoku game, but when i press the button it crashes the game. Here's my code: FPSudoku.java: package org.example.fpsudoku; import android.app.Activity; import android.os.Bundle; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; public class FPSudoku extends Activity implements OnClickListener{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); View

Sudoku solver is slow, needs considering constraints earlier

て烟熏妆下的殇ゞ 提交于 2019-12-11 03:52:00
问题 I have an NxN sudoku solver written in prolog. The code below works fine for 4*4 solving. (I have some Domain infos) But it is slow for 9x9. I've tried many way to improve the create row function, that it is already considering that every value in a row should be unique (and must be contained in its domain), but they did not work. How could I improve this without any librarys? all_distinct(X) :- sort(X, Sorted), length(X, OriginalLength), length(Sorted, SortedLength), OriginalLength ==

Generating random 'su doku' type matrices in MATLAB

守給你的承諾、 提交于 2019-12-10 22:11:34
问题 I need to generate some 5x6 matrices in MATLAB. They need to consist of randomly generated integers in the range 1-6, however, an integer cannot occur more than once in a particular row or column. Here is the script I am currently using to generate random 5x6 matrices: mat=zeros(5,6); rows=5; columns=6; for i=1:rows for j=1:columns mat(i,j)=round(rand*(high-low)+low); end end disp(mat) But I don't know how to insert the rule about repeats into this. I'm sure this is a relatively simple

How to getText() like input[i][j].getText(); (for sudoku solver in netbeans)

冷暖自知 提交于 2019-12-10 17:36:15
问题 I want to get the text in int form from 81 text fields arranged in a 9 X 9 grid but don't want to do it individually. I tried to put it in a loop but the problem is that the text field name has to be shown in a[i][j] form. for (i = 0; i < 9; i++) { for (j = 0; j < 9; j++) { a[i][j] = *i want the name of text field like "a" + i + j*.getText(); } } The text fields are name like: a00, a01, a02, a03, a04 ... a88. 回答1: You can't do that with java (actually there are ways of doing that, but they