At first I actually thought about stopping where I am now, and not completing the assignment entirely (possibly making a complete Java version), but I have come so far now so I just gotta finish it
same here. I'm looking for subsets and stuff but I can't really apply that rule anywhere
My first 'naive' brite-force attempt, on the same puzzle as Simon has pictured there (with the same amount of 'solution', is huge..... too long to run on one CPU in an hour.
1. Introduction
This is a solution to Weekend Challenge #3: a Sudoku solver in Python. It works by translating a Sudoku puzzle into an exact cover problem, and then solving the exact cover problem using Donald Knuth's "Algorithm X". The code should be self-explanatory (assuming you've read and u...
I guess that depends on the algorithm and the person. :-) Someone else may be able to complete this solver in that time, but it could take me longer.
By the way, have you seen this answer of mine (and the question itself)? I'm only one away from my first Necromancer. I'd say only a smaller portion of the answer is specific to C++.
I agree with the comments implying that floating-point shouldn't be used with money due to issues with precision. Nonetheless, I'll point out some general flaws I've found in your code.
There should be a std:: in front of pow(10.0, pos) since you're not using using namespace std. This is not ...
This is part of my attempt at the Week-End Challenge #3. The overall problem is larger than will fit in one question. This is a well-contained subset of my larger program.
The goal of this part is to brute-force all possible (if any) solutions to a puzzle. The input to this algorithm is a 2-dime...
I don't know if it has any performance drawbacks, but coding it is so simple. Just a few lines for something that would take two interfaces and five classes in Java (OK, that was an exaggeration...)
@SimonAndréForsberg Don't worry about who will review your C# code :)
With LINQ-to-SQL (and -Entities), you work against an IQueryable, so as long as you don't hit the database until you materialize (i.e. actually iterate) your query. Best thing since sliced bread, I'm telling you!
@SimonAndréForsberg - yeah, one of my 'trademarks' is that I avoid any heap-space objects in recursion or tight loops. 'My' algorithm has none (other than when it actually finds a solution).
This is my first attempt at a weekend-challenge. I would prefer if reviews contained suggestions on how to improve the algorithm, but all suggestions are acceptable.
Here is the code:
#include <stdio.h>
int isAvailable(int sudoku[][9], int row, int col, int num)
{
int rowStart = (row/3) *...
This is my first attempt at a weekend-challenge. I would prefer if reviews contained suggestions on how to improve the algorithm, but all suggestions are acceptable.
Here is the code:
#include <stdio.h>
int isAvailable(int sudoku[][9], int row, int col, int num)
{
int rowStart = (row/3) *...
@SimonAndréForsberg @retailcoder - Console is null for all occasions you run in eclipse, and it is a Java low-level interace to an actual console (think unix TTY, or PTY) (or DOS/Windows 'CON'). When running in eclipse, you may have a STDIN and STDOUT/ERR, but you are not in an actual console.
No, FWIW, I have never had occasion to use a console, but you can do things like intercept control characters, it's unbufferred, etc.... if you need it. But, for most things people do, it will be null (because your JVM is not directly attached to the Console).
Some "memes"...
A few expressions have come up recently, thought I'd share them here (feel free to add, this is CW!)
Running out of ammo: when you have exhausted all 40 votes for the day.
Head shot: when you're out of ammo and post a target in chat, and then someone puts in a vote for you.
Wak...
In fact, I added all the personalities that are there
For being involved in the Raspberry Pi SE site
And from now on, for being able to reduce 1500 lines to 85
A good place to start looking is to see which messages you have posted that has been starred: http://chat.stackexchange.com/rooms/info/11760/cr-weekend-challenge?tab=stars&filter=mymessages http://chat.stackexchange.com/rooms/info/8595/the-2nd-monitor?tab=stars&filter=mymessages
@retailcoder http://stackoverflow.com/questions/4359979/java-equivalent-to-c-sharp-extension-methods Java does not support extension methods. Instead, you can make a regular static method, or write your own class.
Normally in Java, I use public static methods for what you want
Eclipse is so much more powerful in so many ways that I can now fully appreciate :)
With extension methods you can extend (add methods to) any type you want, including stuff in the core libraries, or in 3rd-party code you don't even have sources for.
Kudos for Eclipse though, it's a very nice IDE. Too bad it doesn't do C#
This is my first attempt at a weekend-challenge. I would prefer if reviews contained suggestions on how to improve the algorithm, but all suggestions are acceptable.
#include <stdio.h>
int isAvailable(int puzzle[][9], int row, int col, int num)
{
int rowStart = (row/3) * 3;
int colStar...
@SimonAndréForsberg I'm looking at the hottest questions from the old hotbar from chat. Maybe they are using a newer algorithm for the hottest questions now.
This is my first, very-very first attempt at java. I haven't started tackling the actual resolution of the sudoku puzzle (not even sure where to start, haven't looked at other weekend-challenge entries yet). I don't have much to go over here, but I'm sure it's filled with beginner mistakes alread...
This is my first, very-very first attempt at java. I haven't started tackling the actual resolution of the sudoku puzzle (not even sure where to start, haven't looked at other weekend-challenge entries yet). I don't have much to go over here, but I'm sure it's filled with beginner mistakes alread...
Instead of your String puzzle you could use an String[] like this: (Not saying you have to, but you should know that the alternative exists) You are currently converting it to a String array later anyway, so why not have it as a String array right from the start?
private final static String[] p...
15 minutes, HA! Take that, average answering time!
You can set an option in the build settings to build a .xml file with all of your xml-comments; I use SandCastle to make a MSDN-style HTML help out of it.
(poof lol)
SandCastle would be equivalent to your javadoc.exe (I believe there's even a command-line to build the HTML)
@SimonAndréForsberg why does public static final int HIGHEST_VALID_VALUE = SudokuGrid.REGION_SIZE*SudokuGrid.REGION_SIZE; work, but not public static final int HIGHEST_VALID_VALUE = SudokuGrid.REGION_SIZE^2;?