Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 17 18 [19] 20 21 ... 796

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

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #270 on: January 09, 2012, 12:59:51 pm »

If everyone's already spamming their programming tutorials here, I might just add a Perl tutorial for those who can't get along with PreD (see sig). Anyone interested?
Logged

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #271 on: January 09, 2012, 01:41:47 pm »

If everyone's already spamming their programming tutorials here, I might just add a Perl tutorial for those who can't get along with PreD (see sig). Anyone interested?

I wouldn't call it spamming our tutorials here...but if you want to write something, I vote go for it!
Logged

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #272 on: January 09, 2012, 02:02:13 pm »

If everyone's already spamming their programming tutorials here, I might just add a Perl tutorial for those who can't get along with PreD (see sig). Anyone interested?

I wouldn't call it spamming our tutorials here...but if you want to write something, I vote go for it!

I wouldn't either, if it didn't kinda fit. We're now having four concurrent tutorials to four different languages in the same thread. This can get very confusing.
Logged

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #273 on: January 09, 2012, 02:07:45 pm »

That's because Mego hasn't starting linking them in the OP yet like he said he would roughly ten pages ago.  I'd also like to see the major, non-tutorial, posts where we either describe or discuss major concepts linked to as well.

In addition to the tutorials, we also have about four concurrent discussions unrelated to the tutorials.  It's an awesome thread, isn't it?
Logged

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #274 on: January 09, 2012, 03:30:58 pm »

Let's talk about thread programming next.
Logged

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #275 on: January 09, 2012, 03:33:41 pm »

Let's talk about thread programming next.

Quit trolling about how screwy this thread is getting...oh wait, computers.  Concurrency is a few tutorials away, yet.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #276 on: January 09, 2012, 03:38:42 pm »

That's what I get for not lurking enough: 20 pages of coding thread to read :)

I loved the tutorials, and that people actually took the effort of typing them. Good job!
Having worked with Java at work for 2 months now, I have to agree with Max: it has probably got redeeming qualities, but I'll be damned if I know where to find em. It's ugly, unwieldy, and thinking that function names such as doHandleProgressReportParsingMessageSenderActivatorCallback() (and I've seen longer) somehow make comments superfluous (because // is RSI inducing?) is just... $%^&*&^%$%. But that's more a companycodingstyle thing than Java-inherent, I guess.

Anyway, I'm coding again, and should get back to it. Actually stopping and going to bed early has been more productive than having the IDE open until 2:30 AM and then going to bed having done nothing.

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))

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #277 on: January 09, 2012, 03:55:42 pm »

Spoiler: So I got this far. (click to show/hide)

Turns out, when I said I knew the math side of program was working right?  Yeah, I wasn't even close.  I simplified a lot of stuff, which probably could be simpler, made some critical design changes, added some error prevention to avoid some accidental overflows, and extended more cells.  The only serious error is that it keeps wanting to write multiple squares in the "bottom-left" cell, but that's just one more error I can dig out.  There's tweaking and extensibility to be done, but I effectively have a working room generator.

I don't whether I should try to draw doors and tunnels next, or finally bite the bullet and work on walking a character-icon around.
Logged
And here is where my beef pops up like a looming awkward boner.
Please amplify your relaxed states.
Quote from: PTTG??
The ancients built these quote pyramids to forever store vast quantities of rage.

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #278 on: January 09, 2012, 03:55:48 pm »

With JCurses, I remember not being able to get it to initialize.  And with libjcsi, I remember the getch command just plain not working.  I didn't like ncurses for C++ just because C++ won't let me initialize the size of a 2d array at runtime.

Internally there's not really any difference between a 1D array and a 2D array. You can use [x + y * WIDTH] and it should be be no less efficient.
Logged

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #279 on: January 09, 2012, 04:10:20 pm »

That's what I get for not lurking enough: 20 pages of coding thread to read :)

