Pasha pattered algorithm.
#1
Thread Starter
Pro
Pasha pattered algorithm.
Was great to see folks at the rendezvous this weekend. As noted., I saw the pasha pattern on the cars and was able to write an algorithm to generate the pattern. I used Visual basic and excel because it was just the most convent way to do things. Basically this process sets a size and a decay percentage. It will run several iterations and use the prior value to either decay or grow. the pattern runs along both the X and Y axis by moving the cell selection one row and one column. the last part is just for coloring the squares. Feel free to experiment and use this how you want. Hope folks find some use.
below is the code you can pop into excel and run visual basic (the copy and paste did not work very well). followed by a screenshot of the output
code -------
Sub pasha()
Dim Seed
Dim Ratio
'this is the size of the initial square. pattern is uneffeted by size, but does deteremin the size of the document.
Seed = 10
'this is the decay and growth ratio. can play around. found things less than 80% not all that great.
Ratio = 0.87
Range("A1").Select
'run 20 itterations. this can set the size of the overlall document
For s = 1 To 20
'this is the diminishing pattern this has to equal the growing pattern and visa versa. 'Found 12 works well. may not be the actual porsche pattern.
For i = 1 To 12
Selection.ColumnWidth = Seed Selection.RowHeight = Seed * 5.33 'the 5.33 ratio is just to overcome excel funkiness Makes the cell square
ActiveCell.Offset(1, 1).Select
'had to fine tune the pattern. you can play with the numbers. but has to equal the grow pattern and visa versa
Select Case i
Case Is < 2 Seed = Seed * Ratio
Case Is < 6 Seed = Seed * (Ratio / 0.99)
Case Is >= 6 Seed = Seed * (Ratio / 0.97)
End Select
Next i
'same as above, but this is the growth sequence
For i = 1 To 12
Selection.ColumnWidth = Seed Selection.RowHeight = Seed * 5.33
ActiveCell.Offset(1, 1).Select
Select Case i
Case Is < 2 Seed = Seed / (Ratio / 0.97)
Case Is < 6 Seed = Seed / (Ratio / 0.99)
Case Is >= 6 Seed = Seed / (Ratio)
End Select
Next i
Seed = 10 'have to reset seed if you change it
Next s
'this will color in the boxes
Range("A1").Select
For s = 1 To 50
For i = 1 To 60
ActiveCell.Interior.Color = black
ActiveCell.Offset(0, 2).Select
Next i
ActiveCell.Offset(2, 0).Select Range(ActiveCell.EntireRow.Address)(1, 1).Select
Next s
Range("A1").Select ActiveCell.Offset(1, 0).Select
For s = 1 To 50 ActiveCell.Offset(0, 1).Select
For i = 1 To 60 ActiveCell.Interior.Color = black
ActiveCell.Offset(0, 2).Select
Next i
ActiveCell.Offset(2, 0).Select Range(ActiveCell.EntireRow.Address)(1, 1).Select
Next s
End Sub
that is it.
Enjoy
this is the pasha pattern output from the code.
below is the code you can pop into excel and run visual basic (the copy and paste did not work very well). followed by a screenshot of the output
code -------
Sub pasha()
Dim Seed
Dim Ratio
'this is the size of the initial square. pattern is uneffeted by size, but does deteremin the size of the document.
Seed = 10
'this is the decay and growth ratio. can play around. found things less than 80% not all that great.
Ratio = 0.87
Range("A1").Select
'run 20 itterations. this can set the size of the overlall document
For s = 1 To 20
'this is the diminishing pattern this has to equal the growing pattern and visa versa. 'Found 12 works well. may not be the actual porsche pattern.
For i = 1 To 12
Selection.ColumnWidth = Seed Selection.RowHeight = Seed * 5.33 'the 5.33 ratio is just to overcome excel funkiness Makes the cell square
ActiveCell.Offset(1, 1).Select
'had to fine tune the pattern. you can play with the numbers. but has to equal the grow pattern and visa versa
Select Case i
Case Is < 2 Seed = Seed * Ratio
Case Is < 6 Seed = Seed * (Ratio / 0.99)
Case Is >= 6 Seed = Seed * (Ratio / 0.97)
End Select
Next i
'same as above, but this is the growth sequence
For i = 1 To 12
Selection.ColumnWidth = Seed Selection.RowHeight = Seed * 5.33
ActiveCell.Offset(1, 1).Select
Select Case i
Case Is < 2 Seed = Seed / (Ratio / 0.97)
Case Is < 6 Seed = Seed / (Ratio / 0.99)
Case Is >= 6 Seed = Seed / (Ratio)
End Select
Next i
Seed = 10 'have to reset seed if you change it
Next s
'this will color in the boxes
Range("A1").Select
For s = 1 To 50
For i = 1 To 60
ActiveCell.Interior.Color = black
ActiveCell.Offset(0, 2).Select
Next i
ActiveCell.Offset(2, 0).Select Range(ActiveCell.EntireRow.Address)(1, 1).Select
Next s
Range("A1").Select ActiveCell.Offset(1, 0).Select
For s = 1 To 50 ActiveCell.Offset(0, 1).Select
For i = 1 To 60 ActiveCell.Interior.Color = black
ActiveCell.Offset(0, 2).Select
Next i
ActiveCell.Offset(2, 0).Select Range(ActiveCell.EntireRow.Address)(1, 1).Select
Next s
End Sub
that is it.
Enjoy
this is the pasha pattern output from the code.
The following 5 users liked this post by drwhosc:
checkmate1996 (10-22-2019),
Daniel5691 (06-30-2019),
fatmanontwowheels (10-23-2019),
Hey_Allen (06-30-2019),
slate blue (06-30-2019)
#3
Rennlist Member
Nicely done! There was a long thread in the not-too-distant past that attempted to figure out the Pasha algorithm.
#4
Rennlist Member
Yes, I remember that thread too. This one needs to be combined into that one so that we have this outstanding and important material in one place. That is some amazing program right here
#5
Race Car
Very Cool! Thanks for putting this together. However there is a small issue with your copy-pasted code above. It combined two lines of code into one line in some cases which causes an error when compiling. I had to manually separate those lines in VB. Here is a copy/paste friendly version of the code with that corrected. Also I changed the "s" run iteration value from 20 to 5 because at 20 I was running out of sheet space. Now it works great! Below is a screen shot of my pasha.
Sub pasha()
Dim Seed
Dim Ratio
'this is the size of the initial square. pattern is unaffected by size, but does determine the size of the document.
Seed = 10
'this is the decay and growth ratio. can play around. found things less than 80% not all that great.
Ratio = 0.87
Range("A1").Select
'run 5 iterations. this can set the size of the overall document
For s = 1 To 5
'this is the diminishing pattern this has to equal the growing pattern and visa versa. 'Found 12 works well. may not be the actual Porsche pattern.
For i = 1 To 12
Selection.ColumnWidth = Seed
Selection.RowHeight = Seed * 5.33 'the 5.33 ratio is just to overcome excel funkiness Makes the cell square
ActiveCell.Offset(1, 1).Select
'had to fine tune the pattern. you can play with the numbers. but has to equal the grow pattern and visa versa
Select Case i
Case Is < 2
Seed = Seed * Ratio
Case Is < 6
Seed = Seed * (Ratio / 0.99)
Case Is >= 6
Seed = Seed * (Ratio / 0.97)
End Select
Next i
'same as above, but this is the growth sequence
For i = 1 To 12
Selection.ColumnWidth = Seed
Selection.RowHeight = Seed * 5.33
ActiveCell.Offset(1, 1).Select
Select Case i
Case Is < 2
Seed = Seed / (Ratio / 0.97)
Case Is < 6
Seed = Seed / (Ratio / 0.99)
Case Is >= 6
Seed = Seed / (Ratio)
End Select
Next i
Seed = 10 'have to reset seed if you change it
Next s
'this will color in the boxes
Range("A1").Select
For s = 1 To 50
For i = 1 To 60
ActiveCell.Interior.Color = black
ActiveCell.Offset(0, 2).Select
Next i
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.EntireRow.Address)(1, 1).Select
Next s
Range("A1").Select
ActiveCell.Offset(1, 0).Select
For s = 1 To 50
ActiveCell.Offset(0, 1).Select
For i = 1 To 60
ActiveCell.Interior.Color = black
ActiveCell.Offset(0, 2).Select
Next i
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.EntireRow.Address)(1, 1).Select
Next s
End Sub
Sub pasha()
Dim Seed
Dim Ratio
'this is the size of the initial square. pattern is unaffected by size, but does determine the size of the document.
Seed = 10
'this is the decay and growth ratio. can play around. found things less than 80% not all that great.
Ratio = 0.87
Range("A1").Select
'run 5 iterations. this can set the size of the overall document
For s = 1 To 5
'this is the diminishing pattern this has to equal the growing pattern and visa versa. 'Found 12 works well. may not be the actual Porsche pattern.
For i = 1 To 12
Selection.ColumnWidth = Seed
Selection.RowHeight = Seed * 5.33 'the 5.33 ratio is just to overcome excel funkiness Makes the cell square
ActiveCell.Offset(1, 1).Select
'had to fine tune the pattern. you can play with the numbers. but has to equal the grow pattern and visa versa
Select Case i
Case Is < 2
Seed = Seed * Ratio
Case Is < 6
Seed = Seed * (Ratio / 0.99)
Case Is >= 6
Seed = Seed * (Ratio / 0.97)
End Select
Next i
'same as above, but this is the growth sequence
For i = 1 To 12
Selection.ColumnWidth = Seed
Selection.RowHeight = Seed * 5.33
ActiveCell.Offset(1, 1).Select
Select Case i
Case Is < 2
Seed = Seed / (Ratio / 0.97)
Case Is < 6
Seed = Seed / (Ratio / 0.99)
Case Is >= 6
Seed = Seed / (Ratio)
End Select
Next i
Seed = 10 'have to reset seed if you change it
Next s
'this will color in the boxes
Range("A1").Select
For s = 1 To 50
For i = 1 To 60
ActiveCell.Interior.Color = black
ActiveCell.Offset(0, 2).Select
Next i
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.EntireRow.Address)(1, 1).Select
Next s
Range("A1").Select
ActiveCell.Offset(1, 0).Select
For s = 1 To 50
ActiveCell.Offset(0, 1).Select
For i = 1 To 60
ActiveCell.Interior.Color = black
ActiveCell.Offset(0, 2).Select
Next i
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.EntireRow.Address)(1, 1).Select
Next s
End Sub
#6
Race Car
For those at home that have Excel but might not be as familiar with Visual Basic (VB) here is a step-by-step procedure to add DrWho's pasha code to an Excel spreadsheet.
First open Excel and press alt plus F11. This will open up the VB window seen below.
Second right click on "VBAProject (Book1)" and and mouse over "Insert" and then click on "Module" as seen below.
A module window to the right will now be active.
Now go and copy the code from post #5 and paste it in the Module window as seen below.
You can now close the VB window and go back to your spreadsheet. Once there, click on the "View" tab in the ribbon and select "View Macros" from the "Macros" button. If you don't see a Macros button you can alternatively press alt plus F8.
After selecting "View Macros" (or pressing alt plus F8) the Macro dialog box shown below will appear. You will see the "pasha" macro listed. Now just click "Run" and watch the magic happen!
First open Excel and press alt plus F11. This will open up the VB window seen below.
Second right click on "VBAProject (Book1)" and and mouse over "Insert" and then click on "Module" as seen below.
A module window to the right will now be active.
Now go and copy the code from post #5 and paste it in the Module window as seen below.
You can now close the VB window and go back to your spreadsheet. Once there, click on the "View" tab in the ribbon and select "View Macros" from the "Macros" button. If you don't see a Macros button you can alternatively press alt plus F8.
After selecting "View Macros" (or pressing alt plus F8) the Macro dialog box shown below will appear. You will see the "pasha" macro listed. Now just click "Run" and watch the magic happen!
The following 2 users liked this post by GT6ixer:
checkmate1996 (10-22-2019),
uraniummetallurgist (07-16-2019)
Trending Topics
#8
Rennlist Member
Yeah, it will. What's going on here is that the cells are being resized and, in some cases, recolored to black, leaving the white cells as they are. To get black/brown, select your entire spreadsheet and set the background color to the brown you want and then run the program.
#9
Thread Starter
Pro
GT 6ixer. thanks for the proofing. I was very disappointed that the paste function took out all there returns. I tried as best as I could to to get it right, but thought there would be a bug or two, there always is. I am sure some folks on the board will know more about printing on fabric. I personally want to etch this in leather like Paul used to do. Need to recover my septs in a year or so. I am, pretty sure you can size up the pattern in any thing you want my changing some of the variables, and get that to a printer.
#10
Kind of makes you wonder how they came up with something so complex mathematically in the 70's. Especially for a cloth pattern.
#11
Rennlist Member
Was great to see folks at the rendezvous this weekend. As noted., I saw the pasha pattern on the cars and was able to write an algorithm to generate the pattern. I used Visual basic and excel because it was just the most convent way to do things. Basically this process sets a size and a decay percentage. It will run several iterations and use the prior value to either decay or grow. the pattern runs along both the X and Y axis by moving the cell selection one row and one column. the last part is just for coloring the squares. Feel free to experiment and use this how you want. Hope folks find some use.
below is the code you can pop into excel and run visual basic (the copy and paste did not work very well). followed by a screenshot of the output
code -------
Sub pasha()
Dim Seed
Dim Ratio
'this is the size of the initial square. pattern is uneffeted by size, but does deteremin the size of the document.
Seed = 10
'this is the decay and growth ratio. can play around. found things less than 80% not all that great.
Ratio = 0.87
Range("A1").Select
'run 20 itterations. this can set the size of the overlall document
For s = 1 To 20
'this is the diminishing pattern this has to equal the growing pattern and visa versa. 'Found 12 works well. may not be the actual porsche pattern.
For i = 1 To 12
Selection.ColumnWidth = Seed Selection.RowHeight = Seed * 5.33 'the 5.33 ratio is just to overcome excel funkiness Makes the cell square
ActiveCell.Offset(1, 1).Select
'had to fine tune the pattern. you can play with the numbers. but has to equal the grow pattern and visa versa
Select Case i
Case Is < 2 Seed = Seed * Ratio
Case Is < 6 Seed = Seed * (Ratio / 0.99)
Case Is >= 6 Seed = Seed * (Ratio / 0.97)
End Select
Next i
'same as above, but this is the growth sequence
For i = 1 To 12
Selection.ColumnWidth = Seed Selection.RowHeight = Seed * 5.33
ActiveCell.Offset(1, 1).Select
Select Case i
Case Is < 2 Seed = Seed / (Ratio / 0.97)
Case Is < 6 Seed = Seed / (Ratio / 0.99)
Case Is >= 6 Seed = Seed / (Ratio)
End Select
Next i
Seed = 10 'have to reset seed if you change it
Next s
'this will color in the boxes
Range("A1").Select
For s = 1 To 50
For i = 1 To 60
ActiveCell.Interior.Color = black
ActiveCell.Offset(0, 2).Select
Next i
ActiveCell.Offset(2, 0).Select Range(ActiveCell.EntireRow.Address)(1, 1).Select
Next s
Range("A1").Select ActiveCell.Offset(1, 0).Select
For s = 1 To 50 ActiveCell.Offset(0, 1).Select
For i = 1 To 60 ActiveCell.Interior.Color = black
ActiveCell.Offset(0, 2).Select
Next i
ActiveCell.Offset(2, 0).Select Range(ActiveCell.EntireRow.Address)(1, 1).Select
Next s
End Sub
that is it.
Enjoy
this is the pasha pattern output from the code.
below is the code you can pop into excel and run visual basic (the copy and paste did not work very well). followed by a screenshot of the output
code -------
Sub pasha()
Dim Seed
Dim Ratio
'this is the size of the initial square. pattern is uneffeted by size, but does deteremin the size of the document.
Seed = 10
'this is the decay and growth ratio. can play around. found things less than 80% not all that great.
Ratio = 0.87
Range("A1").Select
'run 20 itterations. this can set the size of the overlall document
For s = 1 To 20
'this is the diminishing pattern this has to equal the growing pattern and visa versa. 'Found 12 works well. may not be the actual porsche pattern.
For i = 1 To 12
Selection.ColumnWidth = Seed Selection.RowHeight = Seed * 5.33 'the 5.33 ratio is just to overcome excel funkiness Makes the cell square
ActiveCell.Offset(1, 1).Select
'had to fine tune the pattern. you can play with the numbers. but has to equal the grow pattern and visa versa
Select Case i
Case Is < 2 Seed = Seed * Ratio
Case Is < 6 Seed = Seed * (Ratio / 0.99)
Case Is >= 6 Seed = Seed * (Ratio / 0.97)
End Select
Next i
'same as above, but this is the growth sequence
For i = 1 To 12
Selection.ColumnWidth = Seed Selection.RowHeight = Seed * 5.33
ActiveCell.Offset(1, 1).Select
Select Case i
Case Is < 2 Seed = Seed / (Ratio / 0.97)
Case Is < 6 Seed = Seed / (Ratio / 0.99)
Case Is >= 6 Seed = Seed / (Ratio)
End Select
Next i
Seed = 10 'have to reset seed if you change it
Next s
'this will color in the boxes
Range("A1").Select
For s = 1 To 50
For i = 1 To 60
ActiveCell.Interior.Color = black
ActiveCell.Offset(0, 2).Select
Next i
ActiveCell.Offset(2, 0).Select Range(ActiveCell.EntireRow.Address)(1, 1).Select
Next s
Range("A1").Select ActiveCell.Offset(1, 0).Select
For s = 1 To 50 ActiveCell.Offset(0, 1).Select
For i = 1 To 60 ActiveCell.Interior.Color = black
ActiveCell.Offset(0, 2).Select
Next i
ActiveCell.Offset(2, 0).Select Range(ActiveCell.EntireRow.Address)(1, 1).Select
Next s
End Sub
that is it.
Enjoy
this is the pasha pattern output from the code.
>
#12
Burning Brakes
I see................. SMART people
Now that this has been converted for those of less or depleted brain matter, we will see it's rebirth in everything.
#14
When you opened your computer to show me that as we were sitting at the table, I thought it was a good thing I didn't suffer from vertigo. Neat stuff man.