View previous topic :: View next topic |
Author |
Message |
kiddietron Site Admin
Joined: 06 Feb 2008 Posts: 797 Location: On Roblox
|
Posted: Mon May 26, 2008 7:43 pm Post subject: Brain Bogglers:Triangular Conundrum |
|
|
Description:
Given 6 integers, with 3 being valid points, return the area of the triangle.
Doki I got owned by Anaminus the third time today I think...
Example:
Input: (These are coordinates) (1,2) , (0,0) , (3,0)
Output: 3
This was told to me by Aeacus.
People who have solved it.
1. Aeacus
2. Anaminus
3.
4.
5. _________________ �Kiddietron
�Phailing at making a signature
Free Money here just sign up and click away.
http://bux.to/?r=kiddietron
Spam is for noobs.
Last edited by kiddietron on Tue May 27, 2008 12:02 am; edited 2 times in total |
|
Back to top |
|
|
Anaminus Beginner Poster
Joined: 08 Feb 2008 Posts: 17 Location: Location: Location: Location: Location: Location:
|
Posted: Mon May 26, 2008 9:59 pm Post subject: |
|
|
So that would be like area(xa,ya,xb,yb,xc,yc)?
Code: | function area(...)
p={...}
return math.abs((p[3]*p[6]-p[5]*p[4])+(p[1]*p[4]-p[3]*p[2])+(p[5]*p[2]-p[1]*p[6]))/2
end |
?-Anaminus-? _________________ ?-Anaminus-?
^^You're probably seeing this twice because I typed in my signature >_< |
|
Back to top |
|
|
kiddietron Site Admin
Joined: 06 Feb 2008 Posts: 797 Location: On Roblox
|
Posted: Mon May 26, 2008 10:04 pm Post subject: |
|
|
Nope nvm, I edited this. They are coordinates. _________________ �Kiddietron
�Phailing at making a signature
Free Money here just sign up and click away.
http://bux.to/?r=kiddietron
Spam is for noobs.
Last edited by kiddietron on Mon May 26, 2008 11:05 pm; edited 1 time in total |
|
Back to top |
|
|
Anaminus Beginner Poster
Joined: 08 Feb 2008 Posts: 17 Location: Location: Location: Location: Location: Location:
|
Posted: Mon May 26, 2008 10:55 pm Post subject: |
|
|
I'm not quite getting it...
In your example, does it run like this:
Quote: | 1,2,0,0,3,0
(1,2)
(0,0)
(3,0)
(Coordinates make a triangle, then the area can be found)
area = 3
Kiddietron here- Sorry to edit your post but use this one. But hearing from Aeacus, I hear you already have it done. 4 Cookies due to the winners in math.sqrt(-1) years. XD
|
Or this:
1,2,0,0,3,0
1,2,3
1*2*3 = 6
6/2 = 3 <-- area
Maybe another example would help.
?-Anaminus-? _________________ ?-Anaminus-?
^^You're probably seeing this twice because I typed in my signature >_< |
|
Back to top |
|
|
Aeacus Site Admin
Joined: 05 Feb 2008 Posts: 299 Location: Canada
|
Posted: Mon May 26, 2008 11:11 pm Post subject: |
|
|
Yep Anaminus, you got it I should have explained it a bit better though, this is the function I used;
Code: |
function getArea(x1,y1,x2,y2,x3,y3)
area = (((x2*y1-x1*y2)+(x3*y2-x2*y3)+(x1*y3-x3*y1))/2)
return area
end
|
_________________ If you say "Plz" because it is shorter than "Please," I will say "No" beacuse it is shorter than "Yes."
|
|
Back to top |
|
|
Anaminus Beginner Poster
Joined: 08 Feb 2008 Posts: 17 Location: Location: Location: Location: Location: Location:
|
Posted: Mon May 26, 2008 11:55 pm Post subject: |
|
|
Yay! Now I just have to wait for those kookies...
?-Anaminus-? _________________ ?-Anaminus-?
^^You're probably seeing this twice because I typed in my signature >_< |
|
Back to top |
|
|
Aeacus Site Admin
Joined: 05 Feb 2008 Posts: 299 Location: Canada
|
Posted: Tue May 27, 2008 12:08 am Post subject: |
|
|
Face it, they are never coming. Just accept the truth, it is the only thing you can do at this point. _________________ If you say "Plz" because it is shorter than "Please," I will say "No" beacuse it is shorter than "Yes."
|
|
Back to top |
|
|
Nasadaws Delta Corp Moderator
Joined: 27 Mar 2008 Posts: 484 Location: Under you bed Where else?
|
Posted: Tue May 27, 2008 5:47 am Post subject: |
|
|
Mind explain what a triangle thingy is? _________________ Nasadaws Attack Spammer: Hits 100 Damage with his Ban Hama.
Spammer: Flees.
I R NOE WELDIN ME BAN HAMAR. |
|
Back to top |
|
|
kiddietron Site Admin
Joined: 06 Feb 2008 Posts: 797 Location: On Roblox
|
Posted: Tue May 27, 2008 6:46 pm Post subject: |
|
|
Lol, don't worry it's just making a function to find the area of a triangle after receiving three coordinates. I just called it the Triangular Conundrum for fun to make it sound like a real brain boggler. _________________ �Kiddietron
�Phailing at making a signature
Free Money here just sign up and click away.
http://bux.to/?r=kiddietron
Spam is for noobs.
|
|
Back to top |
|
|
Nasadaws Delta Corp Moderator
Joined: 27 Mar 2008 Posts: 484 Location: Under you bed Where else?
|
Posted: Tue May 27, 2008 9:49 pm Post subject: |
|
|
Ah ok, Could you make the next challenge something I can do? I like this game =D. _________________ Nasadaws Attack Spammer: Hits 100 Damage with his Ban Hama.
Spammer: Flees.
I R NOE WELDIN ME BAN HAMAR. |
|
Back to top |
|
|
|