Page 7 of 21 FirstFirst ... 2345678910111217 ... LastLast
Results 91 to 105 of 307

Thread: Coder's Hang-out

  1. #91
    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
    Makes a big difference actually. Singing halves the number of positives intergers.
    O RLY?

    If you have no need for negative integers, then use unsigned integers. Anyway, nothing stops you from interpreting numbers the way you want, and in C++, you can even redefine the operators.

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

    Default

    Actually, my table (i'm learning more and more about binary usign win calc, which seems to hold a biiiiiiit more logic than what you said) says you forgot somthing...

    Binary:
    1 = 1
    2 = 10
    3 = 11
    4 = 100
    5 = 101
    6 = 110
    7 = 111
    8 = 1000
    9 = 1001
    10 = 1010
    11 = 1011
    12 = 1100
    13 = 1101
    14 = 1110
    15 = 1111
    16 = 10000
    17 = 10001
    18 = 10010
    19 = 10011
    20 = 10100
    21 = 10101
    22 = 10110
    23 = 10111
    24 = 11000
    25 = 11001
    26 = 11010
    27 = 11011
    28 = 11100
    29 = 11101
    30 = 11110
    31 = 11111
    32 = 100000
    Bit: (5/8 byte format with signing)
    0 = 00000
    1 = 00001
    2 = 00010
    3 = 00011
    4 = 00100
    5 = 00101
    6 = 00110
    7 = 00111
    8 = 01000
    9 = 01001
    10 = 01010
    11 = 01011
    12 = 01100
    13 = 01101
    14 = 01110
    15 = 01111
    -1 = 11111
    -2 = 11110
    -3 = 11101
    -4 = 11100
    -5 = 11011
    -6 = 11010
    -7 = 11001
    -8 = 11000
    -9 = 10111
    -10 = 10110
    -11 = 10101
    -12 = 10100
    -13 = 10011
    -14 = 10010
    -15 = 10001
    -16 = 10000

    As you can see, the negatives must have 1 higher value than the positives, which means you xor everything then -1 (which is what you forgot), otherwise, you would (in the above standard) have 11111 would be -0 rather than -1. You cannot possibly have a -0.

  3. #93
    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
    Actually, my table (i'm learning more and more about binary usign win calc, which seems to hold a biiiiiiit more logic than what you said) says you forgot somthing...
    As you can see, the negatives must have 1 higher value than the positives, which means you xor everything then -1 (which is what you forgot), otherwise, you would (in the above standard) have 11111 would be -0 rather than -1. You cannot possibly have a -0.
    Hmm... you could start by reading what I posted above.
    Two's complement is the most used representation, and I quote "you get the two's complement representation of a number by adding one to the one's complement form". The one's complement form is simply the negative numbers being inverted, and sticking a sign bit to the beginning.
    And I managed to 'guess' the value of -3, so also you could've compared that.
    And yeah, there is a standard where you DON'T add one to the negative forms, but the one you're looking for was mentioned directly below that in my post.

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

    Default

    I missed that part. lol

    But a standard like that would have a -0, what the heck?

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

    Default

    Well, yeah, it would. And it does. Still, it's just like any other number representation.
    Still, you could abuse that quirk, and use that value for error checking purposes. Or something.
    And, even though it's some sort of standard, noone's telling you what numeric representation you have to use. I mean, when you deal with any kind of computer, you don't care how it adds 2 and 3 together, as long as the result is 5. What matters is that it should be as fast as possible.

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

    Default

    But is that really in our hands? Do we really have the ability to tell the computer to read binary in our own way? Waaaaaaaaaaait... we do.... *gets out screw driver*

  7. #97
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 96 Times in 48 Posts
    EP Points
    195

    Default

    I just had a brainwave, this Java piece which has been fucking me over for the last few weeks, I have only been able to figure out how to add an Entry (this basically boiled down to input prompts at the Add entry button which appended text to the text field. I just need to figure out how to "browse" as it were, for every entry, that I could select that entry (though thinking about it, I could put it as a JTextlist and simply put the browser on one line and press the delete button to do that, but I have no idea how to do that lol) but if I can delete that way then editing will not be a problem, as it will simply replace the first item (deleting then Adding) sos if this went waaaaaaaaay over your head `

  8. #98
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 96 Times in 48 Posts
    EP Points
    195

    Default

    hmm, does anyone know how to do a command that does something with a selected line in a JTextList?

  9. #99
    Join Date
    Dec 2004
    Location
    Fantasy Dreamland
    Posts
    1,655
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default

    Dude pkt-zer0 thanks for the idea with keybuffer!!!
    It seems that disabling local key repeat callbacks really
    improves engine speed. (like a nice kick in the ass )
    And comparing the speed of calls to Drawing function I can
    tell that keyboard callbacks are really CPU time consuming...

    For this you deserve a big one...but since I don't have
    anything to offer I'll present you with some rep.

    ^good rep of course
    (shit!! "You must spread some rep around before giving it to pkt-zer0 again"
    sorry dude but I'll remember that...)


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

    Default

    A few oddities about glut, and why it sucks in some cases.
    The glutTimerFunc does not work at consistent speeds on a variable clock freqeuncy processor. A friend of mine found this out when he experienced random speeds with a constant delay. Which is not a good thing, for sure.
    Callbacks are slow because they allow for event-controlled programs. If you'd simply use an update loop every 15 milliseconds or so, you could still do the same, but event-controlling gives instantenous response, not just almost-instantenous. And it's easier to use.
    BTW, you can change those callback functions during runtime as well, so that's an easy way of handling totally different types of input/display. (Like the game itself, and its menu system). Handy.

  11. #101
    Join Date
    Dec 2004
    Location
    Fantasy Dreamland
    Posts
    1,655
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default

    Quote Originally Posted by pkt-zer0
    A few oddities about glut, and why it sucks in some cases.
    The glutTimerFunc does not work at consistent speeds on a variable clock freqeuncy processor. A friend of mine found this out when he experienced random speeds with a constant delay. Which is not a good thing, for sure.
    I don't mind that as long as I don't use it in actual real time animations, wich
    I know I should if I plan to get my programs CPU friendly. But this error
    may be really troubling, that's for sure...

    Quote Originally Posted by pkt-zer0
    Callbacks are slow because they allow for event-controlled programs. If you'd simply use an update loop every 15 milliseconds or so, you could still do the same, but event-controlling gives instantenous response, not just almost-instantenous. And it's easier to use.
    Well reading some game programming tutorials there is always mentioned
    that Keyboard callbacks are a big pain in the ass for game speed but
    sometimes keyboard buffer fails too elspecially if you for example press
    'a' then press 'shift' and then release 'a'. the result will be that
    glutKeyboardFunc inform that 'a' key was pressed but it wasn't released
    ever. That needed a little modification which I've made by releasing both
    keys at glutKeyboardUpFunc.

    Quote Originally Posted by pkt-zer0
    BTW, you can change those callback functions during runtime as well, so that's an easy way of handling totally different types of input/display. (Like the game itself, and its menu system). Handy.
    Yeah I know and I used those in my program cause global disable of
    callbacks didn't work for some strange reason on my PC...


  12. #102
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 96 Times in 48 Posts
    EP Points
    195

    Default

    Hmm, I'm having a spot of trouble, its a simple thing I know, but in c, I did a thing where you press a number to select an option with the getchar() option, for example

    Download Links:
    Links are hidden from guests. Please register to be able to view these links. Its probably a simple thing but I just don't know where I am going wrong

    edit: also, I want to try an escape option such as if something is entered that isn't an option ie. 1,2 or 3. that it repeats the getchar, I was wondering what would be a simple way to go back to the prompt.?

    Edit 2: actually I was wonder as well I have a program, that closes down once it completes it's task, I was wondering how to change the settings back to normal and repeat it (i = 0 and goes to 8, but I want it to go back to 0 again to repeat it, if anyone gets what I mean )
    Last edited by Stark; 22nd-December-2005 at 17:53.

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

    Default

    For the first part:

    getchar returns the value that was read from the standard input, which is the keyboard, by default. So you'll have to do something like this:
    Download Links:
    Links are hidden from guests. Please register to be able to view these links. I don't get what you mean by the second part, but if it's reinitalizing and restarting a program, just write a function that resets all values to their defaults, and run it whenever you go back to the start of the program.

  14. #104
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 96 Times in 48 Posts
    EP Points
    195

    Default

    Quote Originally Posted by pkt-zer0
    For the first part:

    getchar returns the value that was read from the standard input, which is the keyboard, by default. So you'll have to do something like this:
    Download Links:
    Links are hidden from guests. Please register to be able to view these links. I don't get what you mean by the second part, but if it's reinitalizing and restarting a program, just write a function that resets all values to their defaults, and run it whenever you go back to the start of the program.
    oh, I was going to use getchar just to get around the scanf. Hmm, I'll just play around with the scanf then. God I feel like I did when I was doing Java last year

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

    Default

    Getchar would be better in case of a menu, since it's not buffered, by default. With scanf that would require flushing the buffer on erroneous input. Your call, anyway, but unless you need to read more than one character at a time (like, inputting a name, a date, or something similar), use getchar.

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