Computer Science Canada

RBG - Still Needs Work, But Begining

Author:  Sean [ Wed Dec 05, 2007 2:43 pm ]
Post subject:  RBG - Still Needs Work, But Begining

code:

for i : 1 .. 255
    for x : 1 .. 1
        for y : 1 .. 1
            put i
            drawfillbox ((x * 24), (y * 24), (x * 24) + 24, (y * 24) + 24, i)
            end for
    end for
end for


Still needs word, need to get a scroll bar so you can look at what was before. Still working, this is just the test one that I made.

~Sean

Author:  Clayton [ Wed Dec 05, 2007 3:34 pm ]
Post subject:  RE:RBG - Still Needs Work, But Begining

Ask yourself, what value will x and y have every time you run the program? I think you will see some extremely extraneous code there.

Author:  Sean [ Wed Dec 05, 2007 7:12 pm ]
Post subject:  Re: RBG - Still Needs Work, But Begining

Yes, I know they all equal 24, thats just perametor size, I could change, but will have to do tomorrow. The other values = 48.

code:

for i : 1 .. 255
    for x : 1 .. 1
        for y : 1 .. 1
            put i
            drawfillbox ( 24 ,  24 , 24  + 24,  24 + 24, i)
            end for
    end for
end for

Author:  Clayton [ Wed Dec 05, 2007 7:26 pm ]
Post subject:  RE:RBG - Still Needs Work, But Begining

How many times does:

code:

for x : 1 .. 1
   ...
end for


iterate for?

Author:  Carey [ Thu Dec 06, 2007 12:55 pm ]
Post subject:  Re: RBG - Still Needs Work, But Begining

Why don't you try:

code:
for i : 1 .. 255
    put i
    drawfillbox (24, 24, 48, 48, i)
end for

Author:  LaZ3R [ Thu Dec 06, 2007 2:54 pm ]
Post subject:  RE:RBG - Still Needs Work, But Begining

the x and y for loops are doing nothing. The number is constantly 24 and 48 respectively...

The only use in that would be if the value of x or y was NOT constant and changed each time through the loop.

code:
for i : 1 .. 255
    for x : 1 .. 2
        for y : 1 .. 2
            put i
            drawfillbox ((x * 24), (y * 24), (x * 24) + 24, (y * 24) + 24, i)
            end for
    end for
end for


Try that and see what your code will do.

Author:  Sean [ Thu Dec 06, 2007 3:21 pm ]
Post subject:  Re: RBG - Still Needs Work, But Begining

I was using a grid system that I created before, and then just added 1s. It creates 2 boxes, if it has 2.

Author:  Zampano [ Thu Dec 06, 2007 4:21 pm ]
Post subject:  Re: RBG - Still Needs Work, But Begining

Why not this instead?
code:
colour (0)
for c:1..255
    colourback(c)
    put " ",c," "..
end for

Author:  Sean [ Fri Dec 07, 2007 10:24 am ]
Post subject:  Re: RBG - Still Needs Work, But Begining

As I said, I made it quickly and would make a new one.

Still working on a better one, coming soon.


: