Computer Science Canada Randomizing Varible! PLEASE HELP! |
Author: | TopBypass [ Tue Jan 22, 2008 7:59 pm ] |
Post subject: | Randomizing Varible! PLEASE HELP! |
I have made variables (a, b and c) and now i need to have them be picked but completely randomly and i am using Rand.Int but it wont work!! I really need help with this its for a final!! Thank you sooo much! |
Author: | michaelp [ Tue Jan 22, 2008 8:03 pm ] |
Post subject: | RE:Randomizing Varible! PLEASE HELP! |
What do you mean by "won't work?" Is is the same number every time, a, b, and c are all the same? Did you test the variables using "put a" or "put b" or "put c"? If you want them completely random, just use the arguments 1 and a really big number. |
Author: | Gooie [ Tue Jan 22, 2008 8:03 pm ] | ||
Post subject: | Re: Randomizing Varible! PLEASE HELP! | ||
Use something like this.
A case would be better though. |
Author: | TopBypass [ Tue Jan 22, 2008 8:24 pm ] | ||
Post subject: | Re: Randomizing Varible! PLEASE HELP! | ||
Still wont work, im getting an error. This is what i am trying to do: Write a program that plots points at A(300, 50), B(50, 500) and C(550, 500) - I finished this here is how i did it:
Now i need to: randomly choose either A, B or C (lets say it was A) and plot a new point, Q, which is half way between P and A. |
Author: | TopBypass [ Tue Jan 22, 2008 8:38 pm ] |
Post subject: | RE:Randomizing Varible! PLEASE HELP! |
Im still confused and i really do need this as quickly as possible so please help me! Thank you! |
Author: | TopBypass [ Tue Jan 22, 2008 8:49 pm ] |
Post subject: | RE:Randomizing Varible! PLEASE HELP! |
Alright i messed up something. Here is what i need from the start. I need to plot a point called A as a variable. A has to be a certain point BUT I HAVE NOOOO IDEA HOW TO DO THIS. I have tried making its value Draw.Dot (number, number, color) but that wont work either. |
Author: | Gooie [ Tue Jan 22, 2008 9:06 pm ] |
Post subject: | Re: Randomizing Varible! PLEASE HELP! |
Alright, well what data type are is A? |
Author: | TopBypass [ Tue Jan 22, 2008 9:16 pm ] |
Post subject: | RE:Randomizing Varible! PLEASE HELP! |
I defined it as an int |
Author: | Gooie [ Tue Jan 22, 2008 9:25 pm ] |
Post subject: | Re: Randomizing Varible! PLEASE HELP! |
Your first problem is that an Integer can't store two values (an ordered pair (x,y)). |
Author: | TopBypass [ Tue Jan 22, 2008 9:26 pm ] |
Post subject: | RE:Randomizing Varible! PLEASE HELP! |
Also do you know how to use putpixel? It says i am too use it but i cannot find it in turing. |
Author: | TopBypass [ Tue Jan 22, 2008 9:31 pm ] |
Post subject: | RE:Randomizing Varible! PLEASE HELP! |
What would i use than? Would a string work? |
Author: | Gooie [ Tue Jan 22, 2008 9:33 pm ] |
Post subject: | Re: Randomizing Varible! PLEASE HELP! |
I don't believe putpixel exists in Turing. I searched documentation, the internet, compsci, and I can declare a variable by that name. Are you sure your teacher isn't confused with another language? |
Author: | TopBypass [ Tue Jan 22, 2008 9:35 pm ] | ||
Post subject: | Re: Randomizing Varible! PLEASE HELP! | ||
Alright so far i can pick a random point and a random variable in which case it draws a dot in its location. Here is the code for that.
Now what i want to do is make it so when it picks a random point (A or B or C) it makes a dot in between P and the randomly choicen one. EDIT: It might be but its his exact type. "Pick a random point to start, call it P and plot it using putpixel" |
Author: | TopBypass [ Tue Jan 22, 2008 9:41 pm ] |
Post subject: | RE:Randomizing Varible! PLEASE HELP! |
Also the midpoint can be found by following this equation: |
Author: | TopBypass [ Tue Jan 22, 2008 9:44 pm ] |
Post subject: | RE:Randomizing Varible! PLEASE HELP! |
I think i have found one of my problems. I have giving int_p a specific Rand.Int point. Instead i need it to form anywhere on the page. Is this possible? EDIT: By the way you have been a great help! Just wanted to say that it is not going unnoticed and i am completely grateful ![]() |
Author: | HeavenAgain [ Tue Jan 22, 2008 9:58 pm ] | ||||
Post subject: | RE:Randomizing Varible! PLEASE HELP! | ||||
ahhhhhhhhh i know this, Sierpinski Triangle !!! anyways, i see that... you've been struggle for a quite long time...... and here is what i have for you you have to make a random dot everytime, so you have to call to the random variable everytime, so it becomes
now... thats one of the problem you have, 2nd, you have to get the mid point of the current X and Y, so then you have to store them into a variable of course
this is only for 1 case... and i think i better leave the rest to you... by the way, you wouldnt happen to go to dr norman bethune ci do you? ![]() |
Author: | TopBypass [ Tue Jan 22, 2008 10:03 pm ] |
Post subject: | RE:Randomizing Varible! PLEASE HELP! |
Alright i will try that! Ohh and no sorry i don't. EDIT: I've added you on msn if you don't mind. |
Author: | TopBypass [ Tue Jan 22, 2008 10:26 pm ] | ||
Post subject: | Re: Randomizing Varible! PLEASE HELP! | ||
Update, took another approach!
|
Author: | TopBypass [ Tue Jan 22, 2008 10:34 pm ] | ||
Post subject: | Re: Randomizing Varible! PLEASE HELP! | ||
Update
|
Author: | TopBypass [ Tue Jan 22, 2008 10:39 pm ] | ||
Post subject: | Re: Randomizing Varible! PLEASE HELP! | ||
Another update
|
Author: | TopBypass [ Tue Jan 22, 2008 10:45 pm ] |
Post subject: | RE:Randomizing Varible! PLEASE HELP! |
Fixed it..YAY!!! |
Author: | Clayton [ Tue Jan 22, 2008 10:47 pm ] |
Post subject: | RE:Randomizing Varible! PLEASE HELP! |
Um... wow. Quintuple post anyone? From now on, use the goddamn edit button. For the love of god. |
Author: | Euphoracle [ Wed Jan 23, 2008 1:13 am ] |
Post subject: | RE:Randomizing Varible! PLEASE HELP! |
Either someone wants to get into the Member's Lounge (there's nothing there; stop trying, etc), or they are really happy... or they use MSN too much and don't understand the purpose of a forum... or the edit button for that matter. I can keep ranting, so I'll stop here ![]() |