Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 99 100 [101] 102 103 ... 796

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

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1500 on: February 16, 2012, 11:18:01 am »

Go for the job you think you'll hate least.  You really aren't expected to like your job, but location and pay start to mean very little if you outright hate your job.
QFT
QFT. I hate my job. (2 more days YAY)
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))

Simmura McCrea

  • Bay Watcher
    • View Profile
    • My Steam profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1501 on: February 16, 2012, 11:44:59 am »

Making a roguelike in C++, wondering how to print a character to a given place on the console screen. Figured someone in here would know. Anyone wanna help?
Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1502 on: February 16, 2012, 12:10:37 pm »

Are you against using libtcod?  Because if you aren't, then use libtcod.  :)

http://doryen.eptalys.net/libtcod/

Otherwise, I'm not sure.
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1503 on: February 16, 2012, 01:34:48 pm »

Making a roguelike in C++, wondering how to print a character to a given place on the console screen. Figured someone in here would know. Anyone wanna help?
Yeah, most people use libtcod or similar for a reason. There isn't a way of saying 'turn on letter A at position 5, 7' for a console, you have to fill the entire window using empty space or whatever you want the filler symbols to be. It's terribly slow and a huge PITA to do anything of that sort with.
Logged

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1504 on: February 16, 2012, 06:47:12 pm »

Making a roguelike in C++, wondering how to print a character to a given place on the console screen. Figured someone in here would know. Anyone wanna help?

That would depend how hand-holdy you want the library to be.  Libtcod is typically considered very good, but is by no means your only option.  Whether or not it's your best option is up for debate.  If you want to get a character in the right place and don't need anything else, look into the Curses library.
Logged

Simmura McCrea

  • Bay Watcher
    • View Profile
    • My Steam profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1505 on: February 16, 2012, 07:17:23 pm »

Libtcod seems fine. Might look into curses at some point. However, I'm struggling to get Visual Studio to compile with libtcode. I've added the libtcod\include directory as an additional library directory but it swears it can't find libtcod.hpp. It's possible I'm simply telling VS in the wrong place or something, but I can't really find anywhere else that makes sense.

EDIT: Nevermind, found it.
« Last Edit: February 16, 2012, 07:24:17 pm by Simmura McCrea »
Logged

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1506 on: February 16, 2012, 07:19:11 pm »

In a strange case of coherence, both my Java and my C classes started working on if-else statements today. Is it odd that I understand them far easier then I do functions?
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

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1507 on: February 16, 2012, 07:20:28 pm »

No, if-then-else statements have a clear analog in natural language, functions don't.
Logged

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1508 on: February 16, 2012, 07:36:21 pm »

Normal to me. Functions are abstract concepts. If/else is fundamental logic, which is why it's at the bottom of the whole thing.
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1509 on: February 16, 2012, 07:38:40 pm »

In that case, I wish my C teacher had held off on teaching functions until we had a better grasp of the basics  ::)
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

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1510 on: February 16, 2012, 07:42:04 pm »

Well, functions are still pretty basic, since main() is a function and that's where you have to start. But to me, if/else is kind of at the root of all programs in some way, because it's the way all programs make decisions. And since those statements sit inside functions....to me in the beginning it would make sense to start at the center and expand out from there.

I've learned that understanding coding and being able to explain it to novice coders in a way they can handle is an art, and not all programmers are good at it. Their understanding prevents them from breaking it down into pieces others can wrap their heads around. Kind of my gripe with math people too, they often do the same thing.
« Last Edit: February 16, 2012, 07:45:45 pm by nenjin »
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1511 on: February 16, 2012, 07:45:29 pm »

Well, coding is an art and explaining things is also an art. So to explain coding, you have to be skilled in two arts at the same time.
Logged

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1512 on: February 16, 2012, 07:49:05 pm »

Yes, main() is a function, but you could put an entire program in there and it would work. We're adding functions for accepting user input, then sending that data to another function to do calculations, sending the results to yet another function for an if-then-else tree, and finally sending it to one more function to print the results. It's stupidly over-complicated right now, and it's pissing me off that so many of my classmates seem to get it right away while I'm still copying whatever works from previous assignments. Which invariably seem to stop working despite being identical data types and fulling similar functions.
</mini-rant>
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

nenjin

  • Bay Watcher
  • Inscrubtable Exhortations of the Soul
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1513 on: February 16, 2012, 07:54:22 pm »

Quote
It's stupidly over-complicated right now, and it's pissing me off that so many of my classmates seem to get it right away while I'm still copying whatever works from previous assignments. Which invariably seem to stop working despite being identical data types and fulling similar functions.

I feel your pain. But there is a reason for all of it, I assure you. They're trying to get you used to good programming practices rather than teaching you "functional" programming practices. Sure, you could stick everything in main(). Except every variable defined in main() will be global, and the more information you start juggling (or the more you juggle it), the harder it gets to manipulate global variables without causing a logic error or a run-time error. That might not mean anything to you now, but in time it will.

If your course hasn't gone into things like encapsulation or program and variable scope, you might want to do some self-directed learning. Because those two concepts, one of which is a way of programming and the other of which is how the program treats variables, are pretty important to understanding WHY he's got half a dozen functions talking to each other and passing values back and forth.

Just out of curiosity, what level of course is this? An introductory 101 level course? A 201 course?
« Last Edit: February 16, 2012, 08:01:07 pm by nenjin »
Logged
Cautivo del Milagro seamos, Penitente.
Quote from: Viktor Frankl
When we are no longer able to change a situation, we are challenged to change ourselves.
Quote from: Sindain
Its kinda silly to complain that a friendly NPC isn't a well designed boss fight.
Quote from: Eric Blank
How will I cheese now assholes?
Quote from: MrRoboto75
Always spaghetti, never forghetti

Simmura McCrea

  • Bay Watcher
    • View Profile
    • My Steam profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1514 on: February 16, 2012, 08:10:34 pm »

Libtcod's not wanting to work right. Currently trying to print a string, just to test, and all I get is a frozen window.
Code: [Select]
#include <iostream>
#include <time.h>
#include "libtcod.hpp"

using namespace std;

int main()
{
TCODConsole::root->initRoot(80,50,"FARL",false);
TCODConsole::root->setBackgroundColor(TCODColor::black);
TCODConsole::root->setForegroundColor(TCODColor::white);
TCODConsole::root->printLeft(0, 0, TCOD_BKGND_SET, "PRINT DAMN IT");

while(1){
}
return 0;
}
If I replace the colour setting and print with TCODConsole::credits(); it works fine.
Logged
Pages: 1 ... 99 100 [101] 102 103 ... 796