The Turing Initiative
| Author |
Message |
Sean

|
Posted: Wed Apr 16, 2008 4:48 pm Post subject: RE:The Turing Initiative |
|
|
No, Mackie's Evolution Program. I think he is planning on doing that.
However, if I ever finish this program of his, it could be added onto your Initiative. |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Mackie

|
Posted: Fri Apr 18, 2008 1:01 am Post subject: RE:The Turing Initiative |
|
|
Just to show I am working:
| Turing: | var ColorPicker : nat1 :=
Window.Open ("offscreenonly,nobuttonbar,graphics:370;140,title:Color")
var font : int := Font.New ("arial:14")
var Red, Green, Blue : nat1 := 255
var mouseX, mouseY, mouseB : int
var buttonActive : boolean := false
function CalculateColor (startColor, endColor : int, ratio : real) : int
var startRed, startGreen, startBlue, endRed, endGreen, endBlue : real
RGB.GetColour (startColor, startRed, startGreen, startBlue )
RGB.GetColour (endColor, endRed, endGreen, endBlue )
var Red : real := startRed * ratio + endRed * (1 - ratio )
var Green : real := startGreen * ratio + endGreen * (1 - ratio )
var Blue : real := startBlue * ratio + endBlue * (1 - ratio )
RGB.SetColor (110, Red, Green, Blue )
result 110
end CalculateColor
procedure gradientBox (x1, y1, x2, y2, startColor, endColor : int)
for i : x1 .. x2 - 1
Draw.Line (i, y1, i, y2, CalculateColor (endColor, startColor,
(i - x1 ) / abs (x2 - x1 )))
end for
end gradientBox
function scroll (mouseX, mouseY, mouseB, x, y,
width, height, default, Color : int) : nat1
gradientBox (x, y, x + width, y + height, 112, 111)
Draw.Box (x, y, x + width, y + height, black)
Draw.FillOval (default + x, y + height div 2, 3, 8, Color )
Draw.Oval (default + x, y + height div 2, 3, 8, black)
if mouseX > x and mouseX < x + width and mouseY > y and
mouseY < y + height and mouseB = 1 then
result mouseX - x
end if
result default
end scroll
loop
Mouse.Where (mouseX, mouseY, mouseB )
% Color Display
Draw.FillBox (10, maxy - 100, 100, maxy - 10, 111)
Draw.Box (10, maxy - 100, 100, maxy - 10, black)
% Scrollbars
RGB.SetColor (111, 0, Green, Blue )
RGB.SetColor (112, 1, Green, Blue )
Red := scroll (mouseX, mouseY, mouseB,
110, 105, 255, 20, Red, brightred)
RGB.SetColor (111, Red, 0, Blue )
RGB.SetColor (112, Red, 1, Blue )
Green := scroll (mouseX, mouseY, mouseB,
110, 75, 255, 20, Green, brightgreen)
RGB.SetColor (111, Red, Green, 0)
RGB.SetColor (112, Red, Green, 1)
Blue := scroll (mouseX, mouseY, mouseB,
110, 45, 255, 20, Blue, brightblue)
RGB.SetColor (111, Red, Green, Blue )
%----------
% OK button
if buttonActive and mouseB = 0 then
buttonActive := false
exit
end if
RGB.SetColor (110, 0. 95, 0. 94, 0. 91)
if mouseX > 310 and mouseX < 368 and mouseY > 2 and mouseY < 28 then
if mouseB = 1 then
buttonActive := true
RGB.SetColor (110, 0. 87, 0. 87, 0. 81)
else
buttonActive := false
RGB.SetColor (110, 0. 95, 0. 94, 0. 84)
end if
end if
Draw.FillBox (310, 2, 368, 28, 110)
Draw.Box (310, 2, 368, 28, black)
Draw.Box (310, 2 + 1, 368 - 1, 28, black)
Draw.Text ("Ok", 327, 10, font, black)
%------------
View.Update
delay (5)
Draw.Cls
end loop
Window.Close (ColorPicker ) |
It's still crude, but pretty could for an hours work. Hopefully turning it into a function like the file browser. I'm currently optimizing, and adding new features, including being able to return colors. Might be useful, for color selection in the graphics programs. More tools to come... |
|
|
|
|
 |
Clayton

|
Posted: Fri Apr 18, 2008 7:38 am Post subject: RE:The Turing Initiative |
|
|
| Just a quick thing: Be consistent with your method/variable names. Some are starting with capital letters, and others aren't (in both cases). Stick to one style, (preferably lower case names) so that your codes is easier to read, and use. |
|
|
|
|
 |
StealthArcher

|
Posted: Fri Apr 18, 2008 9:49 am Post subject: Re: The Turing Initiative |
|
|
Currently my style somewhat follows Tony's:
variableName
COnstant(yes, first two letters Caps, weird, bet it's my own)
Procedure
FunctioN
ObjEct (two letters caps, beginning and middle)
When I do Program in C++ braces are on the same line as the declaration. |
|
|
|
|
 |
Mackie

|
Posted: Fri Apr 18, 2008 12:02 pm Post subject: RE:The Turing Initiative |
|
|
| I copyed from old code on this, so my naming conventions proabably are far off. I'll go back and change them now. |
|
|
|
|
 |
|
|