I loved the tutorials, and that people actually took the effort of typing them. Good job!
Having worked with Java at work for 2 months now, I have to agree with Max: it has probably got redeeming qualities, but I'll be damned if I know where to find em. It's ugly, unwieldy, and thinking that function names such as doHandleProgressReportParsingMessageSenderActivatorCallback() (and I've seen longer) somehow make comments superfluous (because // is RSI inducing?) is just... $%^&*&^%$%. But that's more a companycodingstyle thing than Java-inherent, I guess.

Anyway, I'm coding again, and should get back to it. Actually stopping and going to bed early has been more productive than having the IDE open until 2:30 AM and then going to bed having done nothing.



As our apparent local Java expert, I feel obligated to say something.  So...
Code: [Select]
saySomething(anything());

Java's not so bad.  I'm reasonably convinced most people don't know how to effectively use it.  Method names like the one you described are an attempt at self-documenting code.  It's supposed to make comments superfluous.  I think it's stupid, too, though.  I'd much rather give it a shorthand name and leave a comment saying what it is, assuming it isn't obvious.  I guess I'm bias because I can see its redeeming qualities and tend to at least attempt to exploit them.

Spoiler: So I got this far. (click to show/hide)

Turns out, when I said I knew the math side of program was working right?  Yeah, I wasn't even close.  I simplified a lot of stuff, which probably could be simpler, made some critical design changes, added some error prevention to avoid some accidental overflows, and extended more cells.  The only serious error is that it keeps wanting to write multiple squares in the "bottom-left" cell, but that's just one more error I can dig out.  There's tweaking and extensibility to be done, but I effectively have a working room generator.

I don't whether I should try to draw doors and tunnels next, or finally bite the bullet and work on walking a character-icon around.

That's normal.  Typically, the moment you're certain something is correct is the moment you can be assured that something is incorrect.

Up to you what to do next.  Do you want to finish the map?  Or do you want to get all giddy because you can run around in your own little world?

With JCurses, I remember not being able to get it to initialize.  And with libjcsi, I remember the getch command just plain not working.  I didn't like ncurses for C++ just because C++ won't let me initialize the size of a 2d array at runtime.

Internally there's not really any difference between a 1D array and a 2D array. You can use [x + y * WIDTH] and it should be be no less efficient.

I remember trying that and I remember there being some problem or other and then getting slapped in the face by real life before I got around to investigating what wasn't right.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #280 on: January 09, 2012, 04:14:30 pm »

I did get to send a complete html e-mail with Java using 2 or 3 lines of code or something. That was pretty good.
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))

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #281 on: January 09, 2012, 04:56:23 pm »

That's normal.  Typically, the moment you're certain something is correct is the moment you can be assured that something is incorrect.

No kidding.  In this case, I just chopped the first-draft of my whole room-generation code down by a third of its original size, and massively simplified all the tagging and variables, along with seeing why rooms were being overwritten.  I did sacrifice the ability to make quarter-size rooms, but it's all working flawlessly now.

I think I will go to work next on walking an icon around.  It's going to be a pain restructuring my placeholder code, but obviously that'll have to happen eventually.

By the way, I've been reading the Fabulous Adventures in Coding blog, on shadow-casting line-of-sight methods.

Logged
And here is where my beef pops up like a looming awkward boner.
Please amplify your relaxed states.
Quote from: PTTG??
The ancients built these quote pyramids to forever store vast quantities of rage.

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #282 on: January 09, 2012, 05:01:55 pm »

That's normal.  Typically, the moment you're certain something is correct is the moment you can be assured that something is incorrect.

No kidding.  In this case, I just chopped the first-draft of my whole room-generation code down by a third of its original size, and massively simplified all the tagging and variables, along with seeing why rooms were being overwritten.  I did sacrifice the ability to make quarter-size rooms, but it's all working flawlessly now.

I think I will go to work next on walking an icon around.  It's going to be a pain restructuring my placeholder code, but obviously that'll have to happen eventually.

By the way, I've been reading the Fabulous Adventures in Coding blog, on shadow-casting line-of-sight methods.


Always nice when you can simplify code.  How did you end up cutting so much of it?  Good luck with the guy walking around.

Math...that is right up my alley.  Then again, I've head to deal with this in computer programming, robotics, and physics...
Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #283 on: January 09, 2012, 05:16:59 pm »

Math...that is right up my alley.  Then again, I've head to deal with this in computer programming, robotics, and physics...

I'm like Aqizzar.  I swear even math that is supposed to be easy stumps me.   :)  I've gotten pretty good at being able to avoid it for most things though.
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #284 on: January 09, 2012, 05:17:18 pm »

That's normal.  Typically, the moment you're certain something is correct is the moment you can be assured that something is incorrect.
Which leads to the weird uneasy feeling a programmer gets when something just works the first time. It just means you have to look harder for the bugs.
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 ... 17 18 [19] 20 21 ... 796