zak
11-06-2010, 17:52
Hi
in the message "prime numbers spiral" the dot walking spirally by a fixed steps, but what if every walk represent something .
from the old history people assign values to letters of alphabet such as A=1,...,Z=26. so the numerologist(a specialist in a pseudoscience called numerology) can add the values of the characters of your name ,and making some prediction for you, then you give him some money. okay here is a computarized version, in which the dot advanced in 2D space by a value of a character, and proceed spirally to the end of the text.
the subject called random walk http://en.wikipedia.org/wiki/Random_walk but here the walk rather than random it is defined by the values of the letters of a word or sentence or a whole file.
here is how the program produce "good evening" if the alpabet values from A to Z = 1 to 26
https://sites.google.com/site/zak31415/Home/numerology.PNG
if you change the value for G=20 instead of the original 7 the image like this:
https://sites.google.com/site/zak31415/Home/numerology2.PNG
it can be used for ciphers, but there is a problem of the overlapping lines
the plot for a big text can crawl outside the screen, you may construct a poet to make a closed figure or an interesting shape.
some comments:
1:you can make the program to read text from file use:
myStr = FILE_Load("test.txt")
2:the figure in the program magnified by 4, if you want more text set magnify = 1
3:it is not absolute to run the plot in certain clockwise direction, but you can define your own right,left,up,down direction for every char.
4:i have used remove$ to remove spaces and some possible chars from the string, but we can use regular expressions for a more efficient way.
other suggestions are welcome.
regards
Uses "UI"
Uses "FILE"
Dim myStr, char As String
Dim i,j,colrR,colrG,colrB As Long
Dim x, y, dots, turn, magnify, charValue As Long
magnify = 4
'read a whole file to a string variable:
'myStr = FILE_Load("test.txt")
myStr = "good evening"
myStr = Remove$(myStr, Any " "+","+"."+"-"+":"+"*"+"/")
myStr = Ucase$(myStr)
Dim lettersValue(26) As Long
'assign any values to letters, it is here 1,2,3,...
'but you can choose 3,1,4,1,5,....
Array Assign lettersValue(1)=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26
Dim hWin As DWord = Canvas_Window("pictorial numerology", 1, 1, 800, 600 )
Canvas_Attach(hWin, 0, %TRUE) ' <- double buffer
Dim t1, t2 As Quad
hiresTimer_Init
t1 = hiresTimer_Get
Canvas_Clear(%BLACK)
x=400:y=300
turn=0
'ploting point number 1 as a small yellow circle:
Canvas_Ellipse(x-3, y-3, x+3, y+3, Rgb(255, 255, 0),Rgb(255, 255, 0))
Canvas_Redraw
Plotting() 'call plotting routine
'the last point in the plot:
Canvas_Ellipse(x-3, y-3, x+3, y+3, Rgb(255, 255, 0),Rgb(255, 255, 0))
Canvas_Redraw
t2 = HiResTimer_Get
MsgBox hWin, "Time taken:"+Format$((t2-t1)/1000000, "#.000")+" second --" + dots + " dots drawn", %MB_APPLMODAL
Canvas_Window end
Sub Plotting()
'plotting the first point
Canvas_Line( (x, y), (x, y) , Rgb(255, 255, 255) )
For i=1 To Len(myStr)
charValue = lettersValue(Asc(Mid$(myStr, i, 1))-64)
turn = turn + 1
If turn = 5 Then turn = 1
colrR = 0 : colrG = 255 : colrB = 0
Select Case turn
Case 1
x = x + charValue * magnify
Case 2
y = y - charValue * magnify
Case 3
x = x - charValue * magnify
Case 4
y = y + charValue * magnify
End Select
Canvas_Line( Step , (x, y) , Rgb(colrR, colrG, colrB) )
dots = dots + 1
Canvas_Redraw
Next j
END SUB
in the message "prime numbers spiral" the dot walking spirally by a fixed steps, but what if every walk represent something .
from the old history people assign values to letters of alphabet such as A=1,...,Z=26. so the numerologist(a specialist in a pseudoscience called numerology) can add the values of the characters of your name ,and making some prediction for you, then you give him some money. okay here is a computarized version, in which the dot advanced in 2D space by a value of a character, and proceed spirally to the end of the text.
the subject called random walk http://en.wikipedia.org/wiki/Random_walk but here the walk rather than random it is defined by the values of the letters of a word or sentence or a whole file.
here is how the program produce "good evening" if the alpabet values from A to Z = 1 to 26
https://sites.google.com/site/zak31415/Home/numerology.PNG
if you change the value for G=20 instead of the original 7 the image like this:
https://sites.google.com/site/zak31415/Home/numerology2.PNG
it can be used for ciphers, but there is a problem of the overlapping lines
the plot for a big text can crawl outside the screen, you may construct a poet to make a closed figure or an interesting shape.
some comments:
1:you can make the program to read text from file use:
myStr = FILE_Load("test.txt")
2:the figure in the program magnified by 4, if you want more text set magnify = 1
3:it is not absolute to run the plot in certain clockwise direction, but you can define your own right,left,up,down direction for every char.
4:i have used remove$ to remove spaces and some possible chars from the string, but we can use regular expressions for a more efficient way.
other suggestions are welcome.
regards
Uses "UI"
Uses "FILE"
Dim myStr, char As String
Dim i,j,colrR,colrG,colrB As Long
Dim x, y, dots, turn, magnify, charValue As Long
magnify = 4
'read a whole file to a string variable:
'myStr = FILE_Load("test.txt")
myStr = "good evening"
myStr = Remove$(myStr, Any " "+","+"."+"-"+":"+"*"+"/")
myStr = Ucase$(myStr)
Dim lettersValue(26) As Long
'assign any values to letters, it is here 1,2,3,...
'but you can choose 3,1,4,1,5,....
Array Assign lettersValue(1)=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26
Dim hWin As DWord = Canvas_Window("pictorial numerology", 1, 1, 800, 600 )
Canvas_Attach(hWin, 0, %TRUE) ' <- double buffer
Dim t1, t2 As Quad
hiresTimer_Init
t1 = hiresTimer_Get
Canvas_Clear(%BLACK)
x=400:y=300
turn=0
'ploting point number 1 as a small yellow circle:
Canvas_Ellipse(x-3, y-3, x+3, y+3, Rgb(255, 255, 0),Rgb(255, 255, 0))
Canvas_Redraw
Plotting() 'call plotting routine
'the last point in the plot:
Canvas_Ellipse(x-3, y-3, x+3, y+3, Rgb(255, 255, 0),Rgb(255, 255, 0))
Canvas_Redraw
t2 = HiResTimer_Get
MsgBox hWin, "Time taken:"+Format$((t2-t1)/1000000, "#.000")+" second --" + dots + " dots drawn", %MB_APPLMODAL
Canvas_Window end
Sub Plotting()
'plotting the first point
Canvas_Line( (x, y), (x, y) , Rgb(255, 255, 255) )
For i=1 To Len(myStr)
charValue = lettersValue(Asc(Mid$(myStr, i, 1))-64)
turn = turn + 1
If turn = 5 Then turn = 1
colrR = 0 : colrG = 255 : colrB = 0
Select Case turn
Case 1
x = x + charValue * magnify
Case 2
y = y - charValue * magnify
Case 3
x = x - charValue * magnify
Case 4
y = y + charValue * magnify
End Select
Canvas_Line( Step , (x, y) , Rgb(colrR, colrG, colrB) )
dots = dots + 1
Canvas_Redraw
Next j
END SUB