OZONE Asylum
Forums
Server-Side Scripting - Oh my!
Creating Sudoku 3x3x3x3
This page's ID:
33324
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Oh, crap. There is something that I forgot in the above code. I have the variable dr_inter as a global at the top. I originally had this a parameter passed to the sub-routine, but moved it because it was so much easier to change it at the top. Might want to change that back to passed parameter if you feel the need. (BTW, I was a bit tipsy when I wrote that last post. Amazing that I can still write halfway decently after a pint of whiskey and a few lagers.) Personally, I really don't feel the need to use row/col swaps. But here's the sub to do it: [code] def shuffle_sudo_4d(sgrid): rs=[[0,2,1],[1,0,2],[1,2,0],[2,0,1],[2,1,0]] nby=random.choice(rs) nbx=random.choice(rs) ncy=[random.choice(rs)] ncy.append(random.choice(rs)) ncy.append(random.choice(rs)) ncx=[random.choice(rs)] ncx.append(random.choice(rs)) ncx.append(random.choice(rs)) tgrid=[[[[0,0,0],[0,0,0],[0,0,0]],[[0,0,0],[0,0,0],[0,0,0]],[[0,0,0],[0,0,0],[0,0,0]]], [[[0,0,0],[0,0,0],[0,0,0]],[[0,0,0],[0,0,0],[0,0,0]],[[0,0,0],[0,0,0],[0,0,0]]], [[[0,0,0],[0,0,0],[0,0,0]],[[0,0,0],[0,0,0],[0,0,0]],[[0,0,0],[0,0,0],[0,0,0]]]] rotbit=random.choice([0,1]) for by in range(3): for bx in range(3): for cy in range(3): for cx in range(3): if rotbit: tgrid[by][bx][cy][cx]=sgrid[nby[by]][nbx[bx]][ncy[by][cy]][ncx[bx][cx]] else: tgrid[bx][by][cx][cy]=sgrid[nby[by]][nbx[bx]][ncy[by][cy]][ncx[bx][cx]] return tgrid [/code] Quick-n-dirty hard-code. No big deal. One last thing that I want to touch on. See when I get back.
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »
Maximum Security
OZONE
DHTML/Javascript
Server-Side Scripting - Oh my!
CSS - DOM - XHTML - XML - XSL - XSLT
Stupid Basic HTML
Visual Therapy
Photoshop
Photoshop Pong, Anyone?
***WARNING*** BIG SIG APPROACHING
Photography
3D Modelling & Rendering
Multimedia/Animation
Print Graphics
Holding Pens
Philosophy and other Silliness
Outpatient Counseling
Site reviews!
Mad Scientists' Laboratory
Getting to know the Grail