From layering shades of grey in different directions in "xor" mode many weird designs appear.
1-8 for preset designs
9 to make a random one
+- to speed up or slow down delay
Turing: |
View.Set ("graphics:500,500,nobuttonbar,title:Grey Scale Patterns,nocursor")
View.Set ("xor")
var corner : int := maxy + maxx
var dl : int := 1
var procs : array 1 .. 8 of procedure x ()
var pattern : array 1 .. 11 of procedure x ()
var randAmount : int
var answer : string (1)
var font : int := Font.New ("Arial:12")
Text.ColourBack (7)
Text.Colour (42)
%%% D=Direction then 8 point direction using numpad dark-light
proc D28
for y : 0 .. maxy
Draw.Line (0, y, maxx, y, RGB.AddColour (y / (maxy + 1), y / (maxy + 1), y / (maxy + 1)))
Time.Delay (dl )
end for
end D28
procs (1) := D28
proc D82
for decreasing y : maxy .. 0
Draw.Line (0, y, maxx, y, RGB.AddColour ((maxy - y ) / (maxy + 1), (maxy - y ) / (maxy + 1), (maxy - y ) / (maxy + 1)))
Time.Delay (dl )
end for
end D82
procs (2) := D82
proc D46
for x : 0 .. maxx
Draw.Line (x, 0, x, maxy, RGB.AddColour (x / (maxx + 1), x / (maxx + 1), x / (maxx + 1)))
Time.Delay (dl )
end for
end D46
procs (3) := D46
proc D64
for decreasing x : maxx .. 0
Draw.Line (x, 0, x, maxy, RGB.AddColour ((maxx - x ) / (maxx + 1), (maxx - x ) / (maxx + 1), (maxx - x ) / (maxx + 1)))
Time.Delay (dl )
end for
end D64
procs (4) := D64
proc D19
for c : 0 .. corner
Draw.Line (0, c, c, 0, RGB.AddColour (c / (corner + 1), c / (corner + 1), c / (corner + 1)))
Time.Delay (dl )
end for
end D19
procs (5) := D19
proc D91
for decreasing c : corner .. 0
Draw.Line (0, c, c, 0, RGB.AddColour ((corner - c ) / (corner + 1), (corner - c ) / (corner + 1), (corner - c ) / (corner + 1)))
Time.Delay (dl )
end for
end D91
procs (6) := D91
proc D37
for c : 0 .. corner
Draw.Line (maxy, c, corner - c - maxx, 0, RGB.AddColour (c / (corner + 1), c / (corner + 1), c / (corner + 1)))
Time.Delay (dl )
end for
end D37
procs (7) := D37
proc D73
for decreasing c : corner .. 0
Draw.Line (maxy, c, corner - c - maxx, 0, RGB.AddColour ((corner - c ) / (corner + 1), (corner - c ) / (corner + 1), (corner - c ) / (corner + 1)))
Time.Delay (dl )
end for
end D73
procs (8) := D73
proc TriLeft
cls
procs (3)
procs (6)
procs (8)
end TriLeft
pattern (1) := TriLeft
proc TriUp
cls
procs (1)
procs (6)
procs (8)
end TriUp
pattern (2) := TriUp
proc FanLeft
cls
procs (1)
procs (3)
procs (5)
procs (7)
end FanLeft
pattern (3) := FanLeft
proc FanRight
cls
procs (1)
procs (4)
procs (5)
procs (7)
end FanRight
pattern (4) := FanRight
proc CrossBlack
cls
procs (2)
procs (5)
procs (8)
procs (7)
procs (2)
procs (6)
end CrossBlack
pattern (5) := CrossBlack
proc CrossWhite
cls
procs (1)
procs (5)
procs (8)
procs (7)
procs (2)
procs (6)
end CrossWhite
pattern (6) := CrossWhite
proc TileBottom
cls
procs (2)
procs (3)
procs (4)
procs (5)
procs (6)
procs (7)
procs (8)
end TileBottom
pattern (7) := TileBottom
proc TileTop
cls
procs (1)
procs (3)
procs (4)
procs (5)
procs (6)
procs (7)
procs (8)
end TileTop
pattern (8) := TileTop
proc Random
cls
randAmount := Rand.Int (2, 8)
for i : 1 .. randAmount
procs (Rand.Int (1, 8))
end for
end Random
pattern (9) := Random
cls
loop
Font.Draw ("1-Triangle Left", 10, 180, font, 9)
Font.Draw ("2-Triangle Up", 10, 160, font, 9)
Font.Draw ("3-Fan Left", 10, 140, font, 9)
Font.Draw ("4-Fan Right", 10, 120, font, 9)
Font.Draw ("5-Cross Black", 10, 100, font, 9)
Font.Draw ("6-Cross White", 10, 80, font, 9)
Font.Draw ("7-Tile Bottom", 10, 60, font, 9)
Font.Draw ("8-Tile Top", 10, 40, font, 9)
Font.Draw ("9-Random", 10, 20, font, 9)
Font.Draw ("Delay= " + intstr (dl ), maxx - 70, 20, font, 9)
getch (answer )
if strintok (answer ) then
pattern (strint (answer ))
elsif answer = "+" then
if dl < 9 then
dl + = 1
cls
end if
elsif answer = "-" then
if dl > 0 then
dl - = 1
cls
end if
else
exit
end if
end loop
|
|