NEW Challenge!

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

NEW Challenge!

Post by avansc »

i missed these so i thought id start them up again.

challenge: design a function that takes a list of vertex's (how ever you choose) that form a convex polygon. then computes the surface of that polygon.

judging criteria:
1. who can make the function with the least lines.
2. who can make the function that calculates the area fastest.

all calculations have to be 98% accurate.
note: you can have two entries, one function for the fewest lines, and one function for the speed.

i will supply a file with a large convex polygon, and also a function for reading in the polygon.
however you are free to do it on your own.

thanks, and good luck!

here is a sample polygon at 10000 vertex's
http://www.mediafire.com/file/mzaiamjztnz/poly.bin

edit: polygon reader/parser

Code: Select all

void loadPoly(char *fileName)
{
    fstream binGet(fileName, ios::binary|ios::in);
    int num = 0;
    float data = 0;
    binGet.read((char*)&num, sizeof(int));
    printf("Number of vertex's = %d\n", num);

    for(int a = 0;a < num;a++)
    {
        binGet.read((char*)&data, sizeof(double));
        // set your vertex's X value here
        
        binGet.read((char*)&data, sizeof(double));
        // set your vertex's Y value here
    }
    binGet.close();
}
Last edited by avansc on Wed Mar 11, 2009 5:50 pm, edited 3 times in total.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: NEW Challenge!

Post by M_D_K »

AND NO POSTING ANSWERS IN THE THREAD PM THEM TO AVANSC
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: NEW Challenge!

Post by avansc »

well you can just post your line count and your numvertex's/second
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: NEW Challenge!

Post by M_D_K »

here is another poly.bin its the same as avansc's except the values are stored and meant to be read as doubles ;)

poly.bin
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: NEW Challenge!

Post by eatcomics »

Hey why don't you guys make a new board for challenges... Then we can have more contributions and they'll be easier to find in the forums... :mrgreen: that would be cool, then I might do one, I'm too lazy to find keep searching for the board when I reread the criteria... Ok well no I'm just too lazy to do the challenges but a new board would still be nice :lol:
Image
Post Reply