Computer Science Canada [Tutorial] whatdotcolor |
Author: | Andy [ Sun Nov 30, 2003 10:48 pm ] | ||||
Post subject: | [Tutorial] whatdotcolor | ||||
ok peeps, i know you all've waited a long time for the infamous whatdotcolor man [that's me incase you're wondering] to share the secret behind my powers so here it is. what is whatdotcolor? whatdotcolor is the nicest, prettiest, smartest, and the most unefficent way to solve a problem. the general form for whatdotcolor is whatdotcolor(x,y), where x and y are integers. what the command does is check the color of a pixel.
the whatdotcolor in this case does return blue since pixel 2,2 is blue now you're probably going wtf do i need this? and i dont blame you, it took me a while to realize the real use of whatdotcolor too. whatdotcolor is usually used with drawfill since you cant "drawfill" text. take a moment to think about it. when asked to do a problem involving a maze, what is the first thing that comes to you? double for loop? WRONG recursion? WRONG again:snooty:, whats with you ppl... whatdotcolor!!! if we were to solve a maze, recursion would work, but its no fun. you'd have to pass along which way you came from, and go seperate paths each time. however, with whatdotcolr, you simply plot the text maze they give you draw it out using for loops, then find the path and use drawfill! and you instantly solve the maze. to help sink it in, i took the liberty to solve the J5 of last year of CCC using whatdotcolor... actualy i do these for fun with whatdotcolor cuz its cool the question gives you a floor plan using "I" s and "."s. I being a wall and . being a floor. the first three inputs gives you the number of tiles, and how many rows and colums of input there are. the questions asks you to put the maximum number of rooms you can cover filling in the smallest first and then outputting how much tiles you have left over. if you were to do this quesiton using recursion, its not that hard, but i being so enriched used whatdot color.
as you can see, its done very easily with whatdotcolor. when i have some time, i'll post a recursive solution too. well thats all you need to know for whatdotcolor. you too can become a whatdotcolor master, simply practice using it for program you do. trust me, every program can be done using whatdotcolor. if there isnt one, pm me, and i'll show you how to do it. except for ofcourse playing an mp3... now bring on the bits mods... lol |
Author: | Andy [ Sun Nov 30, 2003 10:51 pm ] |
Post subject: | |
ok mods, this thing took 3500 characters, 859 words, 4 pages on ms word font times new roman, and 30 min of my time! i better get something worthy... you know, a bit for every 50 characters would make me a very very happy [mod:7af3b9f15d] well that was a intresting way of doing that CCC question so i think you deserve some bits for aleast that + a random amout of bits [/mod:7af3b9f15d] |
Author: | rizzix [ Sun Nov 30, 2003 10:58 pm ] |
Post subject: | |
+1 bit jkz u got 10 on top of dan's |
Author: | AsianSensation [ Sun Nov 30, 2003 11:00 pm ] | ||
Post subject: | Re: [Tutorial] whatdotcolor | ||
dodge_tomahawk wrote: ...trust me, every program can be done using whatdotcolor. if there isnt one, pm me, and i'll show you how to do it. except for ofcourse playing an mp3...
sure you could
hehehe |
Author: | Andy [ Mon Dec 01, 2003 11:38 am ] |
Post subject: | |
ok azn, u got skillz, i give you that... so you can do any problem using whatdotcolor. if you find one that i cant, i'll give you all my bits... lol |
Author: | bugzpodder [ Mon Dec 01, 2003 5:12 pm ] |
Post subject: | |
Make a program that draws a circle whenever it encounters whatdotcolor, and make it output "I cant dont this whis whatdotcolor" |
Author: | Andy [ Mon Dec 01, 2003 6:29 pm ] |
Post subject: | |
bugzpodder wrote: "I cant dont this whis whatdotcolor"
umm that made no sense to me... what do you mean? if you'll tell me i'll use whatdotcolor to do it... |
Author: | Martin [ Tue Feb 24, 2004 3:44 pm ] |
Post subject: | |
Make a program that takes a line of text from a file and puts it below the line in reverse order, using whatdotcolour. ex. File.txt: Hello then you get this and file.txt becomes Hello olleH |
Author: | Cervantes [ Thu Feb 26, 2004 7:11 pm ] | ||
Post subject: | |||
not hard darkness
muhahaha whatdotcolour can be used for everything! |
Author: | Andy [ Thu Feb 26, 2004 8:03 pm ] | ||
Post subject: | |||
dude, that wuz lame
|
Author: | programer007 [ Sun Mar 07, 2004 4:38 pm ] |
Post subject: | |
how did you get the title: Whatdotcolor warrior??is it because you use it the most???? and taht program you posted.,... it wont wokr.. IO error for the files....cool deal tho.. i could use it in the future |
Author: | Cervantes [ Sun Mar 07, 2004 4:55 pm ] |
Post subject: | |
He got the whatdotcolour warrior title cuz he's a mod. your post is spam. Try to keep the spam to the spam section alone. I advise you to look at the rules Read em all, not just the part on spam. |
Author: | AsianSensation [ Sun Mar 07, 2004 6:54 pm ] |
Post subject: | |
programer007 wrote: how did you get the title: Whatdotcolor warrior??is it because you use it the most???? and taht program you posted.,... it wont wokr.. IO error for the files....cool deal tho.. i could use it in the future
he got the title for whatdotcolor warrior because dodge is obsessed with it, and tries to do every single question with whatdotcolor. As for the error, read up on File input and output, because the program he wrote deals with input and output from file. If you don't have a file with a specific name, of course you would get an error. |
Author: | xmen [ Mon Mar 29, 2004 10:07 pm ] | ||
Post subject: | |||
ok i got a problem u see i was using whatdotcolour for my screensaver, which happend to be few balls (or happy faces) flying and bouncing around the screen........i used a program from Cervantes n kinda modify.... anyway i also hav these 2 obstacles in the middle of screen......so the balls also bounce away once contact with those obstacles=>by using whatdotcolour PROBLEM IS, the whatdotcolour only works for the x-axis n y-axis for each balls, therefore only four contact testing points........SO, if the ball was to hit the obstacle on the upperleft,upperrite,lowerleft,loweright corner, the balls will go straight into the obstacles n weird things happen here is a copy of my program, anyone plzz take a look at it (let it run a while then u'll see what i mean)
anyone who knows how to fix this PLZZZZZZZZZZZ reply . Thankyou |
Author: | Cervantes [ Tue Mar 30, 2004 4:10 pm ] | ||
Post subject: | |||
terrible sorry dodge, but on this one I have to side with asian. in this type of situation, especially because you're ussing cirlces, don't use whatdotcolour. use Math.Distance (was it you that was asking what Math.Distance is? if so, just use the distance formula).
that's how you determine if there is a collision. I also have a few suggestions. Since the smallhappyfaces are bouncing off the big happyfaces (both of which are circles) you should use the same colision data as between the smallhappyfaces, except transfer 100% energy to the smallhappyfaces. also, drawing each part of your happyfaces each loop is not very efficient. I recommend drawing your happyfaces (both big and small) at the beginning of the program and then use Pic.New to grab the picture that you just drew and assign it a variable handle. |
Author: | xmen [ Tue Mar 30, 2004 4:15 pm ] |
Post subject: | |
wut if i do whatdotcolour for the 4 corners of the small happy faces?? i think that'll work with much less work too dont u think |
Author: | Cervantes [ Tue Mar 30, 2004 4:54 pm ] |
Post subject: | |
doing whatdotcolour on the 4 corners of the happyfaces is what's giving you the trouble isn't it? trust me, for circles, you want Math.Distance. |
Author: | Walker [ Fri Apr 02, 2004 11:35 pm ] |
Post subject: | |
Wuld is be possible using Math.Distacne + slop to check the pixel color of every pixle on the line between 2 points? Im trying to do something like this for my project. |
Author: | recneps [ Sat Apr 03, 2004 3:10 pm ] |
Post subject: | |
you could. but that isnt a questio nof can whatdotcolour do it, its how you would get the points on the line (whatdotcolour ALWAYS WORKS! It works for EVERYTHING! *sucks up to dodge*) |
Author: | Walker [ Sat Apr 03, 2004 9:32 pm ] |
Post subject: | |
By possible i ment will it lag the prgram up reeeeealy badly |
Author: | Andy [ Sat Apr 17, 2004 12:54 pm ] |
Post subject: | |
for whatdotcolor circle colission detection, what you do is you add on the value, then u run through all the circumference of ur circle, and check if its a color other than your original if isnt then subtract back the vaule |
Author: | Paul [ Sat Apr 17, 2004 1:04 pm ] |
Post subject: | |
how would you check thru the circumference of the circle?? waaa no one wants to explain to me. |
Author: | Andy [ Sat Apr 17, 2004 1:05 pm ] |
Post subject: | |
use the equation of the circle x^2+y^2=r^2 |
Author: | Paul [ Sat Apr 17, 2004 1:06 pm ] |
Post subject: | |
I don't really get that, is that pythagorean or something? can u gimme an example like just something to check all the points on the circumference of the circle. |
Author: | Raugrist [ Sat Apr 17, 2004 3:32 pm ] |
Post subject: | |
It is pythagorean kinda, if you think about it. Draw a circle on the origin. Now pick a point on the circumference and draw one line to the x-axis and another to the center of the circle. You know have a right triangle. |
Author: | Andy [ Fri Apr 23, 2004 10:21 am ] |
Post subject: | |
Paul Bian wrote: I don't really get that, is that pythagorean or something? can u gimme an example like just something to check all the points on the circumference of the circle.
what grade are you in? |
Author: | Paul [ Fri Apr 23, 2004 12:38 pm ] |
Post subject: | |
grade 10, I know pythagorean but I dunno how to use it in Turing. |
Author: | Delta [ Mon Apr 26, 2004 7:55 pm ] |
Post subject: | |
If you know it then you should be able to use it right? Cuz knowing it implies that you can use it right? the equations are pretty much exactly the same inside and outside of turing right?... hence your either lying or... your just not thinking hard enough |
Author: | Paul [ Mon Apr 26, 2004 8:02 pm ] |
Post subject: | |
Enough with the words just give me a goddamned example code. |
Author: | we64 [ Mon May 10, 2004 7:52 pm ] |
Post subject: | |
dodge_tomahawk wrote: use the equation of the circle x^2+y^2=r^2
that is not really the pythagorean formula, it is also the equation of the circle. Remember what you did in class? it is actually quite useful, for example, if you know the coordinate of x and it gives you y. let's say you radius is 5, so when (x = 5, y=0), (x=4 , y=3), (x=3, y=4), (x=2, y = sqrt (21)), (x=1, y= sqrt (24)), (x=0, y=5) it would be the same for the negative x and everything here is plus or minus. In this case, you want to check for every point of the circle, I don't think that is possible, because whatdotcolour (x,y) must be an integer. It would not be accurate. |
Author: | Cuzty [ Wed May 12, 2004 6:16 pm ] | ||
Post subject: | |||
Ok mister whatdotcolor master guy.. umm i was wondering if you can make the bullet kill the ball that comes down. And i apologize for the crappy code.. i'm not very good at this turing stuff so plz bear with me .
Oh, and if possible.. can you make the ball stop flickering? Thanks so much in advance, sir. |
Author: | Leny [ Wed Jun 02, 2004 9:17 am ] |
Post subject: | |
Ok so you can do anything with whatdotcolour so help me then how do i do what dot coulr in a circular pattern i.e. in my curling game i need to do the scoreing at the end by checking which rocks are closer to the center so if there are two blue rocks closer then the first red rock then the score becomes two blue or one red rock cloest to the center then a blue one closer then the next red one then the score is one red how would i do that? |
Author: | Tony [ Wed Jun 02, 2004 12:06 pm ] |
Post subject: | |
Leny : don't make things complicated and just use Math.Distance() |
Author: | Leny [ Wed Jun 02, 2004 2:35 pm ] |
Post subject: | |
our school computers can't do that i've tried it as well as others and it wont work for anyone including the teach who knows what she's doing |
Author: | Tony [ Wed Jun 02, 2004 5:09 pm ] | ||
Post subject: | |||
Leny : Math.Distance is a v4.0.5 feature. If you don't have the latest version of turing installed, you can write this function yourself
|
Author: | Leny [ Thu Jun 03, 2004 9:14 am ] |
Post subject: | |
so how would i use this math.distance thingger then? is there a tutorial on it? or maybe a basic program with it to look at |
Author: | Tony [ Thu Jun 03, 2004 11:53 am ] |
Post subject: | |
leny : there is a tutorial now |
Author: | Leny [ Thu Jun 03, 2004 5:31 pm ] |
Post subject: | |
thanks man if i have any trouble i'ma ask ya more about it but i should figure it out |
Author: | theanimator [ Wed Oct 26, 2005 8:11 pm ] |
Post subject: | |
this whatdotcolour makes no sense to me at all. Bare with me i am just a beginner. |
Author: | TokenHerbz [ Thu Oct 27, 2005 2:59 am ] | ||||||||||||||||||
Post subject: | |||||||||||||||||||
heres an example!
If you run that, you will see it stops only when x,y get hit... Now if we refer to the top diagram i shows, x1,y1 need to be in play aswell.! this way it will stop at the front. So we just modify this here...
run it... BUT, lets see, change y to this ...
Run that, now you will see that the x1,y1 position is missed, and its not a detection collition at all, so we have to think hard cause programming not easy. For effective collotioning/ useing whatdotcolor, you must cover all angles, i trust you learned a bit??? Well Gl with this! i ll let you try some stuff now EDIT:: So, we need to be creative (which i am not) and make a simple code what checks all of the obsticle, or at least.. the border of it. um somthing like??
Notice how slow it moves, its not efficiant, cause its checking the INSIDE of the rectangle, when we only need it to check the borders, so ill let you think about it, and work with that... Bye! EDIT::: Well again i wish to help you think on how to visualize getting a border.. if we think a 5*5 square.. its,
lets look at the *structure* of this NOTE::: The 1st numbers are x axis numbers, 2nd are the y axis.
So with that there, Try to code a patter which checks essentailly only these numbers.
Now, to make it a bit easier for you to get which variables are which..
Now you wouldn't want to enter in all the possible variables for a big square, so image if you could have a counter?? of course then, you could replayce all the numbers with i(for x axis) and j(for y axis) The code gets a little complex, and ill post it later if you dont get it i think i tend to make thinks more complex then they should :S |
Author: | BenLi [ Tue May 02, 2006 4:03 pm ] |
Post subject: | |
i have a question, why would you use whatdotcolor for things that can probably be done easier with other methods? its a total waste of time |
Author: | md [ Tue May 02, 2006 4:44 pm ] |
Post subject: | |
Because it works for very simple cases and doesn't require consious thought. Really using math to do collisions is only easy if you know the (admittedly basic) math and are familiar enough with things like records to keep track of everythign easily. |
Author: | HellblazerX [ Tue May 02, 2006 4:53 pm ] |
Post subject: | |
Whatdotcolor is not useless. In fact, it's quite useful in collision detection. Normally, you would use coordinates and calculate whether or not one object is within another, but with whatdotcolor, you can easily determine whether or not the objects have collided by checking the colors of a particular point. Also, if you use coordinates, collision detection becomes more and more difficult when more objects are placed on the field, and the objects themselves become more complicated in their shapes. With whatdotcolor, it doesn't get that much more difficult. |
Author: | Andy [ Fri May 05, 2006 9:18 pm ] |
Post subject: | |
cornflakes! you're such a blasphemer! how dare you say that about whatdotcolour? haha jk.. my obsession with whatdotcolour has nothing to do with "taking the easy way" but rather thinking abstractly. collision detection whatdotcolor is for noobs... unless you're talking about masking irregular shapes |
Author: | BenLi [ Thu May 11, 2006 3:07 pm ] |
Post subject: | |
Though for the example above, it'd be much better to use Math.Distance for the circle |
Author: | MysticVegeta [ Thu May 11, 2006 5:57 pm ] |
Post subject: | |
If you look at the Turing Reference (F10) and check out the Math.Distance index, you will see they used Math.Distance for the circles, you are right. |
Author: | evildaddy911 [ Thu Oct 13, 2011 2:49 pm ] | ||
Post subject: | RE:[Tutorial] whatdotcolor | ||
so i now know how to use whatdotcolor for every pixel in a square/ horizontal/vertical line.... but how do i use whatdotcolor for a diagonal line? drawline (0 , 100 , 100 , 0 , black) what is the code for this? EDIT: figured it out:
|
Author: | Hoshi [ Thu Dec 15, 2011 9:21 am ] |
Post subject: | RE:[Tutorial] whatdotcolor |
Is there a Tutorial on using RGB colours? or is that impossible to use on turing. say i wanted R=50 G=16 B=17 for a dot |
Author: | Insectoid [ Thu Dec 15, 2011 11:30 am ] |
Post subject: | RE:[Tutorial] whatdotcolor |
Yes, it's possible. There is a tutorial available in the Turing Walkthrough. Instead of asking for a tutorial next time, try using the website's built-in search. |