
-----------------------------------
WhatDotColourMaster
Sun Dec 04, 2005 7:14 pm

Colour Codes On Turing
-----------------------------------

The falowing code was orgainl posted here:
http://www.compsci.ca/v2/viewtopic.php?t=8616#83043

The user in question has copyed the code in almost competation with giving litte to no cerited to the orgianl poster. Therefor the topic will be locked. For any questions or coments realting to the code pleas post them in the orgianl topic. 


I am new to this forum yet very experienced with Turing. Since I have wandered the entire site without finding a post on the colour codes on Turing i decieded to post my own.

Following below copy the code and paste in Turing application and RUN.


%Colour Code Program% 
%Displays all 255 colours% 
View.Set ("graphics:max;max, nobuttonbar,title:Colour Codes)") 

var x, y, RADIUS: int :=0 
RADIUS := 100 

%Auto-adjusts radius size to screen 
loop 
if RADIUS*RADIUS*2 > maxx or RADIUS*RADIUS*2 > maxy then 
    RADIUS -=1 
end if 
exit when RADIUS*RADIUS*2 < maxx or RADIUS*RADIUS*2 < maxy 
end loop 

x:=0 + RADIUS 
y:=maxy - RADIUS 

%Draws circles and places number 
for i:0..maxcolor 
color(i) 
Draw.FillOval (x, y, RADIUS, RADIUS, i) 
locatexy (x, y) 
color (black) 
put (i) 
if x = (maxx - RADIUS * 3) or  x > (maxx - RADIUS * 3) then 
y:= y - RADIUS*2 
x:=0 + RADIUS 
else 
x:=x + RADIUS*2 
end if 
end for


Hope this helps when verifying a certain colour...I am going to post some more of my programs soon.

O yeah and if any comments or problems message me.

Regards,
Miraj Patel

-----------------------------------
Tony
Sun Dec 04, 2005 7:30 pm


-----------------------------------
sorry, you haven't searched hard enough. The forums are littered with 
if RADIUS*RADIUS*2 > maxx or RADIUS*RADIUS*2 > maxy then
    RADIUS -=1

why not just find out what

(maxx/2)**0.5

is? :wink:

-----------------------------------
[Gandalf]
Sun Dec 04, 2005 7:49 pm


-----------------------------------
If you are so experienced with Turing, you should definately know to indent...

We now have 6 users with names relating to whatdotcolour...  Except I think 4 or so are the same person ;).

Anyways, here is an improved version of your program, try to figure out what I changed:
%Colour Code Program%
%Displays all 255 colours%

View.Set ("graphics:max;max,nobuttonbar,title:Colour Codes")
var x, y, RADIUS : int := 100
RADIUS := round ((maxx / 2) ** 0.5)
x := 0 + RADIUS
y := maxy - RADIUS

%Draws circles and places numbers
for i : 0 .. maxcolour
    Draw.FillOval (x, y, RADIUS, RADIUS, i)
    locatexy (x, y)
    put i
    if x = (maxx - RADIUS * 3) or x > (maxx - RADIUS * 3) then
        y -= RADIUS * 2
        x := RADIUS
    else
        x += RADIUS * 2
    end if
end for

Hope you contribute well to the forums :).

-----------------------------------
WhatDotColourMaster
Sun Dec 04, 2005 7:56 pm


-----------------------------------
Sorry about the indenting...
Its a bit messy.... but it works any other improvments needed is accepted and appreciated...

Funny....but I AM the real WHAT DOT COLOUR MASTER..MUAHAHAHA

Regards,
Miraj Patel

-----------------------------------
ZeroPaladn
Mon Dec 05, 2005 10:12 am


-----------------------------------
for i : 0 .. 255
colorback (i)
put "this is color #", i
end for

muahahahahaha!

-----------------------------------
[Gandalf]
Mon Dec 05, 2005 3:40 pm


-----------------------------------
muah... aha?

That doesn't help you since you can only see 40 or so of the colours, 7 of which are black...  You need to be able to scroll through the list, like so:
View.Set ("graphics:max;4120")
for i : 0 .. 255
    colourback (i)
    put i
end for
...as found in [url=http://www.compsci.ca/v2/viewtopic.php?p=85671#85671]Cervantes' post.

-----------------------------------
Jorbalax
Wed Dec 07, 2005 4:20 pm


-----------------------------------
[url=http://www.compsci.ca/v2/viewtopic.php?t=8616]Deja Vu (third post)

-----------------------------------
Tony
Wed Dec 07, 2005 4:27 pm


-----------------------------------
excellent job at recognizing your own code Jorbalax :) Thx for pointing that out.
