Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Poll

What programming topic would you want the next challenge to be about?  (It might be a good opportunity to focus on a subject you're not familiar with or to reinforce knowledge on one that you already know)

Control Flow
- 2 (2.2%)
Arrays, Strings, Pointers, and References
- 8 (9%)
Functions
- 4 (4.5%)
Basic object-oriented programming
- 30 (33.7%)
A bit more advanced OOP (Composition, Operator overloading, Inheritance, Virtual Functions)
- 18 (20.2%)
Templates
- 8 (9%)
Other (Explain)
- 4 (4.5%)
Working with files?  (Streams)
- 15 (16.9%)

Total Members Voted: 89


Pages: 1 ... 37 38 [39] 40 41 ... 78

Author Topic: Programming Challenges & Resources (#bay12prog) Initiative  (Read 96034 times)

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #570 on: December 13, 2010, 02:49:39 pm »

See http://en.wikipedia.org/wiki/Endianness for details about byte order, or look up something specific to Java or C.
Yeah, spoke to some guys at ##java, and they said it has to do with big and little indians and whatnot. Found a way to convert my numbers over to little-endian, and that fixed the problem.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #571 on: December 13, 2010, 03:44:01 pm »

Where I work there is a set of 5 using namespaces in a generic header
You poor, poor man.

OpenGL stuff is creeping along slowly. Still no idea what I'm doing wrong, but I decided less == more and started commenting out commands until I got to the bare minimum. Somehow gluPerspective and gluLookat are messing things up.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #573 on: December 13, 2010, 03:57:38 pm »

big and little indians
???
I thought it was funny, and with your permission, Virex, I shall use it myself.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

eerr

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #574 on: December 14, 2010, 02:31:37 am »

I don't know what the difference between a little indian and a big indian is  ;).
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #575 on: December 14, 2010, 06:06:31 pm »

Thank the Lord. Commenting and then slowly uncommenting rules has finally yielded me a green, textured and lighted landscape of my own doing.

Now to get it to "pop" according to level of detail based on camera-distance (It should already but it isn't).
Been looking into the marching-cubes algorithm but I'm not sure if it can fit my needs. Altering it is a bitch though (comment is from the guy I took it from):
Code: [Select]
//  I found this table in an example program someone wrote long ago.  It was probably generated by hand

GLint a2iTriangleConnectionTable[256][16] =
{
        {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
        {0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
        {0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
        {1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
        {1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
        {0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
        {9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
        {2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1},
        {3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
....
And that goes on for another 240ish lines. Yes, lookup tables are fast, but this is getting ridiculous.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #576 on: December 14, 2010, 06:25:40 pm »

That's why, if possible, you let the compiler do those kinds of tasks for you :P (don't know how viable that is for gcc. You may need a separate program to generate the tables)
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #577 on: December 14, 2010, 06:29:27 pm »

I don't know if that's possible in this case. It's some really specific stuff, that generates triangle-locations.

I'm not touching that #&%^ with a 10-foot pole. I'll just see how it goes without alteration, first.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

lordnincompoop

  • Bay Watcher
  • Allusionist
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #578 on: December 15, 2010, 07:41:48 am »

I have this function to read and tokenize input:

Code: [Select]
int IO()
{
    char *cIOline;
    cin.getline(cIOline, 80);
    char *cIOarray[10];
    int nFinger = 0;
    cIOarray[nFinger] = strtok(cIOline, "   ,.;:");
    do
    {
        cIOarray[++nFinger] = strtok(NULL, "  ,.;:");
    }while((cIOarray != NULL)||(nFinger == 8));
    return 0; //Fix.
}

Currently though, it's useless. It doesn't return the tokenized string array as the output. After this finishes, I want the output to be written to an identical charstar array in the function that called it. Here's the host function:

Code: [Select]
int testRoom()
{
    cout << "This is the test room! You find yourself surroinded by gray walls." << endl;
    cout << "There is a single, naked LIGHT bulb on the ceiling, and a CRATE on the floor next to you." << endl;
    cout << endl;
   
    char *cInputTokens[10];
    do
    {
        //Blu bluh find some way to make the charstar array here be the output of IO()
        if (cInputTokens[0] == "get")
           {
               if (cInputTokens[1] == "crate")
                   cout << "The crate is too heavy to lift." << endl;
               else if (cInputTokens[1] == "light")
                   cout << "Ouch! The light bulb is too hot to touch." << endl;
           };
    }while(0 == 0); //Make an exit condition.
}

Any idea how I can do this?  :-[
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #579 on: December 15, 2010, 08:32:54 am »

I don't know exactly what you're doing, but I'm guessing:
Code: [Select]
}while((cIOarray[nFinger] != NULL)&&(nFinger < 8));
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

lordnincompoop

  • Bay Watcher
  • Allusionist
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #580 on: December 15, 2010, 12:22:01 pm »

Okay, simply put: How do I pass a charstar array between functions?
Logged

Shades

  • Bay Watcher
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #581 on: December 15, 2010, 12:37:10 pm »

Okay, simply put: How do I pass a charstar array between functions?

Simply put I wouldn't. Assuming you are trying to pass an array of strings I'd pass a const boost::array<std::string> reference.

However to answer your question.

function(const char*[10]) as 10 is the size of the array of pointers should work fine.

Depending on your compiler you might also be able to use function(const char**) for a multidimensional array of chars, but as you know it's 10 there is no need for this.

Logged
Its like playing god with sentient legos. - They Got Leader
[Dwarf Fortress] plays like a dizzyingly complex hybrid of Dungeon Keeper and The Sims, if all your little people were manic-depressive alcoholics. - tv tropes
You don't use science to show that you're right, you use science to become right. - xkcd

ILikePie

  • Bay Watcher
  • Call me Ron
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #582 on: December 15, 2010, 02:02:28 pm »

Depending on your compiler
gcc is the only compiler. :-P Don't let the chaps at ##c fool you, intel doesn't really have it's own toolchain. It's all lies.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #583 on: December 15, 2010, 02:04:25 pm »

Depending on your compiler
gcc is the only compiler. :-P Don't let the chaps at ##c fool you, intel doesn't really have it's own toolchain. It's all lies.
Don't start this again... Please.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #584 on: December 15, 2010, 02:06:11 pm »

Depending on your OS, that statement might be true.
Logged
Eh?
Eh!
Pages: 1 ... 37 38 [39] 40 41 ... 78