Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 252 253 [254] 255 256 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 907573 times)

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3795 on: January 30, 2013, 07:00:48 pm »

I'm going to buy this book,
http://www.amazon.com/dp/1556229119/
has lots of good reviews and says it covers verticies and matricies really well.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3796 on: February 01, 2013, 09:30:06 am »

Okay... What is a good way to calculate the limit as an expression approaches a value?

This here site says I need to find the limit as h approaches zero to figure out the directional derivative (basically a directional, 3D version of the slope).

Should I just sub in a small number and use that?
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3797 on: February 01, 2013, 12:42:09 pm »

Okay... What is a good way to calculate the limit as an expression approaches a value?

This here site says I need to find the limit as h approaches zero to figure out the directional derivative (basically a directional, 3D version of the slope).

Should I just sub in a small number and use that?

That should give you a decent estimate. The alternative is to do the calculus and figure out the exact derivative, but since it's implied you want to use this in a programming project, that would be very difficult.

armeggedonCounselor

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3798 on: February 02, 2013, 10:56:43 pm »

I also mentioned this in the Happy Thread, but I'm making a game in Java. It's an all text game at this point, and I've almost gotten character creation finished. There's a lot of stuff I have to write for character creation, and I already know I'm going to have to rewrite a lot, to add in things like Skills, Stat Modifiers, Traits, etc.. I may have to make other parts of the game into different classes rather than putting everything through in one class.

As I also mentioned in the Happy Thread, I won't be posting it on the forums due to it being "Gentleman's Special Interest," if you get my drift. Though I may post snippets without anything dirty if I hit a roadblock I can't get past on my own.
Logged
Quote from: Stargrasper
It's an incredibly useful technique that will crash the computer if you aren't careful with it.
That really describes any programming.

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3799 on: February 03, 2013, 03:59:01 am »

My sleep habits recently have been horrid, but I do my best programming at around this time (as I'm typing this sentence, it's 3:46 AM). I've always found it to be because of the sleepy brain.

In any case, someone I know has been using the Pomodoro Technique to force himself to program and now he finds it hard to code without having some form of ticking device nearby. Hold on, these two thoughts are actually related.

I've been conditioning myself to program while listening to certain types of music so I can hopefully get into a more normal sleep schedule. So far, I've had the most luck downloading 4x4=12 by Deadmau5 and setting it to repeat. It's long enough that listening to it over and over isn't a problem and it doesn't have distracting vocals. Hours can go by and I won't even notice. Just call me Норка.

Does anyone else program to music?
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3800 on: February 03, 2013, 04:55:02 am »

I like Beethoven's Große Fuge for some reason to listen to while programming. It's a whole 16 minutes, it isn't normal classical, and it's nice. xD
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3801 on: February 03, 2013, 09:06:47 am »

Rammstein tends to work well for me. Non-english vocals are less distracting.
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))

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3802 on: February 03, 2013, 11:12:30 am »

Code: [Select]
Uint32 rmask, gmask, bmask, amask;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
    rmask = 0xff000000;
    gmask = 0x00ff0000;
    bmask = 0x0000ff00;
    amask = 0x000000ff;
#else
    rmask = 0x000000ff;
    gmask = 0x0000ff00;
    bmask = 0x00ff0000;
    amask = 0xff000000;
#endif
if((Map = SDL_CreateRGBSurface(SDL_HWSURFACE, 800, 800, 32, rmask, gmask, bmask, amask)) == NULL) {
   return false;
   }
Code: [Select]
    if((Map = CSurface::OnLoad("./gfx/Map.bmp")) == NULL) {
        return false;
    }
Does someone know what is wrong with the upper one? They should be creating identical surfaces(cept for the contents of course), but for some reason displaying the upper one is way slower.

EDIT: Apparently they werent creating identical surfaces. Using SDL_ConvertSurface(Map) fixed it. Still dont understand why the created one would have a different format.
« Last Edit: February 03, 2013, 11:52:17 am by cerapa »
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3803 on: February 03, 2013, 02:37:52 pm »

I program to music, depends on what mood I'm in, but it's normally either classical or minimal/minimal house.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Dutchling

  • Bay Watcher
  • Ridin' with Biden
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3804 on: February 05, 2013, 06:29:22 am »

Fixed another problem by trying to copy everything over to here, and thereby noticing what was wrong.

Thanks, once again :P
Logged

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3805 on: February 05, 2013, 06:43:29 am »

Fixed another problem by trying to copy everything over to here, and thereby noticing what was wrong.

Thanks, once again :P
You too?

Seems the best way to debug something is to try to explain it to others.
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

Dutchling

  • Bay Watcher
  • Ridin' with Biden
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3806 on: February 05, 2013, 06:51:48 am »

I didn't actually fixed I see now... Just removed '()' after a function which made it not work at all >.<


My problem:
Code: [Select]
# classfile.py
class classone:
    def __init__(self):
        <yadayada>

    def one(self):
        if two(self): <== causes the error
            <yadayada>

    def two(self):
        <yadayada>
Code: [Select]
# main.py
import classfile

thing = classfile.classone()
if thing.one():
    <yadayada>
Gives me this error:
Quote from: ERROR
NameError: global name 'two' not defined

Halp D:
I defined it >.<
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3807 on: February 05, 2013, 06:59:49 am »

So what to do when you have a problem ... and it seems like it's a complicated one? >_< Just struggle with it on your own? D:
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3808 on: February 05, 2013, 07:27:26 am »

I didn't actually fixed I see now... Just removed '()' after a function which made it not work at all >.<


My problem:
Code: [Select]
# classfile.py
class classone:
    def __init__(self):
        <yadayada>

    def one(self):
        if two(self): <== causes the error
            <yadayada>

    def two(self):
        <yadayada>
Code: [Select]
# main.py
import classfile

thing = classfile.classone()
if thing.one():
    <yadayada>
Gives me this error:
Quote from: ERROR
NameError: global name 'two' not defined

Halp D:
I defined it >.<
EDIT2: Spouted bullshit, python doesnt give a shit.

Anyway, asked my brother about python. In function one you have to use self.two(self), rather than just two(self).
« Last Edit: February 05, 2013, 07:53:57 am by cerapa »
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3809 on: February 05, 2013, 08:22:16 am »

So what to do when you have a problem ... and it seems like it's a complicated one? >_< Just struggle with it on your own? D:
I think about it in the shower or when trying to sleep. Trick is to remember your solution until you're programming again :)
Also I sometimes try to explain it to my girlfriend so she'll understand, and sometimes the chosen metaphor hands me a new insight.
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))
Pages: 1 ... 252 253 [254] 255 256 ... 796