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

Username:   Password: 
 RegisterRegister   
 The best way to choose a colour-submission
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
LindenRulz




PostPosted: Tue Feb 20, 2007 4:56 pm   Post subject: The best way to choose a colour-submission

for i : 1 .. 256 %there are only 256 pre-determined colours
colour (i) % makes number the same colour as the colour
put i .. % puts number
put " " .. % makes a space
end for
Sponsor
Sponsor
Sponsor
sponsor
agnivohneb




PostPosted: Wed Feb 21, 2007 5:35 pm   Post subject: Re: The best way to choose a colour-submission

Actually there are only 255 colors. And this way may be better because it deals with the fact that by just adding a space you will eventually split the numbers between two lines.
Turing:
for i : 1 .. 255
    color (i)
    put count : 4 .% note the : 4. it keeps it even and lined up.
end for

You got the right idea tho.
ericfourfour




PostPosted: Wed Feb 21, 2007 6:23 pm   Post subject: Re: The best way to choose a colour-submission

agnivohneb @ Wed Feb 21, 2007 5:35 pm wrote:
Actually there are only 255 colors.
Turing:
for i : 1 .. 255
    color (i)
    put count : 4 .% note the : 4. it keeps it even and lined up.
end for

(Your code does not run by the way. Replace count with i.)


Believe it or not, there are 256 colours. I like it this way:

Turing:
for i : 0 .. 255
    colourback (i)
    put i : 5 ..
end for
fishtastic




PostPosted: Thu Feb 22, 2007 4:05 pm   Post subject: RE:The best way to choose a colour-submission

% try this with the code
for i : 1 .. 255
drawfillbox (round (maxx / 255) * i, 0, round
(maxx / 255) * i + 2, maxy, i)
end for
Abstraction




PostPosted: Thu Feb 22, 2007 5:32 pm   Post subject: Re: The best way to choose a colour-submission

Wouldn't the best reference be to simply use maxcolour instead of 255?
It would improve readability, as well as eliminating assumptions....although I guess the max number of colours remains constant
agnivohneb




PostPosted: Thu Feb 22, 2007 5:57 pm   Post subject: Re: The best way to choose a colour-submission

ericfourfour @ Wed Feb 21, 2007 6:23 pm wrote:
(Your code does not run by the way. Replace count with i.)


Believe it or not, there are 256 colours.


Sorry i forgot to put the i there and i also forgot about 0 being white.
little_guy9




PostPosted: Mon Apr 16, 2007 1:03 am   Post subject: Re: The best way to choose a colour-submission

To be honest, I prefer finding the right colour with a mouse, rather than looking through 255 numbers.

code:
View.Set ("graphics:max,max")
var x, y, b : int
var width : int := 4
for i : 0 .. 255
    for i2 : 1 .. width
        Draw.Line (i * width + i2, 0, i * width + i2, maxy - 16, i)
    end for
end for
loop
    Mouse.Where (x, y, b)
    x -= 1
    if x > 0 and x < maxx then
        locate (1, 1)
        put "colour #", floor (x / width)
        Draw.FillBox (120, maxy - 14, 150, maxy, floor (x / width))
    end if
    delay(30)
end loop
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: