Bay 12 Games Forum

Please login or register.

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

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

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #285 on: January 09, 2012, 05:18:40 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.

This is why we have computers and calculators.  You don't have to be able to do the math if you can tell a machine how to do it for you.
Logged

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #286 on: January 09, 2012, 05:21:14 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.

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

Well, compared to the deluge of Ifs I originally vomited up, I realized a fundamental flaw in the way my boolean-system worked.  I was sending in a one-dimensional array and a number, and using a lot of math to pretend it was a two-dimensional array.  On top of confusing the Hell out of me, this lead to a lot of duplication of effort and unnecessary math that was cut out just by hard-coding some assumptions about the input.  (And I just thought of another way to simplify the code, genius.)

Most importantly though, by having the array check each True cell to it's left, up/down, and right, it would see which directions it could extend an extra-length room into, and then mark that cell as True so nothing else would extend there.  Except that when it cycled to the next cell, if it was a cell that was originally False but extended into, now it was True but already had a room there, and overwrote it.  So I knocked out a good half to the code, so True cells only look for False cells to extend into to the above and behind, so it won't catch them twice.

I always love watching unnecessary complication give way to simplicity, really makes me feel like I accomplished something.  That's my usual way of working - write a program that I expect to do everything, get really frustrated when it craps out on me, and selective-comment blocks of code until I know exactly how much of I need.  The result is a block of code that I wouldn't have been able to read at the beginning, but works vastly better with much fewer lines than my original concept.  It makes me feel really smart.
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.

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #287 on: January 09, 2012, 05:57:17 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.  C++ is otherwise great, though I never tried running libtcod in it; I only tried building my own engine.  I can't remember what, but something about the mechanics of Python annoyed me...  It doesn't help that none of these libraries (except maybe ncurses itself) has been updated in years.

So, should I spend my day trying to get Java to run JCurses or libjcsi, trying to get C++ to run libtcod, trying to get Python to run libtcod or Pygame, trying to learn Clojure, trying to learn C#, trying to re-invent my custom roguelike engine that I coded in Java a couple years ago because I couldn't get JCurses or libjcsi to work (yes, I coded my own engine from scratch in Java because I got frustrated at the existing ones), writing another two Java tutorials, doing my homework, or fixing my computer?  Hm...decisions, decisions...

Code: [Select]
vector<vector<int> > dynamic_2D_array;
Just throwing that out there.

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?

I have 9 hours of school a day, a few hours of homework each night, a succession fort that I'm running, 2 RTD's that I'm in, and then this. I am also incredibly forgetful, so much that I often forget everything that I was thinking about the moment I start thinking about something else. Forgive me if I don't get to something soon after I say I'll do it. I'll get to that now.

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #288 on: January 09, 2012, 06:38:19 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.  C++ is otherwise great, though I never tried running libtcod in it; I only tried building my own engine.  I can't remember what, but something about the mechanics of Python annoyed me...  It doesn't help that none of these libraries (except maybe ncurses itself) has been updated in years.

So, should I spend my day trying to get Java to run JCurses or libjcsi, trying to get C++ to run libtcod, trying to get Python to run libtcod or Pygame, trying to learn Clojure, trying to learn C#, trying to re-invent my custom roguelike engine that I coded in Java a couple years ago because I couldn't get JCurses or libjcsi to work (yes, I coded my own engine from scratch in Java because I got frustrated at the existing ones), writing another two Java tutorials, doing my homework, or fixing my computer?  Hm...decisions, decisions...

Code: [Select]
vector<vector<int> > dynamic_2D_array;
Just throwing that out there.

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?

I have 9 hours of school a day, a few hours of homework each night, a succession fort that I'm running, 2 RTD's that I'm in, and then this. I am also incredibly forgetful, so much that I often forget everything that I was thinking about the moment I start thinking about something else. Forgive me if I don't get to something soon after I say I'll do it. I'll get to that now.

I don't know why I didn't think of using vectors like that.  I use Lists like that in Java all the time...  Then again, I last looked at that a year or two ago, when I didn't know nearly as much about C++, so it's possible I wasn't aware of vectors back then...I don't honestly remember.

I didn't mean to be offensive with the off-comment about indexing noteworthy posts in the OP.  I know you have a life outside this thread and this forum.  I do too.  We all do.  I can also understand forgetfulness.  I think we all have that problem, as well.  So relax a bit.  And thank you for doing it.  That should make things a bit easier for anyone looking here later.
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #289 on: January 09, 2012, 06:46:25 pm »

I didn't mean that to be rude, but looking back, it seems to have come out that way. I think we need to come up with a syntax for things that might be taken as rudeness but aren't meant to be rude.

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #290 on: January 09, 2012, 06:50:36 pm »

I didn't mean that to be rude, but looking back, it seems to have come out that way. I think we need to come up with a syntax for things that might be taken as rudeness but aren't meant to be rude.

Just put smilies everywhere you can.   :D  I'd rather look insane than rude.  :) ;) :P

Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

MagmaMcFry

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

[literal][/literal]?
Logged

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #292 on: January 09, 2012, 06:52:38 pm »

I didn't mean that to be rude, but looking back, it seems to have come out that way. I think we need to come up with a syntax for things that might be taken as rudeness but aren't meant to be rude.

This is the second time this has happened in this thread...both of them involved me but on opposite sides.  As I've been telling people for the better part of a decade, text is a really bad way of conveying information.  You lose so much and consequently, readers need to make informed assumptions.  That's proven repeatedly to be a very dangerous thing.  So...

I didn't mean that to be rude, but looking back, it seems to have come out that way. I think we need to come up with a syntax for things that might be taken as rudeness but aren't meant to be rude.

Just put smilies everywhere you can.   :D  I'd rather look insane than rude.  :) ;) :P



What do you mean look insane?
[/itOnlySoundsRude]
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #293 on: January 09, 2012, 07:02:25 pm »

Although you can use inflection in talking to express tone, text is really one of the most effective ways to communicate. Too much can be lost due to different pronunciations.

What the hell this is a programming thread.

Code: [Select]
while(id.ten_t()) this->applyHead(wall);
Story of my day.

MagmaMcFry

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

Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #295 on: January 09, 2012, 07:17:24 pm »

It's an error code for computer techs. ID 10-T.

Remove the spaces and read leetspeak.

MagmaMcFry

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

Sigh.
Logged

Stargrasper

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

Yeah, that works, but I think you should apply this code instead.
Code: [Select]
while(!isDrunk) {
     applyHead(wall);
     Thread.sleep(500);
     applyHead(desk);
     Thread.sleep(500);
}

Also, I'm working on tutorials still.  Today is planning day, trying to figure out what to talk about when...roadmapping this stuff out is harder than it sounds.  Mainly because I want to cover a lot in a specific order with extreme conceptual detail...here's the tentative map that is almost surely going to change...
Quote
*.* IDE Setup
0.0 The Very Beginning
0.1 Whitespace, Comments, and Code Style
0.2 Computer
0.3 Primitive Variables
0.4 Strings and Conditionals
---
0.5 Arrays, Loops, Other Concepts I skipped - Math, Comments, Style, etc .. may become it's own lesson
0.6 Debugging
0.7 Exam 1
0.8 Methods
0.9 Wishful Thinking
1.0 Classes
1.1 Datastructures
1.2 Algorithms
1.3 Exam 2
1.4+ TBD
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #298 on: January 09, 2012, 07:28:47 pm »

Code: [Select]
while (true)
{
if(!this.drunk)
{
this.Drink(new Bottle(Drinks.CIDER));
}
else
{
this.Sleep();
}
}

Stargrasper

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

Code: [Select]
while (true)
{
if(!this.drunk)
{
this.Drink(new Bottle(Drinks.CIDER));
}
else
{
this.Sleep();
}
}

I wish I could conjure cider out of nowhere...or Riesling or Bordeaux...  I also wish I could sleep...

I like your choice of drinks, btw.  But shouldn't that code include an embedded loop for gulping it down?  Or are you supposed to drink the whole bottle in one tic?
Logged
Pages: 1 ... 18 19 [20] 21 22 ... 796