Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Tentaizu

Name: Anonymous 2010-12-04 4:33

Can someone explain what the parts of this code do? http://pastebin.com/Tx4e77V7

There are no comments in the code


http://green-oval.net/cgi-board.pl/g/thread/14609694

Here is my thread from /g/ talking about the premise of the program

Name: Anonymous 2010-12-04 4:40

>>1
Then click the link and go back there, ``please''.

Name: Anonymous 2010-12-04 4:54

>>2
You PUDDI ?

Name: Anonymous 2010-12-04 5:10

>>3
lmao jelly vs puddi
brilliant

Name: Anonymous 2010-12-04 6:52

>>4 LMAO LMFAO OMG ROFL

Name: Anonymous 2010-12-04 11:10

It's a brute-force solver. The basic algorithm goes like this:

1. Let S be the first unknown square. If there are none, then the game has been solved, so record the solution somewhere and return true to indicate a solution was found.
2. If S being a star does not contradict anything already known, set S to a star and recurse to step 1. If this recursion returns true, then return true.
3. If S being a non-star does not contradict anything already known, set S to a non-star and recurse to step 1. If this recursion returns true, then return true.
4. If we reach this step, then the game has no solution because both S being a star and S being a non-star had contradictions. Unset S and return false.

Name: VIPPER 2010-12-04 11:26

I wish all of you would be killed by JEWS

Name: Anonymous 2010-12-04 11:53

>>7
You have been kill by jews

Name: Anonymous 2010-12-04 11:56

>>8
No John, you are the jews!

Name: Anonymous 2010-12-04 12:17

sage

Name: Anonymous 2010-12-04 12:30

noko

Name: Anonymous 2010-12-04 19:17

PUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDI
UDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIP
DDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPU
D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DIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUD
IPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDDIPUDD

Name: Anonymous 2010-12-04 22:26

>>6
So it just is a DFS of the squares and if goes until there is a fault found and it backs up to a point where there isn't a fault and changes one spot and tries again?

Name: Anonymous 2010-12-05 1:05

>>6,13
That sounds like what us in the know usually call ``backtracking.''

Name: Anonymous 2010-12-05 1:53

>>14
is there a better way to solve that problem? Or is that the only good solution

Name: Anonymous 2010-12-05 2:46

>>15
It's not the only good solution, but it's a good solution because it's simple to code.

You could set it up as a set of equations for binary integer programming, but these problems are usually NP-hard when generalized, so you probably won't find an efficient solution for all cases.

Name: Anonymous 2010-12-05 3:02

>>16
I was looking at something about that yesterday, and needed a way to solve a 49 x 49 matrix. Thanks for your help though, just wondering if you know what the adj, adj2 matrices do in this code?  I see that the adj matrix is being filled with -1 if a spot is unknown, and then being filled with the hint number if it exists. But the other boards seems to just be initialized to 0, and I don't see how that would be useful.

Name: Anonymous 2010-12-05 3:29

Gauauauauauauauauaussian eeeeeeeeeeliminaaation.

Name: Anonymous 2010-12-05 4:37

>>18
"It works out perfectly if we just set this square to contain -22 stars."

Name: Anonymous 2010-12-05 5:04

>>19
is that the same as the physics joke where they can work out the problem if the cow is spherical and weightless?

Name: Anonymous 2010-12-05 13:12

>>20
A similar vein of abstract absurdity, yes.

Name: Anonymous 2010-12-05 13:30

>>19
If the system has a solution, then you either get a parameter (which you will be able to set to something that makes sense) or you will get a valid solution directly.

Name: Anonymous 2010-12-05 15:11

>>22
It will remove redundant equations, which could potentially simplify a typical ``human-solvable'' puzzle, but you'll still have to set the remaining parameters according to the binary constraints, which I suspect is NP-hard, like in Minesweeper.
Not saying it's wrong or not worth doing, but it's not a general solution since it doesn't solve for all the constraints.

Don't change these.
Name: Email:
Entire Thread Thread List