Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 143 144 [145] 146 147 ... 796

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

dreadmullet

  • Bay Watcher
  • Inadequate Comedian
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2160 on: April 15, 2012, 04:36:20 am »

You can't be serious...there's a system for using ncurses with C#?  C# is a Windows exclusive language, ncurses is designed to run on *nix systems like OSX and linux.  It would make far more sense for C# to use pdcurses.  Anyway, care to post it for us to see?

Haha, I guess I didn't do much research on the library I used. I found this link in The Roguelike Development Megathread and when I found out it worked I just went with it.

At first, all I wanted to do was implement A* pathfinding, and I figured it would be easier to do it in a simple console program instead of doing it in my OpenGL game I was making. But then I thought it would be fun to make a simple roguelike engine, and learn about AI programming. I spent a month on it...
Logged

Aptus

  • Bay Watcher
  • Indeed ôo
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2161 on: April 15, 2012, 06:33:33 am »

---

I could probably write this in Verilog HDL in my sleep...I miss my FPGA...  Anyway, the reference manual for VHDL says that std_logic is defined as

Thanks, I'll try it out and report back :)
Logged

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2162 on: April 15, 2012, 12:02:56 pm »

Spoiler: So yeah. (click to show/hide)

I guess it's never a good sign when you don't know what you did that fixed a problem.  But if there's one truth I've learned in programming, it's not to argue with results.

Now to just translate in the rest of my code, and I'll be back up to speed where I was two months ago, and wiser for it.
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.

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2163 on: April 15, 2012, 10:50:38 pm »

So, I guess I'm qualified to try to explain Libtcod at this point.  I've mostly gotten around its quirky components by writing some functions to do all the TCODConsole crap for me.  The point is, don't let complexity run away from you.

Meanwhile, I'm looking at all this code I wrote months ago, trying to figure out what the Hell half of it does.  I'm even having problems crop up that I fixed back then.

Spoiler: Case in point. (click to show/hide)

Ironically, I appreciate how organic the hallways look, compared to how right-angled they got once I got the algorithm working.  I wish I knew what was going on in there, so I could make it happen on purpose.  Some tracing might be in order.
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.

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2164 on: April 15, 2012, 11:18:47 pm »

So, am I doing this wrong, or what? In C, I can't seem to set up do-while loops for Strings. I enter code like this:
Code: [Select]
while (command != 'quit')And I get an error about not being able to combine char* and int, or something along those lines. The above code works perfectly however, if I turn command into a normal char:
Code: [Select]
while (command != 'q')Or at least, I'm not getting any errors when building.

Also, I want to force command to use lower-case letter(s) for ease of coding decision trees. How would I go about that?
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2165 on: April 15, 2012, 11:32:22 pm »

With C, you need to use strcmp to compare strings. Also, "quit" is a C-string; I am not sure why the compiler isn't complaining about 'quit' in general.
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2166 on: April 15, 2012, 11:55:55 pm »

With C, you need to use strcmp to compare strings. Also, "quit" is a C-string; I am not sure why the compiler isn't complaining about 'quit' in general.

It is, but subtly. The whole mess about const char* versus int is it trying to compare a C-string (const char*) to a integral value (bool/short/char/int/long).

Double quotes for strings, single quotes for chars.

Chagen46

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2167 on: April 16, 2012, 01:51:22 pm »

Hm. I'm thinking of getting into programming/coding but I have one question to ask: how much work do you think I should put in to get good at it?

I ask this because I am unfortunately afflicted with the oh-so-annoying trait of "drops something if it doesn't interest them in five seconds". Programming/Coding seems like it would take a LOT of time until you can actually make something interesting, and I don't want to drop it too soon.

Also, this probably isn't true at all, but I'm wondering if proficiency in natural languages helps when learning programming languages. I'm good when it comes to natural linguistics, but I wonder if that will transfer over to computer linguistics.
Logged
Great! my fps improved significantly and now my sewer is full of corpses like it should be.

AlStar

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2168 on: April 16, 2012, 02:00:29 pm »

Hm. I'm thinking of getting into programming/coding but I have one question to ask: how much work do you think I should put in to get good at it?
...
Also, this probably isn't true at all, but I'm wondering if proficiency in natural languages helps when learning programming languages. I'm good when it comes to natural linguistics, but I wonder if that will transfer over to computer linguistics.

First off, this is all in my opinion, of course, but I would say that the trait of "drops something if it doesn't interest them in five seconds" would run directly counter to that of programming.

Programming (at least for the beginner/novice) is all about taking an idea for something, turning it into code (not a quick process in itself, mind)... then bashing your head against it for hours/days/weeks trying to get it to work like you think it should. It doesn't really lend itself to instant rewards (although the feeling of acomplishment when you finally see something you coded working as intended can be a real rush.)

As for the second part... ehhhh... I like to think my background in creative writing/editing helps me pick up on some of the subtler bugs in my code, (Oh, I missed a comma there, that's why that line of code isn't doing what I want) but overall I would say that coding is almost more mathematical in character.

That said, give it a try. Maybe it'll appeal to you.
« Last Edit: April 16, 2012, 02:02:34 pm by AlStar »
Logged

Chagen46

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2169 on: April 16, 2012, 02:43:19 pm »

Yeah, that feeling when you finally succeed at something is pretty cool.

I think that programming might appeal to me because of that. I dunno why, but the idea of being able to actually MAKE something is really cool to me. I think I would love it when I finally boot my up roguelike and I can do something in it. Yeah, all it does is generate a random level, an "@", and let you move it. But still! I made a program that worked! And it made randomly generated levels! And you could play it! That alone would feel immensly satisfying. I think if I held out that far, I could keep going.

There's just something satisfying about making something.

And then I have to spend 8 hours debugging code and making up formulas for damage and hate myself for ever thinking that that was a good idea
Logged
Great! my fps improved significantly and now my sewer is full of corpses like it should be.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2170 on: April 16, 2012, 05:18:33 pm »

In my Java class, I learned that this is possible:

    GLabel label = new GLabel("text",x,y);
    label.setColor(Color);

...Can someone tell me what is going on? Is that making a label variable that stores the data of one GLabel class, then using .setColor() to change some data in that class?

o_o

Or, more to the point: I want to create a console-based D&D fight simulator in C++ as a project for fun. I have to have a easy way to store multiple variables, but I also want to break away from what's known to me. I heard that you could use classes to store variables, but I don't know how, being a novice programmer.

TL.DR : How to store variables (and access them) using classes instead of structures?
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

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #2171 on: April 16, 2012, 05:27:41 pm »

In my Java class, I learned that this is possible:

    GLabel label = new GLabel("text",x,y);
    label.setColor(Color);

...Can someone tell me what is going on? Is that making a label variable that stores the data of one GLabel class, then using .setColor() to change some data in that class?

o_o

Or, more to the point: I want to create a console-based D&D fight simulator in C++ as a project for fun. I have to have a easy way to store multiple variables, but I also want to break away from what's known to me. I heard that you could use classes to store variables, but I don't know how, being a novice programmer.

TL.DR : How to store variables (and access them) using classes instead of structures?

This is creating an Object that is an Instance of the GLabel class, label is a reference to that instance. setColor(whatever) is a method defined by  the GLabel class for its instances, it changes data of the object, rather than the class.

Both java and c++ have somewhat different ways of doing basically the same thing with classes and objects.

Are you asking how to create and use classes and objects in java or c++? I assume c++ because you will get to classes and objects in your Java class relatively soon.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #2172 on: April 16, 2012, 05:46:53 pm »

Yup, C++, because I'm learning Java as a course, and eventually I'll get to it I suppose ^^;;


I know that classes are a very huge subject tho' >.>
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

Chagen46

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2173 on: April 16, 2012, 06:05:59 pm »

Given how I'm thinking of taking the plunge into coding, now I need to figure out what language I should learn first.

I heard that Pascal is good if you want to code a roguelike.

Quote
As for the second part... ehhhh... I like to think my background in creative writing/editing helps me pick up on some of the subtler bugs in my code, (Oh, I missed a comma there, that's why that line of code isn't doing what I want) but overall I would say that coding is almost more mathematical in character.

Actually, I study natural linguistics, and you'll be surprised: human languages really are more similar to computer languages than you'd think--the difference is that natural langs intentionally have redundancy and ambiguity, because explicitly detailing every last detail of your statement generally isn't neccessary. However, these comparisons only apply when you go REALLY deep in Linguistics.

EDIT: Actually a better way of describing it is that programming languages are context-free (that is, ecery production rule is of the form V → w, where V is a single nonterminal symbol, and w is a string of terminals and/or nonterminals (w can be empty), while human languages are not (they're something called transformational grammar, I'm not fully briefed on that, yet).

« Last Edit: April 16, 2012, 06:09:27 pm by Chagen46 »
Logged
Great! my fps improved significantly and now my sewer is full of corpses like it should be.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2174 on: April 16, 2012, 06:10:18 pm »

Language schmanguage. Learning a computer language takes days, and you'd be proficient in it.

The challenge lies within concepts, abstract stuff, and connecting all that stuff in your brain, before you write it down.
I'd say more but I've done it too much already today, ran out of thinking juice  :-\

Programming is like poetry, or writing a book in that way: the language is a tool that is necessary, but your knowledge of English and a good idea won't write you a compelling novel.
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 ... 143 144 [145] 146 147 ... 796