Computer Science Canada

Condensing Trouble

Author:  shakin cookie [ Fri Jan 04, 2008 5:47 pm ]
Post subject:  Condensing Trouble

Hey guys (and girls),

I was wondering if someone could suggest to me a way to condense my code. I still have many choices to go (e.g. paint colour, hub caps), and was wondering if anyone could help. It would be greatly appreciated.

Thanks.

Author:  HeavenAgain [ Fri Jan 04, 2008 6:17 pm ]
Post subject:  RE:Condensing Trouble

well, you can consider drawing those cars on paint or something, so intead of drawing on turing with so many lines, just pic.draw and ta da Very Happy
other than that... not much to improve o.o

Author:  shakin cookie [ Fri Jan 04, 2008 7:56 pm ]
Post subject:  RE:Condensing Trouble

What exactly is the command to import a picture on paint to turing?

Author:  HeavenAgain [ Fri Jan 04, 2008 8:05 pm ]
Post subject:  RE:Condensing Trouble

code:
      var myCar:int := Pic.FileNew ("car.bmp")
      Pic.Draw (myCar, maxx div 2, maxy div 2, picCopy)
      delay (5000)
      cls
      Pic.Free (myCar)
consider something like that?

Author:  shakin cookie [ Fri Jan 04, 2008 8:52 pm ]
Post subject:  RE:Condensing Trouble

alright, ill try that.

So a seperate variable for each picture... I'm guessing that they are not global.

Okay.

Author:  shakin cookie [ Fri Jan 04, 2008 8:59 pm ]
Post subject:  RE:Condensing Trouble

it says that the picture was not successfully created... suggestions to the problem?

Author:  Sean [ Fri Jan 04, 2008 9:13 pm ]
Post subject:  Re: Condensing Trouble

Either your version of turing does not support the picture, or you mispelled the name of the file.

Make sure to have extensions at end aswell.

Other then that, it could be an illegal interger value, 1000 is max it says sometimes.

Author:  shakin cookie [ Fri Jan 04, 2008 9:47 pm ]
Post subject:  RE:Condensing Trouble

ah...

silly me, i misspelled the file name...

o, and by the way, i have shortened my code by 80 lines as a result of all the helpful pointers. Thanks Heaven Again!

Author:  Gooie [ Sat Jan 05, 2008 12:41 am ]
Post subject:  Re: RE:Condensing Trouble

shakin cookie @ January 4th, 9:47 pm wrote:
ah...

silly me, i misspelled the file name...

o, and by the way, i have shortened my code by 80 lines as a result of all the helpful pointers. Thanks Heaven Again!


Good Work! BooHoo

Author:  shakin cookie [ Sat Jan 05, 2008 11:11 am ]
Post subject:  RE:Condensing Trouble

There is one issue:

i have three cars -9 models.

my ifs will look like this: if model=1 and colour=3 and hubCap=5 and bumper=2 then

is this inevitable? Will i have to have 108 possibilities?!? Someone please suggest something!

Author:  HeavenAgain [ Sat Jan 05, 2008 11:18 am ]
Post subject:  RE:Condensing Trouble

well, now is the time to do it like this
draw your differnt modles on paint or w/e
draw your hubCap on paint.... bumpers... etc draw them all seperatly, and then just go like
draw the modle(i)
draw the hubcap(j)
draw the bumper (k).... etcetc then i think turing can drawfill, and your job is done (i am assuming you are using array for your pictures, if that is possibile)

Author:  Saad [ Sat Jan 05, 2008 11:21 am ]
Post subject:  Re: Condensing Trouble

You could look into Records and Types, it would help in making the code better organised. Classes would be a better idea, but it's more advanced/

Author:  shakin cookie [ Sat Jan 05, 2008 11:35 am ]
Post subject:  RE:Condensing Trouble

but the problem is that i have to display the car as each choice is made

Lke this: Choose the model, show the model.
Choose the colour, show the model with the colour.
Choose the hub caps, show that woth the colour and the model.

Author:  HeavenAgain [ Sat Jan 05, 2008 11:47 am ]
Post subject:  RE:Condensing Trouble

yep, thats what i mean, you draw them separately, and then just put all those separate pieces together to make the new car.
ok for example, you have letters A B C and also a b c
you wish to make a i dunno, word out of it, and so you take 1 letter out of the 2 group, separately! you dont make out all the combination, correct? hope you get what i mean Smile

Author:  shakin cookie [ Sat Jan 05, 2008 5:29 pm ]
Post subject:  RE:Condensing Trouble

ok, and thanks for helping me. im going to donate bits to you.-)

Author:  shakin cookie [ Sat Jan 05, 2008 6:08 pm ]
Post subject:  RE:Condensing Trouble

ok, here is my next problem:

can i have two pictures at the same time?

here is my coding.

var bumper : int
put "enter a bumper type."
put "1. Straight"
put "2. Bumpy"
get bumper

if bumper = 1 then
var bumper1 : int := Pic.FileNew ("bumper1ISP.bmp")
var carc10 : int := Pic.FileNew ("hummer4ISP.bmp")
Pic.Draw (bumper1 and carc10, 10, -50, picCopy)
Pic.Free (bumper1 and carc10)
end if

it is supposed to draw a hummer and a bumper, but says as an error:

ILLEGAL PICTURE ID NUMBER '7000'. (7000 IS A LEGAL DIRECTORY STREAM).

what should i do?

Author:  Nick [ Sat Jan 05, 2008 6:24 pm ]
Post subject:  RE:Condensing Trouble

you can't draw two pictures in the same line, instead

code:
Pic.Draw(bumper1,10,-50,picCopy)
Pic.Draw(carc10,10,-50,picCopy

Author:  shakin cookie [ Sat Jan 05, 2008 7:29 pm ]
Post subject:  RE:Condensing Trouble

but then the one overlaps the other...

i would like them to appear at the same time...

Author:  Nick [ Sat Jan 05, 2008 7:31 pm ]
Post subject:  RE:Condensing Trouble

picMerge

Author:  Clayton [ Sat Jan 05, 2008 7:32 pm ]
Post subject:  RE:Condensing Trouble

You can't just magically meld two pictures together either...

Author:  shakin cookie [ Sat Jan 05, 2008 7:52 pm ]
Post subject:  RE:Condensing Trouble

what is the syntax for picMerge?

Author:  HeavenAgain [ Sat Jan 05, 2008 7:55 pm ]
Post subject:  RE:Condensing Trouble

replace picCopy with picMerge

Author:  shakin cookie [ Sat Jan 05, 2008 8:41 pm ]
Post subject:  RE:Condensing Trouble

okey-dokey

Author:  shakin cookie [ Sat Jan 05, 2008 8:42 pm ]
Post subject:  RE:Condensing Trouble

Heaven Again... You...Rule...

+bits for you! (All but one of mine-)


: