Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Colour Codes On Turing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
WhatDotColourMaster




PostPosted: Sun Dec 04, 2005 7:14 pm   Post subject: Colour Codes On Turing

[mod:7d214fc5ea]
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.
[/mod:7d214fc5ea]

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.

code:

%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
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Dec 04, 2005 7:30 pm   Post subject: (No subject)

sorry, you haven't searched hard enough. The forums are littered with stuff like this

and instead of doing a loop with
code:

if RADIUS*RADIUS*2 > maxx or RADIUS*RADIUS*2 > maxy then
    RADIUS -=1

why not just find out what
code:

(maxx/2)**0.5

is? Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
[Gandalf]




PostPosted: Sun Dec 04, 2005 7:49 pm   Post subject: (No subject)

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 Wink.

Anyways, here is an improved version of your program, try to figure out what I changed:
Turing:
%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 Smile.
WhatDotColourMaster




PostPosted: Sun Dec 04, 2005 7:56 pm   Post subject: (No subject)

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




PostPosted: Mon Dec 05, 2005 10:12 am   Post subject: (No subject)

code:
for i : 0 .. 255
colorback (i)
put "this is color #", i
end for


muahahahahaha!
[Gandalf]




PostPosted: Mon Dec 05, 2005 3:40 pm   Post subject: (No subject)

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:
code:
View.Set ("graphics:max;4120")
for i : 0 .. 255
    colourback (i)
    put i
end for

...as found in Cervantes' post.
Jorbalax




PostPosted: Wed Dec 07, 2005 4:20 pm   Post subject: (No subject)

Deja Vu (third post)
Tony




PostPosted: Wed Dec 07, 2005 4:27 pm   Post subject: (No subject)

excellent job at recognizing your own code Jorbalax Smile Thx for pointing that out.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: