Overall, this is pretty good code for a beginner's solution to a relatively complex problem.
But your code does have me a little lost. For one, I'm not quite sure why you're using recursion here. It seems like that will be a lot more memory intensive than it needs to be for a straightforward p...
@retailcoder I was thinking about reviewing that Java Sudoku code using my C program as a base, but I fear that it wouldn't be very OOP and that I would be ridiculed for that.
@Donald.McLean spam = "unsolicited bulk messages". We don't know whether he's posting elsewhere (therefore "bulk"); but we do know we don't want it (therefore "unsolicited").
I think this would be a more efficient way of doing it (at least for the printable ASCII characters):
++++[->++++++++<] Use cell 0 for loop and cell 1 for ASCII codes
++++[->>++++++++<<]>>> Use cell 2 for the space
+++>++> ...
I made my first Brainfuck program today, which prints the numbers 0-255 and the corresponding character.
I was wondering if I could improve my program, as I'm repeating myself a lot (e.g. 3 x copy & paste "comparer" function):
max == 255
LF == 10
space == 32
'0' == 48
'9' == 57
':' =...
for anyone who wants to know, I was thinking of either letting the OP accept an answer or go by upvotes, because I am not familiar with the coding style of Brainfuck
I think this would be a more efficient way of doing it (at least for the printable ASCII characters):
++++[->++++++++<] Use cell 0 for loop and cell 1 for ASCII codes
++++[->>++++++++<<]>>> Use cell 2 for the space
+++>++> ...
Don't name your functions in upper case. It's confusing because that is reserved for classes. Perhaps that's an issue of copying it here.
You see how verbose this code is? It's a good idea to use Jython or JRuby for making a Java application interactive, with a shell. It's quite easy to do.
Oth...
Not a specific crit of your solution. Here is a solution I put together for my own fun.
public class Sudoku {
// The size of one box on the board.
static final int Box = 3;
// The size of the board.
static final int Size = Box * Box;
// The board I work with.
final int[][] board;
...
Many beta-sites suffer with a problem of voting. Code Review is one of them. We at Code Review have realized that it is hard to vote for answers that you're not aware of, therefore some of us (no monkeys named) posts a link to a recent answer every now and then in the chat.
Instead of us posting...
How can I align jpeg or gif image (center)? using sql query.
My intention is to insert a company logo on report such that the logo will appear at the top center of the page. Please see the codes below:
FileStream stream4 = new FileStream("ourlogo.jpg", FileMode.Open, FileAccess.Read, FileShare.R...
I am trying to make a simulator for a micro controller in which whenever I call the runNextStep() method, it will run the next instruction.
I have made a single button which will just execute the next instruction by calling the runNextStep() method, but I want to make a run button which will hav...
A few points:
Your code for both searching for the node to be removed and for removing it is broken. @HABO pointed out the second part of this. You need to check both halves of the tree for the node. Then, if you find it and delete it, you have to combine both its child subtrees into a new subt...
From a onceover:
instanceof works, so bonus points there
Some terrible names : decl, getCtor, declFn, declObj, just type the full name
You have an unmaintainable/undocumented nested ternary in getCtor()
It is a neat idea to define the constructor and auto-magically move the functions to proto...
Huh, I answered a bash question, and I have learned something new about xargs For those who know what xargs is, I wonder whether you have encountered the --max-procs option ... amazing ;-)
This is a continuation of this:
Performance of BigInteger square root and cube root functions in Java
I've made most of the changes suggested, but since I'm loading literally the largest array possible on the computer, I'd like some review before I implement Sieve of Atkin.
Code follows, just ...
@apieceoffruit Scratch sounds a bit interesting. Looking it up. I studied to become a teacher once, and even though I quit that I'm still interested in how people learn programming.
I disagree. In both cases that you give isEven would make more sense as a method name.
evenNumber does not describe a method well - it is unclear whether it is creating an even number, changing a number to make it even, checking for evenness, etc.
Sorry for my English.
I want to discuss this question. I don't agree with @200_success. He says:
I would also rename evenNumber(int number) to isEven(int number). There
is a convention in Java that functions named isSomething() return a
boolean and have no side effects. Your function mee...
I have a FORTRAN code which numerically integrates the equations of motion for large data sets of initial conditions. I run this code to my PC and it requires about 2 days time in order to integrate about 50000 initial conditions. So, I was wondering if there is any site with super-fast PCs (or a...
using a computer generated Number/password could have Drawbacks in that a computer cannot generate a completely random set. it has to be based on something to give it a starting point, so eventually the pattern will repeat, although with the way technology is going we are getting better at using ...
@Malachi Don't have an account on security but I think computers are a whole lot more random than people can ever be, so I would not up-vote that answer.
@Malachi There's a great episode of an old TV show called "Ed", from around 2000. Season 3 episode 1, called "Human Nature", love that episode. If you know what you are doing, you can play a lot of tricks on the human mind.
@retailcoder Ah, trying to outsmart Murphy's Law, are you?
What quickly jumps out:
typedef vector<dimension*> VecDim;
// ^ Pointer
typedef vector<dimension*>::iterator VecDimIter;
// ^ Pointer
Its very rare to see "raw" pointers in good C++ code. This is because now you have to do memory management on ...
I'm having really unexpected Java behavior, where it seems like a private property is able to have its public methods called.
public class ArrayListTest
{
public static void main()
{
ArrayListContainer weirdList = new ArrayListContainer( "Other" );
ArrayListContainer supe...
This seems like a pretty basic question, so bear with me...Say I have two (or many) methods in the same class that need a LINQ to SQL DataContext. Additionally, I am needing the DataContext in other classes as well. Does it make sense to create the new DataContext every time?
Should I be creati...
@amon Yeah, he seems to think that the methods belong to the field somehow... I tried to make a minor answer in a comment and I hope it gets closed ASAP.