OZONE Asylum
Forums
Server-Side Scripting - Oh my!
Sudoku WarJ style
This page's ID:
33127
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
Was thinking about the fractal thing that I can see in base(3) sudoku grids. I now know it's nature. It is a function of probability. The probability of seeing a fractal pattern are damn high. Instead of trying to work with the fractal pattern, I'm taking it into the realm of probability where the fractal pattern springs from. I've already gotten my base shuffle engine written and it damn good working order. But it is going to take some time to code the sub-set extractions. Okay, so apparent fractal pattern. Easy to see in base(3). As the base goes up, so does the complexity of the pattern. I had worked out how to recurse the complexity. Once I saw the rules in the rising complexity/recursion, I was able to reduce it down to a very simple and specific form of shuffling. So, in a way of celebrating, I'm tossing out some exercise code. Lots of fun to be had when you start swapping values around in bgrid. [code] #!/usr/bin/env python # this is the base # see what happend when # you swap some of the # values around bgrid=[[0,1,2], [3,4,5], [6,7,8]] # this holds the base(3) bits # for example: 5=[1,2] # 1*3+2=5 sgrid=[[0,0,0], [0,0,0], [0,0,0]] # this is the final output grid # once the bits are moduloed state=[[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]] # take the base, and split it # into base(3) bits for cy in range(3): for cx in range(3): lbit=bgrid[cy][cx]/3 rbit=bgrid[cy][cx]%3 sgrid[cy][cx]=[lbit,rbit] # the left bit, the right bit, # and some modulo magic for by in range(3): for bx in range(3): for cy in range(3): for cx in range(3): lbit=(sgrid[cy][cx][0]+bx)%3 rbit=(sgrid[cy][cx][1]+by)%3 fbit=lbit*3+rbit state[by*3+cy][bx*3+cx]=fbit # kick it out to screen bseq=['0','1','2','3','4','5','6','7','8','9'] aline=' +-------+-------+-------+\n' cout='' for k in range(9): if (k%3)==0: cout+=aline for j in range(3): cout+=' |' for i in range(3): cout+=' '+bseq[state[k][j*3+i]] cout+=' |\n' cout+=aline print(cout) [/code] [small](Edited by [url=http://ozoneasylum.com/user/351]warjournal[/url] on 11-06-2016 14:33)[/small]
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