Page 3 of 21 FirstFirst 1234567813 ... LastLast
Results 31 to 45 of 307

Thread: Coder's Hang-out

  1. #31
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Quote Originally Posted by crusher
    Hmm... I see. Well, I'll see if I can make my own engine based on that "illustration". Thanks pkt-zer0.
    Check out ode.org, ODE is a free, open source physics SDK. I've been tampering with it a bit. Clearly not as good or advanced as Havok, but hey, it's free.

    Quote Originally Posted by kohlrak
    Ok... seriously... Why... do... we have to have pointers?
    Pointers are what make programming possible. Let's go down to the most basic level, the CPU. There's a thing called Code Pointer, that points to next operation to execute (in the form of hexadecimal code, of course). Every time an operation is executed, the code pointer is incremented. How else would you propose to execute code, that's not input at run-time?
    Pointers are the single most important thing that you need to understand, it makes things a lot easier (harder, if you don't know what you're doing). Pointers reference to data, they point to where the actual data is. What's good in that? Instead of copying 64MB of data right where it's needed, you just pass a 32bit pointer to its offset. You can access it either way.
    Functions are pointers themselves, actually (pointers to the piece of code that needs to be executed).
    Function pointers (not what I was talking about in the previous line, that was at assembly level) are useful for passing different methods that can be used with the same scheme. Take qsort, for example. You have to have a function that compares elements of an array, and you can pass that with a function pointer.
    Pointers to single values of arrays are not neccessary at all, just really fucking useful. Try splitting a string, without copying it.

  2. #32
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I don't know how to split a string with or without a pointer...

  3. #33
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    I'm reading the Bible.

    The programmer's bible, that is. "The C Programming Language" by Brian W. Kernighan
    and Dennis M. Ritchie.

    Hangout-ish enough?

    Anyway, I just recently finished an implementation of Huffman encoding. If anyone is interested I could re-write it with english variable names and comment it. If you're lazy to do a Google search on the encoding method, check the cool animation on this page, that is what the program does.

  4. #34
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    my version of encoding "VARIABLE HERE << 3;"

  5. #35
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Quote Originally Posted by kohlrak
    my version of encoding "VARIABLE HERE << 3;"
    The Huffman encoding is actually encoding meaning: compression. The same things get represented by other different things, that can be determined with an algorithm. In this case the code is much shorter than the average length of the message to be encoded, therefore it's compression.

  6. #36
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Maybe i just can't comprehend the idea of 1 thing being represented in a smaller manor...

  7. #37
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Simple. Let's say the input contains the bit 1 very rarely, and the 0 bit pretty often. You just then code the number of zero bits that are followed by a one. Instead of writing two hundred bits worth of zeros (about 24 bytes if I'm correct), you just write 200, which can be done in a single byte.
    There are a lot more compression algorithms, but I'm not going into details on the amazing number of those I know (2, actually. Oh wait, 3. Wooooooow.)

  8. #38
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Oh.. here's a puzzle for some one... 2 actually... I made a program to cheat on this one math problem (it's really stupid anyway, so i won't say what it is... anyway i got as far as small and large have to equal 5. anway... check out the source.)

    Download Links:
    Links are hidden from guests. Please register to be able to view these links. And guess what. It doesn't break out of the loop even when result==check. o.O Better yet... Add "windows.h" as an include file and get many errors saying chars after "double" are not allowed. Some one explain both to me... X'D

    ADDITION: Anyone know the pragma codes for visual C++ 6.0?
    Last edited by kohlrak; 21st-September-2005 at 20:42.

  9. #39
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 98 Times in 49 Posts
    EP Points
    205

    Default

    Borrowed 3D Game programming with C++ today from the library with accompany cd. Should be a good read, hopefully a bit of information as well.

  10. #40
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Quote Originally Posted by kohlrak
    And guess what. It doesn't break out of the loop even when result==check. o.O
    I don't really see the 'test' variable defined or even declared anywhere. It should've given you compile time errors.

  11. #41
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    oh yea, sorry about that, ignor it. I took out a few things which i used to test to see if i could figure out what went wrong. Apparently i forgot to clear "test" variable also. Thanks for pointing that out. But seriously, some one figure out what's wrong with that.

  12. #42
    Join Date
    Nov 2003
    Location
    USA
    Posts
    4,104
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    If you don't define test than it would never equal 2, so it's an infinte loop. Why not just have like while(1=1) or something?

    I don't know c++ so I can't really help, but...what was the math problem?

    Some linear combination of two numbers or something it looks.

  13. #43
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i keep screwing up when i type it... the main issue is... Woah... i just tried to do it again and it worked... weird... problem is the original source code put it in a loop which tested the values incrementing and decrementing values which would eventually make values that would match but it refused to exit the loop when the values matched which would have made the condition return false instead of true (because it was a!=b).

  14. #44
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 98 Times in 49 Posts
    EP Points
    205

    Default

    Hmm, I think I figured out what my problem was (with some help from a helpful friend on MSN )

    Example of Hello world program I was using

    #include <iostream.h>

    int main ()
    {
    cout << "Hello World!";
    return 0;
    }

    Correct one I was told to use

    #include <iostream>
    using namespace std;
    void main()
    {
    cout<<"Hello World\n";
    getchar();
    }

    Also making it a Console application as opposed to a Win32 Project helped

    Edit: bit ashamed of this after the level of skill I got for Java.

  15. #45
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Yeah, namespaces is one of the oddities that were added to C in C++. Supposedly makes your life easier in some cases, when fiddling around inside objects.
    There's no problem with using return 0, but I prefer using system("pause"); instead of getchar. I think you need to include <windows> for that.

Similar Threads

  1. Visit The Hang Out!
    By Georgyw5k in forum Free 4 All
    Replies: 5
    Last Post: 28th-November-2003, 05:18
  2. Do You Hang Up On Advertisement Callers?
    By ((KvN)) in forum Free 4 All
    Replies: 52
    Last Post: 21st-July-2003, 11:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About Us

We are the oldest retro gaming forum on the internet. The goal of our community is the complete preservation of all retro video games. Started in 2001 as EmuParadise Forums, our community has grown over the past 18 years into one of the biggest gaming platforms on the internet.

Social